This is the first day of my participation in Gwen Challenge

Wechat public number search [program yuan xiaozhuang], pay attention to the halfway program yuan how to rely on Python development to support the family ~

preface

This project combines most of the previous knowledge and includes how to design a simple program development directory and project architecture. Come on

How does a program start from nothing

I. Demand analysis

1. After receiving the project, I would discuss the requirements with the client first and discuss whether the functions of the project could be realized, including the cycle and price, and get a demand document.

2. Finally, we need to hold a meeting inside the company to get a development document and hand it to programmers in different positions for development.

  • UI interface design: Design the layout of the software, the appearance of the software will be cut into pictures.
  • Front end: get the UI to his picture, and then go to build the page; Design some pages, which places need to receive data, data interaction.
  • Back-end: directly core business logic, scheduling database to add, delete, check and change data.
  • Testing: The code will be thoroughly tested, such as stress testing, interface testing (CF card box).
  • O&m: Deployment projects.

Second, the program architecture design

Benefits of programming

  1. clear

  2. There will be no overwriting in the middle of writing code

  3. It is convenient for myself or my future colleagues to maintain it better

Three, task development

In the formal company development, there will be many people working on the same project at the same time, in the learning phase, only we do the development oh ~

Four, test,

During the learning phase, we have to test ourselves

Five, the online

The program code to run on the server, because we have not learned network programming, the first local development run it ~

Program development catalog and program architecture design

Video explanation: Since the excavation does not support video sending, the video is stored on another website as follows (the part titled 06) : Software Development directory & Program architecture Design

In order to improve the readability and maintainability of the program, a good directory structure should be designed for the software. There is no hard and fast standard for the software directory, as long as it is clear and readable, a directory structure is recommended here.

Using the project name as the top-level folder, this folder contains:

  • Core folder, store business logic related code;
  • API folder, storing interface files, interface is mainly used for business logic to provide data operations;
  • Database folder, storing operation database related files, mainly used to interact with the database;
  • Lib folder, store commonly used custom modules in the program;
  • Conf folder for storing configuration files.
  • Run. py: Startup file of the program, usually in the root directory of the project;
  • Requirements. TXT: Holds a list of external Python packages that the software depends on.
  • README: project description file.

In project development, a clear structure design is very important. It is important for at least three reasons:

  • Clear structure;
  • Strong maintainability;
  • High scalability.

Among the commonly used project structure design, three-tier architecture design is very practical. This architectural design pattern divides the entire program into three layers:

  • User view layer: Used to interact with the user, can accept user input, print the data returned by the interface.
  • Logical interface layer: receives the parameters passed by the view layer, calls the data layer to process them according to the logical judgment and returns a result to the user view layer.
  • Data processing layer: accept the parameters passed from the interface layer, do data add, delete, change and check. You also need logging and custom modules commonly used in your program.

Project practice – Mini bank & shopping procedures

The project requirements

User functionality

- Registration, default balance of bank card is 0 after registration - Login function - withdrawal function after login, handling fee 1% - transfer function after login - view transaction flow after login - Shopping cart function - View shopping cart after login - Cart settlement after login - view product informationCopy the code

Administrator Functions

- Add/Create administrator account - Manage user quota after login - Freeze user account - Add goodsCopy the code

other

Because I have not learned MySQL and other database related knowledge, here on the increase, deletion, change and check of data all use files to operate.

It is recommended to use the software Development catalog specification for development and to design the program using a three-tier architecture.

The code will be posted on Github. If you need it, please download it