How I explained OOD to my wife
How I explained OOD to my wife 2010-08-02
Introduction
My wife Farhana wants to resume her career as a software developer (she started her career as a software developer, but couldn't proceed much because of our first child's birth), and these days, I am trying to help her learn Object Oriented Designs as I've got some experience in software design and development.
Since my early days in software development, I have always observed that no matter how hard a technical issue seems, it always becomes easier if explained from a real life perspective and discussed in a conversational manner. As we had some fruitful conversations on Object Oriented Designs, I thought I could share it because someone might find it an interesting way of learning OOD.
Following is how our OOD conversation took place:
S = Single Responsibility Principle
O = Opened Closed Principle
L = Liscov Substitution Principle
I = Interface Segregation Principle
D = Dependency Inversion Principle
Topic: Single Responsibility Principle
Shubho: Let me show you the poster first. We should thank the person who made the posters, these are really interesting.
Just because you can, doesn't mean you should.
Topic: Open-Closed Principle
Shubho: Here goes the poster for the Open-Closed Principle:
Open chest surgery is not needed when putting on a coat.
Topic: Liskov's Substitution Principle
Shubho: The name "Liskov's Substitution Principle" sounds very heavy, but the idea is pretty basic. Take a look at this interesting poster:
If it looks like a duck, quacks like a duck, but needs batteries – you probably have the wrong abstraction
Topic: The Interface Segregation Principle
Shubho: Today, we will learn the "Interface Segregation Principle". Here is the poster:
You want me to plug this in, where?
Topic: The Dependency Inversion Principle
Shubho: This is the last principle among the SOLID principles. Here is the poster:
Would you solder焊接 a lamp灯 directly to the electrical wiring in a wall?
Summary
Shubho: There are many other Object Oriented principles other than the SOLID principles. Some are:
- "Composition over Inheritance": This says about favoring composition over inheritance.
- "Principle of least knowledge": This says that "the less your class knows, the better".
- "The Common Closure principle" : This says that "related classes should be packaged together".
- "The Stable Abstractions principle": This says that "the more stable a class is, the more it must consist of abstract classes."
Next