Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
chairbender committed Nov 28, 2015
1 parent 387efcf commit a84ad41
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ I could add support for parsing an entire Java project as an option. For now, ch
### Rule 9 - No getters/setters/properties
It will detect some obvious getters / setters. However, it will still miss cases where a method is, effectively, a getter
or setter, but does something other than simply setting or retrieving the value of a class member/field. For example,
if I have an Employee who contains a PayrollInfo member and I have a method on Employee called getAnnualSalary which
returns payrollInfo.getAnnualSalary(), effectively, that method is acting as a getter and violating the spirit
of this rule, but the analyzer will miss it. It WOULD catch a method like Employee.getPayrollInfo() which simply returns
the payrollInfo member.
if I have an _Employee_ who contains a _PayrollInfo_ member and I have a method on _Employee_ called _getAnnualSalary_ which
returns _payrollInfo.getAnnualSalary()_, effectively, that method is acting as a getter and violating the spirit
of this rule, but the analyzer will miss it. It WOULD catch a method like _Employee.getPayrollInfo()_ which simply returns
the _payrollInfo_ member.

So, figure out if a method is acting as a getter / setter, and try to design your code so you can TELL a class to
do something instead of ASKing it for some data. Tell Employee to be paid (employee.pay()) instead of doing getSalary()
and getBonus() and then calling BankAccount.setValue() with the value of that calculation. Tell, don't ask.
do something instead of ASKing it for some data. Tell _Employee_ to be paid (_employee.pay()_) instead of doing _getSalary()_
and _getBonus()_ and then calling _BankAccount.setValue()_ with the value of that calculation. Tell, don't ask.

## Contributing
Please create issues to send me any suggestions you have for improving the API or any problems you encounter while using it.

0 comments on commit a84ad41

Please sign in to comment.