SOLID principles presentation and few additional words about DRY, KISS, YAGNI
Size: 4.01 MB
Language: en
Added: Sep 02, 2017
Slides: 14 pages
Slide Content
Joanna Lamch SOLID
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
Problem s Does our code solves challenges and business problems that it should Is our code human readable Is our code maintainable Is our code extensible, scalable Is our code granular and reusable
Single responsibility principle Class should have only one reason to change Because you can doesn’t mean you should
Open-close principle System elements should be open for extension but closed for modification Lights can be dismantled without taking out an engine
Liskov substitution principle Object of a derived class should be able to replace an object of the base class without bringing any errors in the system or modifying the behavior of the base class If it looks like a duck, and quack like a duck, but it needs batteries, You probably have wrong level of abstraction
Interface segregation principle Many specialized interfaces are better than one almighty. A client should never be forced to implement an interface that it doesn’t need or clients shouldn’t be forced to depend on methods they do not use. It’s not a good idea to mix electricity and water in one place
Dependency inversion principle The high level module must not depend on the low level module. Both modules should depend on abstractions. Abstractions should not depend on details. Details should depend on abstractions. You don’t need to know how the engine is build to start it
KISS DRY YAGNI YAGNI You Ain’t Gonna Need It
KISS DRY YAGNI YAGNI DRY Don’t Repeat Yourself WET We Enjoy Typing Write Everything Twice
KISS DRY YAGNI YAGNI DRY KISS Keep It Simple Stupid Keep It Simple, Stupid Keep it Simple Silly Keep It Short & Simple Keep It Small & Simple Keep It Simple & Straightforward