introduction to advance design & coding
TRANSCRIPT
![Page 1: Introduction to advance design & coding](https://reader034.vdocuments.mx/reader034/viewer/2022051404/58edc63c1a28abd8508b46d1/html5/thumbnails/1.jpg)
Dinuka Malalanayake
https://malalanayake.wordpress.com/
Dinuka MalalanayakeIntegration Team Lead
FHLB Des Moines Mobile : (515) 509-1072 Office : (515) 281-1164
[email protected] [email protected]
1
Introduction to advance design & coding “Software Design Patterns”
![Page 2: Introduction to advance design & coding](https://reader034.vdocuments.mx/reader034/viewer/2022051404/58edc63c1a28abd8508b46d1/html5/thumbnails/2.jpg)
Dinuka Malalanayake
https://malalanayake.wordpress.com/
• ?
• Advantages & Disadvantages
• OO Programming
• Principals of OO Design
• Challenges
2
Agenda
![Page 3: Introduction to advance design & coding](https://reader034.vdocuments.mx/reader034/viewer/2022051404/58edc63c1a28abd8508b46d1/html5/thumbnails/3.jpg)
Dinuka Malalanayake
https://malalanayake.wordpress.com/
?
3
• Advance coding is not writing complicated business logics. It is writing the stable code to archive the business goals with extensibility, maintainability, reusability.. etc.
• Design patterns are solutions to general problems that software developers faced during software development • Creational Patterns
• Structural Patterns
• Behavioral Patterns
• Java EE Patterns
![Page 4: Introduction to advance design & coding](https://reader034.vdocuments.mx/reader034/viewer/2022051404/58edc63c1a28abd8508b46d1/html5/thumbnails/4.jpg)
Dinuka Malalanayake
https://malalanayake.wordpress.com/
Advantages & Disadvantages
4
• Advantages -
• Tool for effective communication
• Enhance code readability
• Disadvantages -
• Increasing the amount of code
• More Indirection code execution
![Page 5: Introduction to advance design & coding](https://reader034.vdocuments.mx/reader034/viewer/2022051404/58edc63c1a28abd8508b46d1/html5/thumbnails/5.jpg)
Dinuka Malalanayake
https://malalanayake.wordpress.com/
OO Programming
5
• Encapsulation
• Abstraction
• Polymorphisms
• Inheritance
• Delegation
• Composition
• Aggregation
![Page 6: Introduction to advance design & coding](https://reader034.vdocuments.mx/reader034/viewer/2022051404/58edc63c1a28abd8508b46d1/html5/thumbnails/6.jpg)
Dinuka Malalanayake
https://malalanayake.wordpress.com/
• S – Single-responsibility principle
• O – Open-close principle
• L – Liskov's substitution principle
• I – Interface segregation principle
• D – Dependency Inversion principle
6
Principals of OO Design
![Page 7: Introduction to advance design & coding](https://reader034.vdocuments.mx/reader034/viewer/2022051404/58edc63c1a28abd8508b46d1/html5/thumbnails/7.jpg)
Dinuka Malalanayake
https://malalanayake.wordpress.com/ 7
Single-responsibility principle
• A class should have only one reason to change
• Sample code >
• Improved sample code >
![Page 8: Introduction to advance design & coding](https://reader034.vdocuments.mx/reader034/viewer/2022051404/58edc63c1a28abd8508b46d1/html5/thumbnails/8.jpg)
Dinuka Malalanayake
https://malalanayake.wordpress.com/
• Open for extension but closed for modifications
• Sample code >
• Improved sample code >
8
Open-close principle
![Page 9: Introduction to advance design & coding](https://reader034.vdocuments.mx/reader034/viewer/2022051404/58edc63c1a28abd8508b46d1/html5/thumbnails/9.jpg)
Dinuka Malalanayake
https://malalanayake.wordpress.com/
• Derived types must be completely substitutable for their base types.
• Sample code >
• Improved sample code >
9
Liskov's substitution principle
![Page 10: Introduction to advance design & coding](https://reader034.vdocuments.mx/reader034/viewer/2022051404/58edc63c1a28abd8508b46d1/html5/thumbnails/10.jpg)
Dinuka Malalanayake
https://malalanayake.wordpress.com/
• Clients should not be forced to depend upon interfaces that they don't use.
• Sample code >
• Improved sample code >
10
Interface segregation principle
![Page 11: Introduction to advance design & coding](https://reader034.vdocuments.mx/reader034/viewer/2022051404/58edc63c1a28abd8508b46d1/html5/thumbnails/11.jpg)
Dinuka Malalanayake
https://malalanayake.wordpress.com/
• High-level modules should not depend on low-level modules. Both should depend on abstractions.
• Sample code >
• Improved sample code >
11
Dependency Inversion principle