Comparison between object-oriented and process-oriented

Source: Internet
Author: User
1. What is object-oriented technology?
Object-oriented technology is an object-based program design technology that uses events or messages to drive object execution and processing. It has abstraction, encapsulation, inheritance and polymorphism.
2. What is the difference between object-oriented and process-oriented programming?
Object-oriented and process-oriented programming are different as follows:
(1) process-oriented programming methods use functions (or processes) to describe operations on data, but separate functions from the data operated by them; the object-oriented programming method encapsulates data and operations on data for processing as a whole.
Separation of functions and data
(2) process-oriented programming methods design functional modules with functions as the center, which is difficult to maintain. object-oriented programming methods describe the system with data as the center, data is more stable than functions, so it is easier to maintain.
Function-centric; data-centric
(3) The process-oriented control process is determined by the predetermined sequence in the program. The control process of the object-oriented program is triggered by the actual occurrence of various events during the runtime, it is not determined by the predetermined order, but more in line with actual needs.
Predetermined order; triggered by the actual occurrence of various events during the runtime
(4) object-oriented programming methods can be programmed using framework products (such as MFC and Microsoft Foundation classes.
Object-oriented reusable framework The fundamental difference between object-oriented and process-oriented is that, after encapsulation, object-oriented provides various features that are not available in the process-oriented model, most importantly, inheritance and polymorphism.
3. What are the advantages of object-oriented technology?
Object-oriented technology has the advantages of clear program structure, automatic generation of program framework, simple implementation, effective reduction of program maintenance workload, high code reuse rate, and high software development efficiency.
4. What are the advantages and disadvantages of encapsulation in object-oriented technology? How can we overcome these shortcomings?
Encapsulation encapsulates data and behaviors related to objects into a whole for processing, so that parts other than objects cannot freely access the Internal Attributes of objects, thus effectively avoiding the impact of external errors on objects, this greatly reduces the difficulty of error checking and troubleshooting. On the other hand, when modifying the internal object, because only a few external interfaces provide external services, it also reduces the impact of internal modifications on the external.
If you emphasize encapsulation without allowing external direct access to any attribute of an object, you need to add many behaviors that are meaningless and only responsible for reading or writing. This increases the programming workload, increases the running overhead, and makes the program appear bloated. To avoid this, the object should be visible to different degrees in the specific implementation process of the program, and then be consistent with the specific situation of the objective world.
5. Why should we apply the inheritance mechanism?
Objective things have both commonalities and characteristics. If we only consider the commonality of things, but not the characteristics of things, we cannot reflect the hierarchical relationship between things in the objective world. Abstract Mechanisms take into account the commonalities of things, and inheritance mechanisms take into account the characteristics of things so that they can fully describe the hierarchical relationships of the objective world. Inheritance can make software modules reusable and independent, shorten the software development cycle, improve the software development efficiency, and make the software easy to maintain.
6. What aspects does C ++ support polymorphism?
C ++ polymorphism can be divided into polymorphism at compilation and runtime. Compile-time polymorphism refers to the function with the same name determined by the compilation system according to the parameters in the compilation phase of the program; runtime polymorphism refers to determining which function with the same name needs to be called Based on the generated information during the running stage of the program. C ++ implements polymorphism during compilation through function overloading and operator overloading, and achieves Runtime polymorphism through inheritance and virtual functions.
7. What are the similarities and differences between commonly used object-oriented programming languages?
Currently, common object-oriented programming languages include C ++, Java, and Visual Basic. C ++ is a hybrid object-oriented programming language that inherits and improves the C language. It is a programming method that supports both object-oriented and process-oriented programming. Java is a pure object-oriented programming language developed from C ++. Both C ++ and Java support basic concepts and features of object-oriented technology, such as encapsulation, class, constructor, destructor, inheritance, and polymorphism.
C ++ and Java syntax descriptions are the same and different. For example, the syntax of the basic structure statement is roughly the same, while that of the class definition is different. There are also the following differences:
(1) c ++ has the operator overload mechanism, but Java does not;
(2) c ++ supports multi-inheritance, while Java only supports single-re-inheritance;
(3) c ++ creates an object through the constructor and can directly use pointers to operate on the members of the object. Java creates an object through the new operator and uses the object reference returned by the new operator to use the object, instead of operating the pointer directly;
(4) The C ++ program needs to explicitly release the allocated memory, while Java has a memory garbage collection mechanism that automatically manages the memory and does not need to explicitly release the allocated memory.
Visual Basic inherits the features of simple syntax, easy to learn, easy to use, and strong data processing capabilities of the basic language. It also introduces Object-Oriented, event-driven programming mechanisms and visual programming methods, it greatly reduces the difficulty of developing Windows applications and effectively improves the efficiency of application development. However, Visual Basic has the disadvantages of not strict syntax and low system stability. Compared with C ++, Visual Basic has limited programming capability at the underlying level of the system.
8. What is. Net?
. Net is a network-oriented development platform that supports various user terminals. It defines a common language subset (CLS) and provides seamless integration between languages and class libraries .. Net unifies the programming class library and provides full support for the next generation network communication standard-Extensible Markup Language (XML, it makes application development easier and easier. So ?. Net is Microsoft's XML Web Service Platform. Regardless of the operating system or programming language, XML Web Services allow applications to transmit and share data over the Internet.

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.