Applying software design principles in practice
description
Transcript of Applying software design principles in practice
![Page 1: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/1.jpg)
How to apply design principles in practice?
Ganesh Samarthyam!Consultant, ZineMind [email protected]
![Page 2: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/2.jpg)
“Applying design principles is the key to creating high-quality software!”
Architectural principles: !Axis, symmetry, rhythm, datum, hierarchy, transformation
![Page 3: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/3.jpg)
Technology changes fast => FOMO
![Page 4: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/4.jpg)
Often frustrating to develop quality software!
![Page 5: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/5.jpg)
There must be a better way!“Here is Edward Bear,
coming downstairs now, bump, bump, bump,
on the back of his head, behind Christopher Robin.
It is, as far as ... !
It is, as far as he knows, the only way of coming downstairs,
but sometimes he feels that there really is another way,
if only he could stop bumping for a moment and think of it!”
!- A.A. Milne
![Page 6: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/6.jpg)
Think, think, think!
![Page 7: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/7.jpg)
Focus on software design is the key!
![Page 8: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/8.jpg)
Real scenario #1Initial design
![Page 9: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/9.jpg)
Real scenario #1
❖ How will you refactor such that:!
❖ A specific DES, AES, TDES, … can be “plugged” at runtime?!
❖ Reuse these algorithms in new contexts? !
❖ Easily add support for new algorithms in Encryption? !
Next change: smelly design
![Page 10: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/10.jpg)
Time to refactor!Three strikes and you
refactor
Martin Fowler
![Page 11: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/11.jpg)
Potential solution #1?Broken
hierarchy!
Yuck! !Your solution smells
![Page 12: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/12.jpg)
Potential solution #2?Algorithms not
reusable!
Hmm, can be better. !Better luck next time…
![Page 13: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/13.jpg)
Potential solution #3?
Wow!!What a nice solution :)
![Page 14: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/14.jpg)
Can you identify the pattern?
![Page 15: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/15.jpg)
You’re right: Its Strategy pattern!
![Page 16: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/16.jpg)
Real scenario #2
Initial design
![Page 17: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/17.jpg)
Real scenario #2
How to add support for new content types and/or algorithms?
Yuck! !This design smells
![Page 18: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/18.jpg)
How about this solution?
Wow!!What a nice solution :)
![Page 19: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/19.jpg)
Can you identify the pattern structure?
![Page 20: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/20.jpg)
You’re right: Its Bridge pattern!
![Page 21: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/21.jpg)
Wait, what principle did we apply?
![Page 22: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/22.jpg)
Open Closed Principle (OCP)
Bertrand Meyer
Software entities should be open for extension, but closed for modification
![Page 23: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/23.jpg)
Variation Encapsulation Principle (VEP)
Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides
Encapsulate the concept that varies
![Page 24: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/24.jpg)
Fundamental principle: Encapsulation
The principle of encapsulation advocates separation of concerns and!information hiding through techniques such as hiding implementation!
details of abstractions and hiding variations
![Page 25: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/25.jpg)
Enabling techniques for encapsulation
![Page 26: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/26.jpg)
Other fundamental principles?
Principles*
Abstrac/on*
Encapsula/on*
Modulariza/on*
Hierarchy*
![Page 27: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/27.jpg)
Applying principles in practice
EncapsulationViolating!
encapsulationAdherence to !encapsulation
Applying !encapsulation
![Page 28: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/28.jpg)
Applying principles in practice
PrincipleViolating!principles
Adherence to !principles
Refactoring
Bad design !(with smells)
Good design (with patterns)
![Page 29: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/29.jpg)
Design determines qualities
Understandability Changeability Extensibility
Reusability Testability Reliability
DESIGNimpacts
impactsimpacts
![Page 30: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/30.jpg)
“Applying design principles is the key to creating high-quality software!”
Architectural principles: !Axis, symmetry, rhythm, datum, hierarchy, transformation
![Page 31: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/31.jpg)
Presentation sourceForewords by
Grady Booch and Dr. Stephane Ducasse
![Page 32: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/32.jpg)
What are your takeaways?
![Page 33: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/33.jpg)
Image/video credits❖ http://en.wikipedia.org/wiki/Fear_of_missing_out!❖ http://lesliejanemoran.blogspot.in/2010_05_01_archive.html!❖ http://javra.eu/wp-content/uploads/2013/07/angry_laptop2.jpg!❖ https://www.youtube.com/watch?v=5R8XHrfJkeg!❖ http://womenworld.org/image/052013/31/113745161.jpg!❖ http://www.fantom-xp.com/wallpapers/33/I'm_not_sure.jpg!❖ https://www.flickr.com/photos/31457017@N00/453784086 !❖ https://www.gradtouch.com/uploads/images/question3.jpg!❖ http://gurujohn.files.wordpress.com/2008/06/bookcover0001.jpg !❖ http://upload.wikimedia.org/wikipedia/commons/d/d5/Martin_Fowler_-_Swipe_Conference_2012.jpg!❖ http://www.codeproject.com/KB/architecture/csdespat_2/dpcs_br.gif !❖ http://upload.wikimedia.org/wikipedia/commons/thumb/2/28/Bertrand_Meyer_IMG_2481.jpg/440px-
Bertrand_Meyer_IMG_2481.jpg !❖ http://takeji-soft.up.n.seesaa.net/takeji-soft/image/GOF-OOPLSA-94-Color-75.jpg?d=a0 !❖ https://developer.apple.com/library/ios/documentation/cocoa/Conceptual/OOP_ObjC/Art/watchcalls_35.gif!❖ http://www.pluspack.com/files/billeder/Newsletter/25/takeaway_bag.png !❖ http://cdn1.tnwcdn.com/wp-content/blogs.dir/1/files/2013/03/design.jpg
![Page 34: Applying software design principles in practice](https://reader034.fdocuments.in/reader034/viewer/2022042623/5476d106b4af9f22628b4605/html5/thumbnails/34.jpg)