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 |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了