design principles in software development
TRANSCRIPT
![Page 1: Design principles in software development](https://reader030.vdocuments.site/reader030/viewer/2022032616/55a68c771a28abb27d8b45e5/html5/thumbnails/1.jpg)
Design PrinciplesRinat Khabibiev
![Page 2: Design principles in software development](https://reader030.vdocuments.site/reader030/viewer/2022032616/55a68c771a28abb27d8b45e5/html5/thumbnails/2.jpg)
* www.ExigenServices.com
DESIGN PRINCIPLES
● KISS (Keep It Simple, Stupid!) ● YAGNI (You Aren't Going to Need It) ● Don't make me think ● Write code for the maintainer ● DRY (Don’t Repeat Yourself) ● SOLID
Table of contents
![Page 3: Design principles in software development](https://reader030.vdocuments.site/reader030/viewer/2022032616/55a68c771a28abb27d8b45e5/html5/thumbnails/3.jpg)
* www.ExigenServices.com
DESIGN PRINCIPLES: KISS
Best code is not written code.
Best solution is make it unnecessary.
Keep It Simple Stupid! (KISS)
![Page 4: Design principles in software development](https://reader030.vdocuments.site/reader030/viewer/2022032616/55a68c771a28abb27d8b45e5/html5/thumbnails/4.jpg)
* www.ExigenServices.com
DESIGN PRINCIPLES: YAGNI
• Every feature need to be tested after every code refactoring,
do you really need all this stuff?
• Ideal solution is YAGNI.
You Aren't Going to Need It (YAGNI)
![Page 5: Design principles in software development](https://reader030.vdocuments.site/reader030/viewer/2022032616/55a68c771a28abb27d8b45e5/html5/thumbnails/5.jpg)
* www.ExigenServices.com
DESIGN PRINCIPLES: DON'T MAKE ME THINK
• I do not have enough time to think how it works.
• Comments is good but it isn’t crucial.
- One does not simply write code
Don't make me think
![Page 6: Design principles in software development](https://reader030.vdocuments.site/reader030/viewer/2022032616/55a68c771a28abb27d8b45e5/html5/thumbnails/6.jpg)
* www.ExigenServices.com
DESIGN PRINCIPLES: WRITE CODE FOR THE MAINTAINER
• Avoid spaghetti code.
• Every entity should be available by Ctrl/Cmd + click.
This is crazy maintainer, he knows where you live
Write code for the maintainer
![Page 7: Design principles in software development](https://reader030.vdocuments.site/reader030/viewer/2022032616/55a68c771a28abb27d8b45e5/html5/thumbnails/7.jpg)
* www.ExigenServices.com
DESIGN PRINCIPLES: SINGLE RESPONSIBILITY
• Every piece of knowledge must have single, unambiguous,
obvious representation.
Don’t Repeat Yourself (DRY)
![Page 8: Design principles in software development](https://reader030.vdocuments.site/reader030/viewer/2022032616/55a68c771a28abb27d8b45e5/html5/thumbnails/8.jpg)
* www.ExigenServices.com
DESIGN PRINCIPLES: SINGLE RESPONSIBILITY
• One goal for single entity.
SOLID: Single responsibility
![Page 9: Design principles in software development](https://reader030.vdocuments.site/reader030/viewer/2022032616/55a68c771a28abb27d8b45e5/html5/thumbnails/9.jpg)
* www.ExigenServices.com
DESIGN PRINCIPLES: SINGLE RESPONSIBILITY
• Software entities should be closed for modification.
• Software entities should be open for extension.
SOLID: Open/closed principle
![Page 10: Design principles in software development](https://reader030.vdocuments.site/reader030/viewer/2022032616/55a68c771a28abb27d8b45e5/html5/thumbnails/10.jpg)
* www.ExigenServices.com
DESIGN PRINCIPLES: SINGLE RESPONSIBILITY
• If B is subclass of A then B objects may be used instead of A
objects.
SOLID: Liskov substitution principle
![Page 11: Design principles in software development](https://reader030.vdocuments.site/reader030/viewer/2022032616/55a68c771a28abb27d8b45e5/html5/thumbnails/11.jpg)
* www.ExigenServices.com
DESIGN PRINCIPLES: SINGLE RESPONSIBILITY
• Several specialized interfaces is better than one universal.
SOLID: Interface segregation principle
![Page 12: Design principles in software development](https://reader030.vdocuments.site/reader030/viewer/2022032616/55a68c771a28abb27d8b45e5/html5/thumbnails/12.jpg)
* www.ExigenServices.com
DESIGN PRINCIPLES: SINGLE RESPONSIBILITY
• High-level modules should not depend on low-level modules.
• Abstractions should not depend on details.
Example of bad design
SOLID: Dependency inversion principle
![Page 13: Design principles in software development](https://reader030.vdocuments.site/reader030/viewer/2022032616/55a68c771a28abb27d8b45e5/html5/thumbnails/13.jpg)
* www.ExigenServices.com
PHPUNIT: MOCK OBJECTS
The end