Have what you want and let go of what you lose

1. Is it easy to write code

Code is easy to write and not easy to write. But a person can not always be too neutral, then I choose good code is not easy to write. For example, can write, not necessarily can write poetry. But do you say that writing is difficult, for fang Fang to learn language difficult, for you now, not difficult, but may be a school, not so good-looking. Code to be able to grow with the business, easy to make split, merge, update, etc., good code to ensure the correctness of the premise of better maintenance.

2. Design patterns

Talking about good code usually involves design patterns, and some experienced programmers have stopped talking about design patterns because they’ve become so used to them that they start looking at architecture.

A pattern is finding a recognizable pattern, such as a color pattern or a resume template. Patterns are often related to abstract thinking, analyzing the commonness of things and extracting the common part of things to help people understand the law. Design pattern is a pattern of repositioning and integration of things to solve problems. It is a mature solution to similar problems. Twenty-three design patterns are described in The book Design Patterns: The Foundation of Reusable Object-oriented Software. It can be divided into three types: the creation type, the structure type, and the behavior type. In fact, they are the re-splitting of the life cycle of the object, independent of the creation process. The structure combination can be successful, and the behavior expresses the communication between objects, such as the observer mode. Of course, design patterns are not a silver bullet, and breaking them down can complicate the architecture, but the flexibility increases, mainly in response to changing requirements. Requirements always change, and splitting leads to separation of concerns, and slowly architecture leads to design patterns.

3. Software life cycle

Two important subcycles in the software life cycle are the development and operation life cycles. The former serves the latter, in conjunction with the runtime lifecycle to determine how the code is organized. Software is the simulation of real business, virtualization. The run life cycle is a simulation of the business life cycle, plus of course the user access life cycle. Therefore, if the business organization of a unit is clearer and its responsibilities are clearer, the project is relatively easier to do.

First of all, the business model must be placed in the background, where users do not touch. For example, when you order food in a restaurant, you do not know the production process of dishes. When you deposit money in a bank, you do not need to care about where the money goes after being handed to the teller, but only the balance in your account. Bank teller is the window of external service and the place where users visit. For efficiency, the bank may divide different counters according to business, such as one for depositing money, one for handling credit cards and one for others, so as to meet different users’ visits. Then behind the business model is the warehouse for storing status and data. In fact, this is a typical three-tier architecture. Imagine that the bank counter is a variety of service interfaces, behind the counter glass is a variety of business logic, and behind the security door is the vault files.

User service interfaces, on the one hand, combine business models, on the other hand, persist data, and there are too many tasks, code easily out of control, easy for developers. At this time, users can be divided according to the user access life cycle, such as business access, business access, business save, etc., which can also improve the parallelism of development.

4. Technical business architecture

It’s pretty well summed up in the encyclopedia. Technology is the creation of artificial conditions, so that the prescribed laws in accordance with human will occur. The discovery of fire was naturally caused by thunder and lightning, and man had to keep it alive by adding wood. Later found that drilling wood for fire, drilling wood is technology, fire is business. The so-called business is to solve human problems, the purpose is to support human life cycle, so that human benefits.



When technology comes along, tools come along. It takes a great deal of strength and speed to make a fire by turning a stick quickly with both hands, and a weak person cannot make a fire at all. Therefore, when it was found that the efficiency of drilling wood was not high, human beings split the rotation life cycle and improved the rotation mode. One hand was responsible for pressing down and the other hand was responsible for rotation. The division of two hands produced the structure, and the splitting formed the structure. Similar to the organizational structure of a company, a company may have only the CEO in charge of all things in the early stage, and then grow into an organizational structure such as CTO, operations, human resources, and R&D.



5, the wheel

First of all, if your software system is not layered, there are no wheels, and the open source world gayHub doesn’t make much sense to you. Only in the process of splitting, can match whether there is a proper tool wheel, if splitting to a certain level found still no wheel, it is necessary to consider whether to build wheels, if the function of a wheel is greater than the current splitting, it depends on the maintenance of the wheel is worth it. Want to knock a nail did not find a hammer, but found high heels, barely can knock, but high heels are more expensive than the hammer and easy to consume. If you happen to have the right wheels, you can happily install them into your system, and when you run, you find a flaw in the wheel, and you take care of it, just like a car wheel, and you find that every time you brake it, you slide too far, you hit it, and you can add a caliper brake system. The split problem is best when it matches the technology. Such as log services, permission management and so on.

6, open source

As mentioned above, there are open source and closed source wheels. Some use existing or self-created wheels combined with business pain points to create new wheels to walk the business model, this kind of scientific research is more, because scientific researchers are both business personnel and research and development personnel. So why do other people open source their code?

First, the code is not the core of the software life cycle, but the execution life cycle and user access life cycle. No company has open-source their operating system. This is the core. Open source code is like writing a book. You may not agree with the author when you read it, but the code runs in the machine and the book runs in the brain. We read books in order to think how the author thought. Source code understands the author’s design ideas by understanding the problem the author is facing and letting the code run in mind. Technology also needs the environment and people. On the other hand, open source authors also want to involve global developers in their projects, so that the overall project development system becomes larger and brings together the best ideas.

7, the truth

It doesn’t really tell you how to write good code, right? How to develop good handwriting is not, of course, Consola and Yahei, which programmers love. When we were young, we would first copy and master the stroke trend of each word. How to write a good essay, all kinds of rhetorical devices, that is, design patterns, it may not be as easy to understand as the vernacular, but it is beautiful, and it can be replaced by other devices where appropriate. Of course, vernacular Chinese is also a style.

Normally positive, knowledge is now extremely easy to acquire and anxiety is extremely easy. Try to plant their own one mu three points, and then dig other people’s land. It could be the same person selling anxiety and anxiety. Anxiety can be an upward motivator, but if it’s sold to you, it often doesn’t last. Once it’s not supplied, you’re like, “What am I supposed to worry about now?” The strength that breeds oneself to rise and be born, that kind may not be very strong, but will a small ripple that gush out, is normal positive attitude struggles on the water surface, if that force is relatively strong, must also have the determination to die knock, why not give it a go and turn the tide.