Basic principles of software object-oriented architecture design

Source: Internet
Author: User
Tags net domain

1, single duty principle

Requirements: The object of clear responsibility, an object only do one thing, must focus, the responsibility is too easy to cause changes in many reasons, the program is not stable enough.

2, open closure principle

Requirements: Changes in demand as little as possible to modify the design of the class, but by extension to complete. That is, closed modification, open extension.

3, dependency inversion principle

Requirements: Based on interface programming, high-level module call interface, the bottom module to implement interface, to prevent the underlying changes directly affect the upper layer.

The earliest mature applications of IOC,AOP and other technical frameworks are derived from Java Enterprise Development, now. NET domain development is also very rapid, the common framework is as follows:

autofac:http://code.google.com/p/autofac/

Castle Windsor:http://sourceforge.net/projects/castleproject/files/windsor/2.5/castle.windsor.2.5.3.zip/download

unity:http://entlib.codeplex.com/

spring.net:http://www.springframework.net/

structuremap:http://sourceforge.net/projects/structuremap/files/

Ninject:http://ninject.org/download

Using the existing broad application framework above, spring.net originates from Java's Spring, is more complete and powerful, AUTOFAC and Ninject are more clear and friendly, personal recommendation use autofac+ other framework combination.

4, interface Isolation principle

Requirements: Use a dedicated small interface as much as possible, rather than the total interface, to avoid complex interfaces.

5, the Richter replacement principle

Requirements: In the inheritance relationship the subclass can replace the parent class, and the virtual machine dynamically finds the specific subclass object based on the parent class variable, thus implementing polymorphism (that is, late binding in the previous C + + compiler Technology).

Note: The ruler is short, inch; various technologies, frameworks and design methods have their respective times and characteristics, the best is often not the Swiss army knife, to avoid falling into a certain way of thinking immersion and can not be changed.

Basic principles of software object-oriented architecture design

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.