Java Learning (i)--Object oriented (i)

Source: Internet
Author: User

Object-oriented thinking has been the guide of our software analysis, design and development. the Java language is an object-oriented language, and before you learn java , look at process-oriented and object-oriented.

One side to the process

Process-oriented claims are divided into system requirements by function, each of which is responsible for processing the data once, and each function accepts some data. Its smallest unit is the function, each function is responsible for the completion of a function, the whole system consists of a function, which has a main function, as the entry of the program, the main function calls the other ordinary functions, the normal function in turn, to complete the function of the entire software system, in fact, the main function is responsible for the system of all functions "String Up".


From the above figure, it is not difficult to find that the process-oriented design is a top-down design, in the design phase need to consider each module should be decomposed into those sub-modules, each sub-module has decomposed into those smaller modules, direct module refinement to a function. Each function exists to implement the function of the previous layer.

Just imagine, if the customer needs change, then we have to do this function from top to bottom layer by level to change the place to modify. It's not ugly from here. Its scalability is not strong, so its maintenance costs are quite high.

two object-oriented

It is a better method of program design, the basic idea is to use class, object, inheritance, encapsulation, message and other basic concepts to implement the programming. It is in dealing with the problem, from the existence of the problem itself, gradually understand the nature of things and behavior characteristics. It is closer to the way people think.

Three comparisons are process-oriented, object-based, and object-oriented. process oriented :

That means you're sitting across one by one of them. / function / functions, and their opposite is also the function. In the process, the function is the largest, all functions are centered, and a number of function modules make up the whole function system.

object based :

Based on objects that are not inherited and polymorphic, objects are based on existing objects, which unify objects created in other languages to form an object system. The existence of object-based languages exists in other languages. For example, the JavaScript language is object-based, it uses some encapsulated objects, calls the object's methods, can also set the properties of the object, but cannot derive the new class, we use the existing object's methods and properties. The most commonly seen is the combination of JS motion and HTML use. When defining the function of JS, it is essential to get the HTML object first and then manipulate it. If there is no HTML object, JS has a martial arts, but there is no useful.

Object- oriented: A process-oriented foundation is a function, and an object-oriented basis is an object/class. A class is an abstract encapsulation of a thing's properties and functions. It gives the function a home, through which you can change the properties of other objects as well as your own. Encapsulation, inheritance and polymorphism are the three main features of object-oriented, and the object-oriented inheritance is helpful to improve the extensibility of the program. Four summary: in Object-oriented, abstraction is the soul, and inheritance is the application of abstraction, which is the basis of polymorphism.

Java Learning (i)--Object oriented (i)

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.