Home > Java > javaTutorial > What are the design principles of java development framework

What are the design principles of java development framework

WBOY
Release: 2023-05-04 10:31:06
forward
1063 people have browsed it

Introduction to the concept of framework development

  • Object-oriented analysis: Object-oriented analysis is the object analysis of the objective world programming business field, and there are some concepts. What you should know during the process; Congestion Model: Data and corresponding business logic are encapsulated into the same class; Anemia Model: Data and business logic are divided into different classes; DDD: domain-driven model, MVC traditional three-tier architecture;

  • Object-oriented design purpose: strong cohesion, low coupling; easy to expand; stability; scalable, simple;

  • Object-oriented design principles: The principle is independent of programming languages, and can even be used with non-object-oriented programming languages;

  • Design patterns: Mainly used A general solution to a certain type of problem, which is equivalent to a mathematical formula and nested development. Generally, we summarize the design patterns as creational pattern, behavioral model, and structural pattern;

  • Framework: A framework is a structural program that implements a certain type of application. It is a reusable design and implementation of a certain type of architectural solution.

Design principles of development framework

SOLID Principles

What are the design principles of java development framework


  • ##SRP: Single Responsibility Principle, a class or module is only responsible for completing one responsibility;

  • OCP: Open Closed Principle, software entities (modules, classes, methods, etc.) should be "closed to extension development and modification" ;

  • LSP: Liskov Substitution Principle, the child object can replace the parent class object anywhere in the program, and ensure that the original program logic behavior remains unchanged and the correctness is not destroyed;

  • ISP: Interface Segregation Principle, the client should not be forced to rely on interfaces it does not need;

  • DIP: Dependency Inversion Principle, high-level modules do not need Depend on the underlying modules. High-level modules and underlying modules should depend on each other through abstraction. In addition, abstraction should not rely on specific implementation details. Specific implementation details depend on abstraction.

KISS Principle

KISS=Keep It Short and Simple.(Try to keep it simple.)

  • Don't use technology that your colleagues may not understand to implement the code. For example, the regular expressions in the previous example, and some overly advanced syntax in programming languages.

  • Don’t reinvent the wheel, be good at using existing tool libraries. Experience has proven that if you implement these libraries yourself, the probability of bugs will be higher and the cost of maintenance will be higher.

  • Don’t over-optimize. Don't overuse some tricks (for example, bitwise operations instead of arithmetic operations, complex conditional statements instead of if-else, use of some too low-level functions, etc.) to optimize the code and sacrifice the readability of the code.

YAGNI Principle

KISS=You Ain't Gonna Need It. (Don't over-design.)

  • The original intention of the design is to improve the code quality;

  • The design process is to have problems first and then have a plan;

  • Designed The application scenario is complex code;

  • Continuous refactoring can effectively avoid over-design;

  • Don’t talk about design without considering the specific scenario;

DRY principle

DRY=Don't Repeat Yourself. (Don't write repeated code.)

  • Reduce code coupling;

  • Meet the single responsibility principle;

  • Modularization;

  • Separation of business and non-business logic;

  • Universal code sinking;

  • Inheritance, polymorphism, abstraction, encapsulation;

  • Apply templates and other design patterns;

The above is the detailed content of What are the design principles of java development framework. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template