- 浏览: 79781 次
文章分类
- 全部博客 (89)
- web service (9)
- subversion (1)
- JBOSS (3)
- interview (23)
- jQery (2)
- ExtJs (0)
- Axis (0)
- Design pattern (3)
- Agile (2)
- mutithread (0)
- Core Java (24)
- programming methods (1)
- SSH (7)
- jee design (1)
- OO (4)
- books (8)
- other (1)
- JSF (7)
- seam (2)
- Weblogic (4)
- JPA (1)
- ADF (1)
- Spring (5)
- Tomcat (1)
- DWR (2)
- JEE (3)
- Servlet (1)
- EJB (1)
- JDBC (3)
最新评论
-
iloveflower:
呵呵。好好学习。。。。。。。。。。。。
java 读书 -
Eric.Yan:
看了一点,不过是电子版的……你这一说到提醒我了,还要继续学习哈 ...
java 读书
What are Software Design Principles?
Software design principles represent a set of guidelines that helps us to avoid having a bad design. The design principles are associated to Robert Martin who gathered them in "Agile Software Development: Principles, Patterns, and Practices". According to Robert Martin there are 3 important characteristics of a bad design that should be avoided:
Rigidity - It is hard to change because every change affects too many other parts of the system.
Fragility - When you make a change, unexpected parts of the system break.
Immobility - It is hard to reuse in another application because it cannot be disentangled from the current application.
*******************************************************
Open Close Principle
Software entities like classes, modules and functions should be open for extension but closed for modifications.
OPC is a generic principle. You can consider it when writing your classes to make sure that when you need to extend their behavior you don�t have to change the class but to extend it. The same principle can be applied for modules, packages, libraries. If you have a library containing a set of classes there are many reasons for which you�ll prefer to extend it without changing the code that was already written (backward compatibility, regression testing, �). This is why we have to make sure our modules follow Open Closed Principle.
When referring to the classes Open Close Principle can be ensured by use of Abstract Classes and concrete classes for implementing their behavior. This will enforce having Concrete Classes extending Abstract Classes instead of changing them. Some particular cases of this are Template Pattern and Strategy Pattern.
Dependency Inversion Principle
High-level modules should not depend on low-level modules. Both should depend on abstractions.
Abstractions should not depend on details. Details should depend on abstractions.
Dependency Inversion Principle states that we should decouple high level modules from low level modules, introducing an abstraction layer between the high level classes and low level classes. Further more it inverts the dependency: instead of writing our abstractions based on details, the we should write the details based on abstractions.
Dependency Inversion or Inversion of Control are better know terms referring to the way in which the dependencies are realized. In the classical way when a software module(class, framework, �) need some other module, it initializes and holds a direct reference to it. This will make the 2 modules tight coupled. In order to decouple them the first module will provide a hook(a property, parameter, �) and an external module controlling the dependencies will inject the reference to the second one.
By applying the Dependency Inversion the modules can be easily changed by other modules just changing the dependency module. Factories and Abstract Factories can be used as dependency frameworks, but there are specialized frameworks for that, known as Inversion of Control Container.
Interface Segregation Principle
Clients should not be forced to depend upon interfaces that they don't use.
This principle teaches us to take care how we write our interfaces. When we write our interfaces we should take care to add only methods that should be there. If we add methods that should not be there the classes implementing the interface will have to implement those methods as well. For example if we create an interface called Worker and add a method lunch break, all the workers will have to implement it. What if the worker is a robot?
As a conclusion Interfaces containing methods that are not specific to it are called polluted or fat interfaces. We should avoid them.
Single Responsibility Principle
A class should have only one reason to change.
In this context a responsibility is considered to be one reason to change. This principle states that if we have 2 reasons to change for a class, we have to split the functionality in two classes. Each class will handle only one responsibility and on future if we need to make one change we are going to make it in the class which handle it. When we need to make a change in a class having more responsibilities the change might affect the other functionality of the classes.
Single Responsibility Principle was introduced Tom DeMarco in his book Structured Analysis and Systems Specification, 1979. Robert Martin reinterpreted the concept and defined the responsibility as a reason to change.
Liskov's Substitution Principle
Derived types must be completely substitutable for their base types.
This principle is just an extension of the Open Close Principle in terms of behavior meaning that we must make sure that new derived classes are extending the base classes without changing their behavior. The new derived classes should be able to replace the base classes without any change in the code.
Liskov's Substitution Principle was introduced by Barbara Liskov in a 1987 Conference on Object Oriented Programming Systems Languages and Applications, in Data abstraction and hierarchy
Creational Patterns
Singleton
Factory
Factory Method
Abstract Factory
Builder
Prototype
Object Pool
Behavioral Patterns
Chain of Responsibility
Command
Interpreter
Iterator
Mediator
Memento
Observer
Strategy
Template Method
Visitor
Null Object
Structural Patterns
Adapter
Bridge
Composite
Decorator
Flyweight
Proxy
Software design principles represent a set of guidelines that helps us to avoid having a bad design. The design principles are associated to Robert Martin who gathered them in "Agile Software Development: Principles, Patterns, and Practices". According to Robert Martin there are 3 important characteristics of a bad design that should be avoided:
Rigidity - It is hard to change because every change affects too many other parts of the system.
Fragility - When you make a change, unexpected parts of the system break.
Immobility - It is hard to reuse in another application because it cannot be disentangled from the current application.
*******************************************************
Open Close Principle
Software entities like classes, modules and functions should be open for extension but closed for modifications.
OPC is a generic principle. You can consider it when writing your classes to make sure that when you need to extend their behavior you don�t have to change the class but to extend it. The same principle can be applied for modules, packages, libraries. If you have a library containing a set of classes there are many reasons for which you�ll prefer to extend it without changing the code that was already written (backward compatibility, regression testing, �). This is why we have to make sure our modules follow Open Closed Principle.
When referring to the classes Open Close Principle can be ensured by use of Abstract Classes and concrete classes for implementing their behavior. This will enforce having Concrete Classes extending Abstract Classes instead of changing them. Some particular cases of this are Template Pattern and Strategy Pattern.
Dependency Inversion Principle
High-level modules should not depend on low-level modules. Both should depend on abstractions.
Abstractions should not depend on details. Details should depend on abstractions.
Dependency Inversion Principle states that we should decouple high level modules from low level modules, introducing an abstraction layer between the high level classes and low level classes. Further more it inverts the dependency: instead of writing our abstractions based on details, the we should write the details based on abstractions.
Dependency Inversion or Inversion of Control are better know terms referring to the way in which the dependencies are realized. In the classical way when a software module(class, framework, �) need some other module, it initializes and holds a direct reference to it. This will make the 2 modules tight coupled. In order to decouple them the first module will provide a hook(a property, parameter, �) and an external module controlling the dependencies will inject the reference to the second one.
By applying the Dependency Inversion the modules can be easily changed by other modules just changing the dependency module. Factories and Abstract Factories can be used as dependency frameworks, but there are specialized frameworks for that, known as Inversion of Control Container.
Interface Segregation Principle
Clients should not be forced to depend upon interfaces that they don't use.
This principle teaches us to take care how we write our interfaces. When we write our interfaces we should take care to add only methods that should be there. If we add methods that should not be there the classes implementing the interface will have to implement those methods as well. For example if we create an interface called Worker and add a method lunch break, all the workers will have to implement it. What if the worker is a robot?
As a conclusion Interfaces containing methods that are not specific to it are called polluted or fat interfaces. We should avoid them.
Single Responsibility Principle
A class should have only one reason to change.
In this context a responsibility is considered to be one reason to change. This principle states that if we have 2 reasons to change for a class, we have to split the functionality in two classes. Each class will handle only one responsibility and on future if we need to make one change we are going to make it in the class which handle it. When we need to make a change in a class having more responsibilities the change might affect the other functionality of the classes.
Single Responsibility Principle was introduced Tom DeMarco in his book Structured Analysis and Systems Specification, 1979. Robert Martin reinterpreted the concept and defined the responsibility as a reason to change.
Liskov's Substitution Principle
Derived types must be completely substitutable for their base types.
This principle is just an extension of the Open Close Principle in terms of behavior meaning that we must make sure that new derived classes are extending the base classes without changing their behavior. The new derived classes should be able to replace the base classes without any change in the code.
Liskov's Substitution Principle was introduced by Barbara Liskov in a 1987 Conference on Object Oriented Programming Systems Languages and Applications, in Data abstraction and hierarchy
Creational Patterns
Singleton
Factory
Factory Method
Abstract Factory
Builder
Prototype
Object Pool
Behavioral Patterns
Chain of Responsibility
Command
Interpreter
Iterator
Mediator
Memento
Observer
Strategy
Template Method
Visitor
Null Object
Structural Patterns
Adapter
Bridge
Composite
Decorator
Flyweight
Proxy
发表评论
-
OO Design books -good website
2012-06-07 03:13 691I’m always on the search on goo ... -
Differences Between Scrum and Extreme Programming
2012-04-05 22:52 849http://blog.mountaingoatsoftwar ... -
Jolt Awards books
2012-04-05 22:01 12341990 Annotated C++ Reference M ... -
Refactoring
2012-04-03 11:00 0Replace Method with Method Obje ... -
State Pattern
2012-04-03 00:06 707The pattern encapsulates state ... -
java 读书
2012-03-29 23:57 938Thinking in java Java Algorith ... -
用例子说明面向对象和面向过程的区别
2012-03-22 02:28 639java是一门面向对象的 ... -
11 Most influential Books Every Programmer/Developer must read
2012-03-14 03:49 727Every programmer needs to learn ... -
5 Best Core java books you must read as a developer
2012-03-14 03:43 893If you want success in JAVA, yo ... -
top 6 Agile books & 5 Best software Architecture books you must read
2012-03-14 03:26 720Below listed books are highly r ... -
5 Best Design Pattern Books you must read as a Software Developer
2012-03-14 03:12 904By - Sachin | 6/07/2010 | Label ...
相关推荐
面向对象(Object-Oriented, OO)设计原则是软件开发中的基石,它们为创建可维护、可扩展且灵活的代码提供了指导。以下是五个主要的OO设计原则及其详细解释: 1. 单一职责原则(Single Responsibility Principle, ...
在IT领域,尤其是软件开发中,面向对象设计(Object-Oriented Design,简称OOD)是构建可维护、可扩展且高效的软件系统的关键方法之一。本文将深入探讨面向对象设计的原则与度量标准,旨在帮助读者理解如何通过这些...
You want to learn the real OO design principles and why everything your boss told you about inheritance might be wrong (and what to do instead). You want to learn how those principles will help the ...
### 面向对象设计原则基础 面向对象编程(Object-Oriented Programming,简称OOP)自诞生以来,已经成为软件开发领域的一种主流方法。本文旨在深入探讨面向对象设计的基本原则,帮助开发者理解并掌握这些原则如何...
Aspect-Oriented Programming By Design Chapter 5. Tool-Based Aspect-Oriented Programming PART 4 DI Containers Chapter 1. Di Container Introduction Chapter 2. The Autofac Di Container Chapter 3. The ...
大部分内容假设读者已经是一位有经验的对象导向编程(OO)开发者,但对于并发编程的了解不多。同时,对于那些在其他语言中有并发编程经验的读者来说,本书同样具有参考价值。 ##### 1.1 使用并发构造 这一节主要...
domain object modeling, responsibility-driven design, essential OO design, layered architectures, \"Gang of Four\" design patterns, GRASP, iterative methods, an agile approach to the Unified Process ...
软件设计原理 面向对象的设计 单一责任 依赖倒置原则 “高级模块不应依赖于低级模块。 两者都应依赖抽象。 抽象不应依赖细节。 细节应该取决于抽象。...” [Robert Martin,OO设计质量指标,第2版(1994)]。
面向对象设计原则(Object-Oriented Design Principles)是一套指导软件开发者如何更好地设计类、接口等面向对象元素的原则集合,旨在提高代码的可复用性、可维护性和扩展性。其中,里氏替换原则(Liskov ...
This project demonstrates examples in java and basic principles of 23 design patterns of OO programming.这个项目包含了面向对象23种设计模式的一些例子和基本原理说明。updates no finish yet还未完全更新...
6 面向对象原理 (Object-oriented principles) 7 设计模式 (Design patterns) 8 怎样设计的问题:日期和时间处理 (Design how-to: date and time handling) Part 2: 测试和重构 (Testing and refactoring) 9 测试...
Para que服务OO? 依存模型 OsprincípiosSOLID 莫斯洛斯普林西比斯合唱团 佩剑军刀:历史的固体 Conhecendo o Cotuba 练习:Gerando um电子书 练习:阿布林多·科迪戈·杜科布洛-日蚀 练习:Gerando um ebook ...
Chapter 19 - Three Design Principles Chapter 20 - Using A UML Modeling Tool Appendix A - Project Approach Strategy Checkoff List Appendix B - ASCII Table Appendix C - Answers To Self Test ...
This brief book explains the advantages of the object model, inheritance, both classical and ...What are and how to use OO principles in JavaScript How to use Constructors with JavaScript and more
These case studies incrementally introduce key skills, essential OO principles and patterns, UML notation, and best practices. You won't just learn UML diagramsyou'll learn how to apply UML in the ...
You’ll discover productivity techniques for coding F# in Visual Studio, functional design, and integrating functional and OO code. what’s inside Learn how to write bug-free programs Turn tedious ...
其中,面向对象设计原则(Object-Oriented Design Principles, OODP)是指导开发者设计高质量面向对象系统的重要准则之一。开放关闭原则(Open/Closed Principle, OCP)作为面向对象设计原则的核心之一,强调了如何...
最后,列出了一些相关课程的名称和学时,比如“Principles of Analysis I”,“Principles of Analysis II”,以及“Essentials of Visual Modeling with UML”,这些课程名称表明IBM提供了一整套系统性的教育路径,...