面向对象:隐藏的艺术,分责的艺术 -读design patterns explain

这几天看了Design patterns explain.收获很大,结合之前看的Head First Pattern、敏捷软件开发,写写读书笔记:

本书作者希望我们用全新的观点来看待面向对象设计:

面向对象设计开发,对象是中心,因此如何理解对象是最重要的:

1、理解对象是一个职责体,从高处看,系统解构成不同的职责体,各司其责,自己要对自己负责,做完做好所有应该做的事,也不要越俎代庖帮别人做事,别人的事让别人自己做,需要的参数通过接口传递过去就可以了,仅最大努力保持对象的独立性、内聚性。

2、理解对象的目的是隐藏,隐藏一切需要隐藏的东西,不仅仅是对象、方法。主要是隐藏变化、隐藏具体实现、隐藏代理、委任等等。

3、设计模式的作用是应对反复出现的场景,运用设计模式不要想一劳永逸,未来是不可知的。先满足当前的场景,未来的变化留给以后处理。

4、设计模式何时出现取决于何时产生变化,在变化点重构你的设计,封装你的变化,看需要应用设计模式。

5、组合优于继承,组合避免了继承接口污染的缺陷。

6、掌握模式的模式,如MVC对于架构来说都是很好的工具。

转载于:https://www.cnblogs.com/babykick/archive/2011/05/15/2047112.html

If you have ever bought any programming books, you might have noticed that there are two types of them: books that are too short to understand the topic and books that are too long making it inevitable that you get bored. We've tried hard to avoid both of these categories with Design Patterns Explained Simply. This book is fast and simple way to get the idea behind each of the 29 popular design patterns. The book is not tied to any specific programming language and will be good for you as long as you have a basic knowledge of OOP. Most chapters are available on the website, so you can check out the simplicity of the language in the book and the way materials are presented. Why should I read this book? It's simple. It's written in clear and simple language that makes it easy to read and understand. It's short. Yes, there are no useless demos or huge code listings — just clear and easy-to-understand descriptions with many graphical examples. When you finish reading this book, you'll have good reason to go to your boss and ask him for apromotion. Why? Because using design patterns will allow you to get your tasks done twice as fast, to write better code and to create efficient and reliable software architecture. How do I become a programming ninja? The main difference between a ninja and a novice is the knowledge of secret coding tricks, as well as the awareness of most pitfalls and the ability to avoid them. Design patterns were created as a bible for avoiding problems related to software design. Doesn’t that make it a true ninja’s handbook? Table of Contents Creational patterns Abstract Factory Builder Factory Method Object Pool Prototype Singleton Structural patterns Adapter Bridge Composite Decorator Facade Flyweight Private Class Data Proxy Behavioral patterns Chain of Responsibility Command Interpreter Iterator Mediator Memento Null Object Observer State Strategy Template Method Visitor
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值