阿牛 - 专注.NET开发

如果梦想与实现之间有一道不可逾越的鸿沟,那么“执行力”就是跨越这道鸿沟的桥梁。

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

#1: Open-Close printciple (OCP)

Classes should be open for extension and closed for modification

 

#2:Don't Repeat yourself (DRY)

Avoid duplicate code by abstracting out things that are common and placing thoes things in a single location

 

#3: The Single Responsibility Printciple (SRP)

Each class in your application should have only one reason to change.

 

#4: The Liskov Substitution Principle (LSP)

Sub types should substitutable for base type.

 

Others:

Encapsulate what varies.
Code to an interface rather than to an implementaion.
Classes are about behavior and functionality.

Delegation is when you hand over the responsibility for a particular  task to another class or method.

Use composition to assemble behaviors from other classes.

 

 

 

 

 

posted on 2009-03-03 14:16  阿牛-专注金融行业开发  阅读(272)  评论(0编辑  收藏  举报