Architecture, some sort of design pattern and miscellaneous thinking

Source: Internet
Author: User

1. Preface

A few days ago, my colleague made some comments and summaries about architecture, design, pattern and so on. This also re-reminds me of this question of thinking, what is the architecture? What is a framework? What is the relationship between design patterns and architecture? With the framework? What is specific? What are the advantages of abstraction? What is the role of these architectures, designs, etc.? Where do you use the work for two years? Then re-read the previous notes, summed up to a self-understandable can persuade their own explanations to organize the memo, to provide guidance for their follow-up study.

2. Pattern Arrangement (theoretical study)

Organize such as:

Click to enlarge View large image

4, doubts self-explanation
    • The understanding of the pattern
      A set of solutions that are in the current environment, with different problems or goals and motivations. "Three is a process, one thing is inseparable" cannot leave the specific environment to talk about problems and programmes, and can not leave the target motivation itself to talk about programmes.

    • What is a schema
      Architecture is the blueprint, the highest abstraction in software design, the area of the positive is the component of the SOFTWARE + contact + constraints. Do not care about concrete implementations. Abstract ideas (such as design drawings, planning diagrams, blue skies) that are designed in the context of actual business and software quality standards

    • What is a frame
      The description of the framework in design mode is a group of working classes, from which the framework is a specific set of combinations, in some sense the implementation and landing of the architecture (such as: MVC is a layered architecture idea, springmcv,struct2, the Android UI is a concrete implementation of MVC), The same architectural idea has many different implementations.

    • What is the relationship and framework between design patterns and frameworks and architectures?
      The design pattern is a certain environment-specific solution for specific problems in the specific software coding (abstraction, encapsulation change). There is little connection to the architecture. (Architecture is concerned only with component connections, abstract ideas), and to the framework, the implementation of the framework will encounter a variety of practical problems to solve. Solutions for these problems can be provided by design patterns. "Like the MVC implementation is a composite design pattern combination" All in a sense, design patterns are the cornerstone of framework implementation.

5, some principles of the memo 5.1 design principles:
    • Package changes
      The only constant in the software is change (changes in business requirements, data size wait-factors), and all we have to do is wrap the changes together. "Will change the dependency interface, the dependency abstraction"

    • Multi-use combination, less inheritance
      The combined system is more elastic, which can not only encapsulate the algorithm family into classes, but also dynamically change the behavior when moving.

    • Programming for interfaces rather than "reducing coupling, isolating changes" for implementation
      The real meaning of programming for interfaces is programming for superclass types (supertype)

    • Strive for loosely coupled design between interacting objects

    • Classes should be open to extensions, "explained: The function of a class is single, the function has no side-effect modification, and it closes"

    • Rely on abstraction, do not rely on specific
      Dependency Inversion principle: only the High-level component (the so-called high-level component is the class whose behavior is defined by its underlying component) depends on the lower component.

    • Talk to friends only

    • Don't call me, I'll find you. "IOC isn't it?" 】

    • Class should have only one reason to change

5.2 Schema Mode

The current popular architecture patterns are: layered architecture, event-based architecture, microservices architecture, micro-kernel architecture, and so on.
Click to learn reference: Software Architecture mode

5.4 Design Patterns

Design patterns are divided into three main categories: creation, structure, behavior (see larger image)

Recommended Learning: Head First design mode

Basic Memo:

  • Iterative mode:
    Provides a way to sequentially access individual elements in an aggregated object without exposing the internal representation

  • Combination mode:
    Allows you to combine objects into a tree form structure to represent the "whole/part" hierarchy. The combination allows the customer to handle individual objects, and object combinations in a consistent manner.

  • Policy mode:
    Define an algorithm family, encapsulate each other, so that they can be replaced with each other, this pattern allows the replacement of the algorithm independent of the client using the algorithm.

  • Viewer mode:
    Defines a one-to-many dependency between objects, so that when an object changes state, all its dependents are notified and updated automatically.

  • Decorator Mode:
    Dynamically attaches the responsibility to the object. To extend functionality, adorners provide a more resilient alternative than inheritance.

  • Factory mode:
    Factory method Mode: Defines an interface for creating objects, which subclasses decide which class to instantiate, and the factory method defers instantiation of the class to subclasses.

  • Abstract Factory mode: Provides an interface for creating a family of related or dependent objects without explicitly specifying a specific class.

  • Command mode:
    Requests are encapsulated into objects so that different requests, queues, logs, and logs are used to parameterize other objects. The command mode also supports the revocable operation.

  • Single-column mode:
    Ensure that a class has only one instance and provides a global access point

  • State mode:
    Allows an object to change his behavior when the internal state changes, and the object seems to modify its class.

  • Adapter mode:
    An interface to a class that translates the interface of another class that the customer expects. Adapters let the incompatible classes work with each other.

    • Object adapters: Use a combination implementation.
    • Class adapters: Using inheritance implementations.
  • Appearance mode:
    Provides a unified interface for accessing a group of interfaces in a subsystem. The appearance defines a high-level interface that makes the subsystem easier to use.

  • Template method Mode:
    The skeleton of the algorithm is defined in a method, and some steps are deferred to the subclass, and the template method allows subclasses to redefine some steps of the algorithm without altering the algorithm structure (redefining the steps, using hooks)

About Code Patterns

Code patterns are related to specific languages, but the code pattern solves the same problem (for example, the code pattern used in different languages to support concurrent simple interest patterns is a dual-retrieval pattern) but the implementation is not the same.

Recommended learning: Combine your own working language reference code Daquan 2 related code best practices

Architecture, some sort of design pattern and miscellaneous thinking

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.