What is the longest way to master? What’s the difference between REST and RESTful apis? What are the architectural styles and patterns?

Question: What are industry best practices for architectural design

REST and RESTful API

REST has a tricky Chinese name, “Declarative state transition”, which ignores the deep meaning of the name. In short, REST specifies the HTTP API protocol: URL as a resource noun definition, Head as a verb control parameter, and Body as a business data parameter. REST’s greatest contribution in addition to the specification protocol is the API consensus within the team.

So here’s a question: What’s the difference between REST and RESTful apis?

Let’s first look at the definitions of these two models

Then briefly compare the differences

model use scenario
REST Abstract architectural design ideas Use of theoretical methods
RESTful API An API design approach The API layer using

The final summary is as follows

  • REST – An architectural style that describes the state transition specification
  • RESTful API – An architectural pattern, API specification for Connector

RESTful apis are applied to Connector problem scenarios using REST architecture

Industry best Practices

Every industry has industry knowledge precipitation, precipitation “architectural design” aspects of the software industry knowledge is “architectural style and pattern”, “code for design” level knowledge precipitation is “design patterns”, “code” level of knowledge accumulation is “+ middleware framework”, etc., the results of this design is under different business scenarios after summarizing predecessors’ mining pit and precipitation of knowledge.

The design styles in the table below are some of the “industry best practices”, which should be familiar to the R&D students. This time, we will summarize and abstract the knowledge we have learned again. Each of the following design styles can be summarized into a separate chapter, which will not be explained here.

Architectural style describe
CS Client server
BS Browser server
pluggable Functional units are managed as plug-ins
componentization Functional units are managed as components
Release subscription Subscription Topic callback triggers usage

What is the architectural style

Architectural style – An architectural style is a coordinated set of architectural constraints that restricts the roles/features of architectural elements and the allowed relationships among those elements within any architecture that conforms to that style. Architectural styles are constraints.

REST is an architectural style that expresses state transition specification constraints.

Architectural style describe
CS Client server
BS Browser server
pluggable Functional units are managed as plug-ins
componentization Functional units are managed as components
Release subscription Subscription Topic callback triggers usage
Pipe strainer Servlet/Filter
The message bus The message bus
REST Declarative state transitions
DDD Domain-driven business modeling

What are the architectural patterns

Architectural patterns – Architectural style solutions to a particular context problem.

RESTful API is an architectural pattern, which is the solution to the problem of REST style in Connector API scenarios.

Architectural patterns Architectural Style describe
MVC componentization Model-View-Controller
MVVM componentization Model-View-ViewModel
ESB The message bus Enterprise Service Bus
Three layer architecture Layered architecture Presentation layer – Business layer – Persistence layer
Microcore Architecture pluggable
Pipeline command line Pipe strainer Channel-Filter
Hexagonal structure Layered architecture Application layer – Plug-in layer – Adapter layer
The Clean architecture Layered architecture
RESTful API REST Declarative state transitions
CQRS DDD Domain-driven design
Event Sourcing DDD Domain-driven design

Note: There are no industry standard definitions of architectural styles and patterns

Style pattern design method

Architectural style + Architectural pattern = Style pattern design method

There are definitions of architectural styles and patterns in the industry, but I believe most r & D students have not used them. 1. 2 because it’s harder to use. Just as domain-driven development (DDD) is well known in the industry but difficult to implement at the production code level, style patterns are difficult to apply to specific projects and have no standard usage.

Analogical thinking is also a common way of thinking. Here is a similar way to illustrate the role of style and pattern.

How to design a temple palace?

Architectural design and architectural design have certain commonness, draw lessons from the design ideas and methods of style mode to think about how to design temples and palaces.

Temples and palaces

First of all, what is the common style of temple palace abstract, and what constraints need to be achieved by results-oriented thinking becomes temple palace. Refer to the above figure to directly abstract the architectural style.

  • solemn
  • Have a certain height
  • It has a bright roof and sharp corners
  • Many doors and decorations

Then, using constraints of architectural style, targeted design in different scenarios in China and the West is as follows.

Chinese Temple model

  • Multilayer Angle
  • The main color is red and yellow
  • Three doors left, middle and right
  • Glazed tile

Western palace model

  • Floors in a
  • Corridors and columns
  • Many doors and Windows
  • Many carvings

Finally got is has certain professional depth architecture designs, styles and patterns of another role conflict is found or not harmonious, such as the following view, obvious conflict style pattern mix design wind, mix the wind is not the problem, the problem is easy to lead to a very good team cannot agree and leads to a final design.

What are the styles and patterns of layered architecture?

Layered architecture

  • Architectural Style – Layered architecture, constraints (layered, upper dependent on lower, lower dependent on upper)
  • Architecture pattern – Three-tier system architecture, N-layer system architecture

Specific application of layered architectural styles, hexagonal architectural patterns and Clean architectural patterns

What are the styles and patterns of domain-driven design?

Domain-driven design

  • Architectural Style – Business modeling, constraints (context, domain, subdomain, entity, and service)
  • Architectural patterns – Microservices domain design, CQRS, Event Sourcing

Summary of structured Design

Structured design Design summary
Architectural style A set of constraints
Architectural patterns Architectural style solution in a particular context
Architecture Style architecture approach.
Architecture Pattern {problem, context} → Architecture approach.

Answer: The longest way I have walked is the master’s routine.