From process-oriented to object-oriented, process-oriented
Since IBM's John bar was born into the world's first high-level programming language Fortran in 1957, the development of high-level programming language has gone through a full half century. During this period, the programming language mainly went from process-oriented (such as C and Pascal) to object-oriented (such as C ++, Java, and Objective-C ), then to component-oriented programming (such. C # language on the NET platform, and rapidly developing service-oriented architecture technologies (such as SOA and WebService ).
John Bakos
Process-oriented programming
The core of Structured Programming: functional decomposition (top-down, layer-by-layer refinement ).
Structured ProgrammingIt is mainly to divide a big problem into several small problems, and then divide a few small problems into smaller ones. It is very difficult for us to solve the big problem, however, it is easier to solve the smallest problem after division.
Process-oriented programming divides programming tasks into one step, and then executes them according to the steps respectively. Each step is like a single process in a task.
Niklaus Wirth: Founder of structured programming ideas. He was awarded the Turing Award in 1984 because he invented a series of excellent programming languages such as Euler, Alogo-W, Modula and Pascal and proposed the structured programming ideas.
Nicolas worth
Professor Nicolas worth proposed a famous formula in the programming field:
Program = Data Structure + Algorithm
Among process-oriented or structured programming languages, there are a wide variety of advanced programming languages, and many people who are new to programming do not know which language to learn.In fact, a language cannot be distinguished by good or bad characters. Any programming language has its own characteristics and purposes as long as it is stored.. The two most popular languages in the field of process-oriented programming should be C and Pascal,C language in particular. The syntax of C has influenced all subsequent programming languages (such as Javascript, Java, and C ).
The most important principles for process-oriented programming:High Cohesion and low coupling.
Cohesion refers to the closeness between Members in the module.
Coupling refers to the closeness between modules.
Whether process-oriented or object-oriented, we all emphasize the independence of modules. Only independent modules can be reused. Only when weak coupling is implemented will there be no too many associations between modules.
The main disadvantage of process-oriented programming language is that it does not conform to people's habits of thinking. Instead, it uses computer-oriented thinking methods to solve problems. Moreover, process-oriented programming languages have low reusability and difficult maintenance, you cannot write large applications.
Object-Oriented Programming
Object-Oriented Programming (OOP) is a new method and idea for developing computer applications. In the past, process-oriented programming often caused all the code to be included in several modules, making the program difficult to read and maintain. When making some changes, we often take a hundred moves, making future development and maintenance hard to sustain. With OOP technology, many code modules are often used. Each module only provides specific functions and they are independent of each other. This increases the chance of code reuse, it is more conducive to software development, maintenance and upgrade.
In object orientation, algorithms and data structures are regarded as a whole called objects. In the real world, objects of any class have certain attributes and operations, the data structure and algorithm can always be used to describe each other. Therefore, the following equations can be used to define objects and programs:
Object = (algorithm + data structure), program = (Object + ......).
From the equation above, we can see that a program represents itself in many computers, while an object is a program entity.
The core of object-oriented programming is to cope with changes and improve reuse.
The idea of object-oriented programming is mainly about reusability and flexibility (elasticity ). Reusability is a major mechanism of object-oriented programming. Flexibility mainly deals with the changing features, because the customer's needs are constantly changing and how to adapt to the changes in customer needs is a problem of software design flexibility or elasticity.
Alan Kay: Founder of object-oriented programming. In 2003, he received the Turing Award for his great contributions to object-oriented programming.
Allen Kay
Allen KAY: President of the Massachusetts Institute of Technology. Allen Kay is one of the inventors of the Smalltalk object-oriented programming language and one of the founders of object-oriented programming ideas. At the same time, he is also the earliest thinker of the laptop and architect of the modern Windows GUI. Alan Kai, who first proposed the concept of PC and the Internet, was also called "The Prophecy master ". He is one of the only technical talents in the IT industry today.
Link between process-oriented and Object-Oriented Programming
Process-oriented is actually the most practical way of thinking. Even the object-oriented method also contains the process-oriented idea.. It can be said that process-oriented is a basic method, which takes actual implementation into consideration. Generally, process orientation is improved step by step from top to bottom. Therefore, the most important aspect of process orientation is the modular approach. Compared with the process-oriented model, the object-oriented approach mainly targets objects, including attributes and behaviors. When the program scale is not very large, the process-oriented method also shows an advantage, because the process of the program is very clear, according to the module and function method can be well organized.
For example, if a student gets up in the morning, let's talk about this kind of process orientation. You can roughly describe the process as follows:
(1) Get up
(2) dressing
(3) wash your face and brush your teeth
(4) go to school
The four steps are completed step by step. The order is very important. You only need to implement them one by one. However, if we use an object-oriented method, we may be able to abstract only one student's class. It includes these four methods, but the specific order cannot be reflected.
References:
Baidu encyclopedia
Douding