Reputation
3,069
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
11 16
Newest
 Guru
Impact
~25k people reached

  • 0 posts edited
  • 8 helpful flags
  • 92 votes cast
Feb
7
comment Better to have 2 methods with clear meaning, or just 1 dual use method?
Thanks everyone, i rephrased some of my original answer and added a few more arguments to it based on your comments.
Feb
7
revised Better to have 2 methods with clear meaning, or just 1 dual use method?
Incorporating suggestions from comments and better phrasing of the original post, thanks commenters
Feb
6
awarded  Guru
Feb
5
awarded  Good Answer
Feb
5
awarded  Mortarboard
Feb
5
awarded  Enlightened
Feb
5
awarded  Nice Answer
Feb
5
answered Better to have 2 methods with clear meaning, or just 1 dual use method?
Dec
20
awarded  Good Answer
Aug
9
answered Does declaring a field as final force redundancy in the constructors?
Apr
27
reviewed Approve How to convince teammates to use TDD
Apr
16
awarded  Yearling
Apr
12
reviewed Approve Using subroutines to return values?
Apr
12
reviewed Approve Groups relationships - Detailed or Direct?
Apr
6
answered Property based testing without reimplementing the code under test
Mar
10
reviewed Approve The dream of declarative programming
Mar
9
comment Is the Single Responsibility Principle applicable to functions?
@MichaelShaw yes, you're right - SRP does depend on how the organization is organized. That is exactly why I add "may" or "might" to all my comments :). However, even in those cases, while the code may not violate SRP, it surely does violate OCP.
Mar
9
comment Is the Single Responsibility Principle applicable to functions?
@MichaelShaw like in the quote from the book, if you need to introduce different employee types, you have to change the Employee class. Different roles may be responsible for the payment of different employee types, so in this case, the Employee class has to be changed for more than one role, hence the violation of SRP.
Mar
9
comment Is the Single Responsibility Principle applicable to functions?
@MichaelShaw different employee types may be "requested by different people" or "requested by different user roles", to use the words you quoted from the video. The calculatePay method would have to be changed for many different roles, thus, it violates SRP.
Mar
8
answered Is the Single Responsibility Principle applicable to functions?