Notes on Java and pattern (1) Software maintainability and reusability

Source: Internet
Author: User

3.1 software system maintainability

☆The maintainability of a software design is low, that is to say, there are four real reasons for the change of performance requirements:
① Too stiff
Adding a new performance not only means building an independent module, but also because the new performance will affect many other modules, it is best to change it across several modules.

② Too fragile
Modifications to one location often lead to failures in another location that seems irrelevant. Even before the change, designers will try their best to predict possible fault points. Before the change is complete, the original designers of the system cannot even predict where the impact may occur.

③ Low Reuse Rate
Every time a programmer finds that a piece of code, function, or module can be used in a new module or system, they always find that, these existing code depends on a bunch of other things, so it is difficult to separate them. It is best for them to find that the best way is not to "Touch" these existing things, but to re-write their own code. They may use the source code COPY method to save some time by reusing the original method.

④ High Viscosity
Sometimes, a change can be made by preserving the original design intent and the original design framework, or by undermining the original intent and framework. If a system is designed to make the second method easier than the first method, the viscosity is too high. A high-viscosity system will trick programmers who maintain it to adopt incorrect maintenance solutions and punish programmers who adopt correct maintenance solutions.

☆A good system should have the following properties:
① Scalability
New performance can be easily added to the system, that is, scalability. This is the attribute of the system "too stiff.

② Flexibility
This flexibility allows code modifications to occur smoothly without affecting many other modules. Flexibility is actually an attribute that is "too fragile.

③ Insertability
It is easy to extract a class and add another class with the same interface, which is pluggable. In fact, this is the "high viscosity" aspect.

3.2 reusability of systems

☆Benefits of software reuse
First, high production efficiency;
Second, high software quality;
Third, proper reuse can improve the maintainability of the system.

☆Traditional reuse forms
① Code clipboard reuse;
② Reuse of algorithms;
③ Reuse of data structures.

☆Design principles for improving system maintainability and reusability
① "Open-closed" principle (open-closed principle, or OCP );
② Liskey substitution principle (liskov substitution principle, or LSP );
③ Dependency inversion principle (dependency inversion principle, or DIP );
④ Interface segregation principle or ISP );
⑤ Principle of combination/aggregation reuse (Composition/aggregation principle, or CARP );
⑥ The Law of Demeter, or the level of detail (SLS );

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.