This is the fifth day of my participation in the August Wen Challenge.More challenges in August

The theory of

Software engineering

Software engineering is to try every means to avoid the risk of software projects, and to complete the delivery and maintenance of software projects faster and better. The ultimate goal is to complete the delivery of software engineering quickly, efficiently and with high quality.

Evolution: Waterfall Development > Agile Development > DevOp

The longer the lead time, the greater the likelihood of change and the higher the probability of risk the project may face. So iterate and deliver.

Front-end engineering

Software engineering + front-end = Front-end engineering

Front-end engineering is to improve the efficiency and quality of front-end projects in the stage of R&D, operation and maintenance by means of standardization, modularization and automation.

StateDiagram - V2 Front-end Engineering --> Normalized Front-end Engineering --> Modular front-end engineering --> Automation

Standardized process: precipitation of standards and specifications for each link of the R&D process, unified r&d process and specifications, providing possibilities for modules and automation.

Module reuse: divide and develop each function based on independent modules, so as to achieve module level reuse as much as possible, thus greatly improving the overall efficiency and reducing the research and development cost.

Automatic processing: Based on the defined R&D process, an automatic pipeline is established. When a specific action occurs (periodic trigger, Git Push), the pipeline is automatically triggered to execute CI/CD tasks.

CI/CD

Continuous Integration/Continuous Delivery(Deployment) It is an engineering methodology, that is, by means of automation, the realization of continuous construction, delivery, deployment of projects, so as to achieve high efficiency, high quality delivery goals.

CI: Automated build: When new code changes are submitted (uploaded to a repository git push), the project is automatically built, integrated, tested, and produced as a final release.

CD: Automatic storage: It can record and save the construction record, integration record, test record and release product of each continuous integration, which is convenient for follow-up tracking, monitoring and deployment.

CD: Automatic deployment: Automatically deploys the end product of a specified (a continuous integration product) into production.

Because of its automated and persistent nature, CI/CD can achieve efficient, high-quality delivery goals.

DevOps

DevOps is a group of processes, methods, and systems used to facilitate communication, collaboration, and integration among Development, technical Operations, and quality assurance (QA) departments.

Benefits of front-end engineering

  • Improved efficiency (through modular/componentized reuse capabilities and automation tools)
  • Quality assurance (standardization to avoid mistakes, ensure quality during R&D, operation and maintenance by introducing access testing, monitoring, automated testing and other means)
  • Cost reduction ((improved quality, guaranteed quality, and reduced development difficulty through automation translates into reduced overall software development costs)

In actual combat

How to do a front-end engineering solution?

aroundStandardization, modularization, automationThese three dimensions, in order to improve efficiency, to ensure quality as the goal of expansion. The overall architecture is shown in the figure:

  1. Define r&d processes and specifications
  • Develop your own specifications by referring to industry specifications
  • Use prettier, Lint, git hook to force landing during code commit and CI
  1. Construction scaffolding

Use scaffolding to create and run projects such as create-react-app

Code checking & pre-checking: Configure Lint (e.g. Eslint, Prettier, CommitLint), such as custom rule plugins.

Using Githook to perform inspection logic prior to commit, such as Husky Lint-staged code quality, multi-party collaboration, and code style consistency.

  1. CI/CD project integration build and delivery

Different CI/CD tools are suitable for different scenarios. For example, Jenkins, CI/CD tools can simplify the process and facilitate rapid deployment.

How do I deploy a cluster with multiple devices?

Blue-green deployment policy

Let’s say 100 machines, blue and green. When released, 50 machines are deployed online and 50 machines are deployed offline. This method is simple and fast, but it will reduce service stability.

Rolling Upgrade Policy

Scroll to start the new and pause the old until the upgrade is complete.

Gray Strategy (Canary)

Like a canary in a mine looking for toxic gas, testing product safety at a low cost. Import to the new version based on the percentage of traffic. At this time, the old and new versions are running at the same time, which tests the problem of data coordination.