Object-oriented programming has been all the rage for years, functional programming has made waves from time to time, and imperative and declarative programming has been relegated almost exclusively to textbooks and wikis. These are the gems of the programming world, how can I put them together for my own use?

The nature of object orientation

Object-oriented this definition is very vague, since Java rampant, it seems that Java and object-oriented draw equal sign, when it comes to object-oriented, is Java programming, is N design patterns. But object orientation has never really been about language.

More should be geared to the needs of an abstract object oriented programming, the abstract thinking is one of the human brain to think about the outside world is the most important ways of thinking, a bit like a tree, continuous trunk to branches and leaves, through this way of thinking of the processing, can be limited in human thinking thinking infinitely complex problems, no matter how complicated the outside environment, through effective sorting, The human brain can process it. That’s what programming needs.

The process of programming is that a single person creates a world of his own. He needs to make rules for the world he creates, and when the world he creates is complex enough, he needs the human brain to abstract the complex rules so that he can maintain the rules he creates at a low cost.

From this perspective, object orientation is a programming thought that humans and programmers use almost all the time.

Functional programming

The rules of the world we create have an orderly set of definitions, and the reason for these definitions is to put them together properly and to process the data. It can be said that 99% of the purpose of system development is to process data, transform data from one form to another form, integrate data from multiple sources, and generate multiple forms of data from a single source according to specific rules.

The system is like a pipeline, so to speak, with data flowing in and out. And this has huge implications for human problem-solving. You can make a pipeline, put it in an oil field, put it under the road as a pipeline for water, as long as it’s liquid, and this kind of disposable tool makes human problem-solving a lot easier.

In the programming world, if there is a function whose input corresponds to its desired output, how much hair would be saved! Therefore, it is necessary for programmers to think object-oriented but write the code as a function.

Imperative programming

This programming style is essential, but is generally used to implement algorithms, such as memory management. For those of you who have used C, it’s a bridge between hardware and software, by abstracting hardware resources into a series of Pointers that populate the hardware with data.

However, imperative programming is appropriate only in this case.

Declarative programming

Those of you who have used SQL know that it is a typical declarative programming language.

The most fundamental reason for declarative programming is modularity, or logical isolation, which is to isolate parts of logic if it allows one to achieve a goal without having to understand it. For SQL, users only need to know how to fetch data, and do not need to care about the logic of fetching data. Even if performance optimization is required, it can be achieved through the underlying transformation of SQL.

Declarative programming is a very important programming thinking, especially when the system logic is more complex, it is necessary to carry out the necessary logical isolation through this thinking

conclusion

Programming is a process of continuous improvement, the fastest way to improve is to rewrite the same system with different ideas several times, each time there is a harvest, each time there is improvement.

Do not know through difficult, but after the sad will have a list of small mountains. If you have time, try to write the classical systems on the basis of understanding their core concepts, and soon the realm and vision will go up. For example Redis, for example K8S, for example ES.