A brief description of the three programming ideas

Mondo Health Updated on 2024-03-07

In the process of programming, what we pay the most attention to is to write a high-quality program, programming has a set of guiding theories, which helps people achieve this high-quality **, this set of programming theories we callProgramming ideas。In the pursuit of high quality, three different and commonly used programming ideas have evolved, namely:Process-oriented programmingObject-oriented programmingSection-oriented programming。Programming thought is a thought, it has nothing to do with programming language, no one is better than the other of the three ideas, and in fact the process-oriented will be the final state in memory.

Process-oriented programming (POP) is a programming method that focuses on the process of problem implementation and organization of writing, which is mainly composed in the order of process and function in programming design. It is a basic programming way of thinking about how to implement and solve problems from a practical point of view.

When implementing and solving problems, process-oriented first analyzes the steps to solve the problem, then realizes each step through functions, processes, and methods, and finally organizes these steps in strict order and executes them step by step. The writing is linear, strictly sequential, focusing on the solution steps, focusing on the local or specific.

Pros:

1. Process and modularization.

2. It conforms to the natural order of human thinking, has a clear division of labor, and can split the realized problems clearly and clearly.

3. High performance, no additional overhead of encapsulation and inheritance.

Cons:

1. Low reusability, poor scalability, and difficult maintenance.

2. It is difficult to modularize complex problems, and the coupling degree is relatively high.

Object-oriented programming (OOP) is a programming paradigm that decomposes objects centered on the objects formed by the problem, describes the properties and behaviors of objects in the whole process of solving problems, and writes them according to the relationships between objects. It appears mainly to compensate for some of the shortcomings of process-oriented. When implementing and solving problems, object-oriented programming first analyzes the composition of the object that solves the problem, abstracts the data, attributes, and behaviors into module structures to form classes, then realizes the polymorphism of the first in a certain way, and finally organizes it according to the object relationship. Object: Anything that exists in the real world can be called an object, with some properties and behaviors. Such as cars, apples, cats, dogs.

Features:

Encapsulation, encapsulating objective things into abstract classes, hiding data and methods, and only allowing access to some information.

Inheritance, a method that allows an object of one type to obtain the properties of an object of another type.

Polymorphism, which means that the same method of a class instance has different manifestations in different situations.

Pros:

1. The structure is clear, focusing on objects and responsibilities, and different objects assume different responsibilities.

2. Data encapsulation, partially hiding the data, and only allowing access to part of the data.

3. Simple to implement, easy to maintain and expand, and reusable.

Cons:

1. Due to the interaction and information transfer between objects, some performance will be sacrificed, resulting in low operation efficiency.

2. The complexity of programming is increased, and simple problems are complicated.

3. Paying too much attention to the object may limit your thinking about solving practical problems.

Aspect Oriented Programming (AOP) is a technology that extracts the aspects of the business process, and then dynamically adds functions to the program without modifying the source code through pre-compilation and runtime dynamic **. It is an extension and supplement of object-oriented programming, a kind of specification. The main intent is to willLogging, performance statistics, security controls, transaction processing, exception handlingetc. are separated from the business logic. Extracting the cross-cutting concerns from the core concerns is at the heart of section-oriented programming.

Pros:

1. Extract the general function from the business logic, improve the reusability, and facilitate the maintenance and expansion of the company.

2. Reduce the coupling of the first and realize the decoupling between various functions.

3. Improve the reusability and development efficiency of the first class.

Cons:

1. The supplement of object-oriented programming requires that the general functions are extracted after sorting out the business through object-oriented programming.

2. There will be some sacrifices in performance.

The above three ideas are complementary and perfect to each other. In the development of complex systems, these three programming ideas are indispensable. This article only introduces three ideological concepts, advantages and disadvantages, and hopes to have certain reference value for everyone's study or work. The follow-up will be combined with how the C language is implemented.

Related Pages