The progress of the abstract

Source: Internet
Author: User

The ultimate goal of all programming languages is to provide an "abstract" approach. A more controversial argument is that the complexity of solving the problem is directly dependent on the type and quality of abstraction. "Kind" here means "abstract" what is prepared to do? Assembly language is a small abstraction of the base machine. Many of the later "imperative" languages (such as Fortran,basic and C) are an abstraction of assembly language. These languages have made great strides compared to assembly language, but their abstract principles still require us to focus on the structure of the computer rather than the structure of the problem itself. The programmer must establish a connection between the machine model (located in the "solution Space") and the problem model that is actually resolved (in the "Problem Space"). This process requires people to pay more attention, and because it is out of the scope of the programming language itself, resulting in the program code is difficult to write, and to spend a large cost of maintenance. The resulting side effect is a perfect "programming method" discipline. Another method of
modeling for machines is to make models for the problems to be addressed. For some early languages, such as Lisp and APL, they are "looking at the world from different angles"-"all problems are summed up as lists" or "all problems are summed up as algorithms". The Prolog sums up all the problems into a decision chain. For these languages, we think that they are partly oriented toward "mandatory" programming, and the other part is designed to handle graphical symbols. Each method has its own special purpose, which is suitable for solving a certain kind of problem. But as long as they are beyond their reach, they will look very clumsy.
Object-oriented programming is a big step on this basis, and programmers can use tools to express the elements in the problem space. Because this expression is very common, you do not have to be limited to specific types of problems. We refer to the elements in the problem space and their representations in the solution space as "objects" (object). Of course, there are other objects in the problem space that do not have a corresponding body. By adding new object types, programs can be flexibly tuned to match specific problems. So when reading the description code of the scheme, you will read the words that express the problem. This is a much more flexible and powerful method of language abstraction than we've seen before. In short, OOP allows us to describe problems according to the problem, rather than according to the scenario. However, there is still one way to connect back to the computer. Each object is similar to a small computer, they have their own state, and they can be asked to perform specific actions. Compared with the real world "objects" or "objects", Programming "objects" have a common place with them: they all have their own characteristics and behaviors.

Alan Kay sums up five basic features of Smalltalk. This is the first successful object-oriented programming language, as well as the basic language of Java. Through these features, we can understand what the "pure" object-oriented programming approach is:

(1) Everything is an object. The object can be imagined as a new variable; it holds the data, but it can be asked to manipulate itself. Theoretically, all conceptual components can be presented from the problem to be solved and then expressed as an object in the program.
(2) A program is a combination of a large set of objects; by message delivery, the object knows what to do. In order to make a request to an object, "send a message" to that object. More specifically, the message can be imagined as a call request, which calls a subroutine or function that is subordinate to the target object.
(3) Each object has its own storage space to accommodate other objects. Or, by encapsulating existing objects, you can create new objects. Therefore, although the concept of the object is very simple, but in the program can achieve any high degree of complexity.
(4) Each object has a type. According to syntax, each object is an instance of a "class". Where the class is a synonym for type?. The most important feature of a class is "what message can I send to it?" ”。
(5) All objects of the same class can receive the same message. This is actually a statement that has no meaning, which we will soon understand. Because an object of type "Circle" (Circle) also belongs to an object of type "shape", a circle can receive shape messages entirely. This means that the program code can command "shape" uniformly, making it automatically control all objects that conform to the "shape" description, which naturally includes "circles." This feature, called "interchangeability" of objects, is one of the most important concepts of OOP.

Some language designers believe that object-oriented programming itself is not sufficient to solve all forms of procedural problems, and advocates the combination of different approaches to "multiple programming languages" (annotation ②).

②: See "Multiparadigm Programming in Leda", written by Timothy Budd, published in Addison-wesley 1995.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.