Timeline for Are there flavours of OOP where some or all of the SOLID principles are antithetical to clean code?
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 1, 2018 at 17:03 | comment | added | Jules | @JacquesB - true. And OCP is at its core oppposed to YAGNI; however you go about achieving it, it requires you to design in extension points to enable later improvement. Finding a suitable balance point between the two ideals is ... tricky. | |
Feb 1, 2018 at 9:41 | comment | added | JacquesB | @Jules: Yes composition is preferable, but it still requires you to design the original class in such a way that composition can be used to customize it, hence you have to make assumptions about what aspects need to be customized in the future and what aspects are not customizable. In some cases this is necessary to do (e.g. you are writing a library for distribution) but it has a cost, hence following SOLID is not always optimal. | |
Feb 1, 2018 at 9:36 | comment | added | JacquesB | @CandiedOrange: I disagree that machine code is simpler than code in a high-level language. Machine code ends up containing a lot of accidental complexity due to the lack of abstraction, so it is definitely not KISS to decide to write a typical application in machine code. | |
Jan 30, 2016 at 20:27 | comment | added | candied_orange | If KISS and YAGNI always took priority you should still be coding in 1's and 0's. Assemblers are just something else that can go wrong. No KISS and YAGNI point out two of the many costs of design work. That cost should always be balanced against the benefit of any design work. SOLID has benefits that in some cases makes up for the costs. There is no simple way to tell when you've crossed the line. | |
Sep 11, 2015 at 0:53 | comment | added | Jules | Your discussion of OCP ignores the possibility of extending behaviour of a class via composition (e.g. using a strategy object to allow an algorithm used by the class to be changed), which is generally held to be a better way of complying with the principal than subclassing. | |
May 18, 2015 at 12:17 | history | edited | JacquesB | CC BY-SA 3.0 |
added 544 characters in body
|
May 18, 2015 at 11:53 | history | answered | JacquesB | CC BY-SA 3.0 |