Skip to main content
replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

Adding to @Carlos' Alejo answer@Carlos' Alejo answer there is one more idicator that tells you whether you are on the SOLID side of the force :-]

If you tried to add another sex to your first model you couldn't do it without modifying the CallLowerClass method and its switch. It violates the Open/Closed Principle.

With the second model that is based on an abstraction ISex you just create a new class and you're done. It's open for extension but closed for modification.

Adding to @Carlos' Alejo answer there is one more idicator that tells you whether you are on the SOLID side of the force :-]

If you tried to add another sex to your first model you couldn't do it without modifying the CallLowerClass method and its switch. It violates the Open/Closed Principle.

With the second model that is based on an abstraction ISex you just create a new class and you're done. It's open for extension but closed for modification.

Adding to @Carlos' Alejo answer there is one more idicator that tells you whether you are on the SOLID side of the force :-]

If you tried to add another sex to your first model you couldn't do it without modifying the CallLowerClass method and its switch. It violates the Open/Closed Principle.

With the second model that is based on an abstraction ISex you just create a new class and you're done. It's open for extension but closed for modification.

Source Link
t3chb0t
  • 44.7k
  • 9
  • 84
  • 191

Adding to @Carlos' Alejo answer there is one more idicator that tells you whether you are on the SOLID side of the force :-]

If you tried to add another sex to your first model you couldn't do it without modifying the CallLowerClass method and its switch. It violates the Open/Closed Principle.

With the second model that is based on an abstraction ISex you just create a new class and you're done. It's open for extension but closed for modification.