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

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(291)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示