Understanding of JAVA programming ideas and understanding of JAVA programming ideas

Source: Internet
Author: User

Understanding of JAVA programming ideas and understanding of JAVA programming ideas
1) POP -- Process-oriented programming ):
Process-oriented programming is a functional-centered way of thinking and organizing. It emphasizes the process of processing and processing system data, in program design, the function or process is the basic structure of the program. The system function is composed of a set of related processes and function sequences. Process-oriented model emphasizes functions (processing) and data only exists as input and output. This procedural idea is a very simple and common idea and method. Many human activities adopt this organizational model, such as factory production and enterprise service. The process-oriented data processing process is the main line, ignoring the process's ownership, boundaries, and environment, and obfuscation of service functions and self-functions (for example, people can cut trees, this is a service function with inputs and outputs. It can be provided to the outside, while walking is a self-function with no input or output), external environment and internal organization, and the difference between environmental data and raw data. In terms of thinking, process orientation emphasizes details and ignores integrity and boundary, but this is very different from the real world because in the real world, this process does not exist in isolation, but belongs to a specific object. Therefore, although process orientation reflects one aspect of the real world (function ), but it cannot simulate or represent the real world more vividly.
 2) OOP-Object Oriented Programming ):
The world is composed of objects. Therefore, the object-oriented way of thinking is closer to the real world, and the organization of object-oriented programming is closer to the real world. Object-oriented objects are centered on objects. They distinguish the internal organization of objects from the external environment, and isolate the internal attribute data of the characterization objects from the external environment. Their behavior and attributes constitute a whole, the system function is represented by a series of interaction sequences between objects, which can simulate or express the real world more vividly. In a programming organization, the attributes and methods of an object are not stored separately as they are for a process, but as a whole (the final implementation of a program is actually still separated, but this is only a physical implementation, it does not affect the two parts of the object as a whole), so it has better encapsulation and Security (representing internal attribute data that needs to be accessed through the methods provided by the object ). Object-oriented emphasizes integrity. Therefore, object-oriented and process-oriented can be complementary in many aspects. At the same time, because of the introduction of Object Inheritance and polymorphism technology, the object orientation has a stronger and more concise ability to express the real world. This enhances the organization, reusability, and flexibility of programming.

Object-oriented still retains the process-oriented feature. The process-oriented feature becomes the object method, and the processing feature becomes the object-oriented service method. However, this method still requires external input, at the same time, it also outputs to the outside, but the input and output are also objects. In object-oriented programming, most of the time, we do not need to care about all aspects of an object. Some objects act as "raw materials" and "Finished Products" throughout the system, its own behavior is not in our care scope, while some objects are in a processing factory status, we only care about the service features of these objects, you do not need to pay too much attention to the internal attributes and self-Behavior of objects. objects are classified based on different object concerns, such as the two types of objects mentioned above, it is classified by different roles in the system. The former is called an object, and the latter is called an operation object. In terms of methodology, we can regard process-oriented and object-oriented as two aspects of things-local and overall (Note: local and overall are opposite). In practical application, both methods are equally important.
Process-oriented and object-oriented are the two most basic methods in programming methods, which are at the bottom of the programming method system.
3) SOA-Service-Oriented ArchitectureThe service-oriented service takes the service as the starting point, organizes and coordinates related objects to provide the target service, and provides necessary parameter input interfaces to output the service results, the computing process and organization of the "service" itself are encapsulated and transparent to users. In fact, service orientation is also centered on functions (services), but it emphasizes the integrity, encapsulation, and self-package of functions, rather than process and collaboration, integrity refers to the external service as a whole; encapsulation refers to the process of computing and processing completed by the service, and its own attributes are not directly exposed to the outside, in addition to interaction through public service interfaces, users cannot and do not need to know the specific internal organization and coordination. Self-Package refers to the caller who does not depend on the service completion, the service system itself can complete the functions required by the Service. Therefore, the service-oriented organization is at a higher level in the program organization, which is a coarse-grained organization method. Service-oriented is essentially no different from process-oriented and object-oriented. The difference lies in the differences between the consideration of problems. Object-oriented and process-oriented systems are mostly used for internal organization and management, while service-oriented systems are mainly used for inter-system organization and management. Service orientation is a larger object or process. The three principles of service-oriented design are stateless, single instance, and clear service interfaces. Explicit service interfaces are mandatory and mandatory, but stateless and single instances are not mandatory. Although the provision of service status management increases the complexity of services, multiple instances also increase the service complexity (synchronization and concurrent processing are required, and access uncertainty is also caused), but in many cases this is unavoidable. The current service-oriented architecture is mainly used for interaction and integration between systems, there are a series of standards (XML, SOAP, WSDL, XSD, WS-policy, WS-BPEL, etc ).
 4) AOP-Aspect-Oriented.Aspect orientation should fall into the scope of object orientation. From the perspective of Object Organization, the classification methods we generally use are similar to biological classification methods and take the inheritance relationship as the main line, we call it vertical. But in fact, apart from this vertical classification, we can also observe these objects from a horizontal perspective, which is the basic starting point of Aspect-Oriented Programming. We usually use interfaces to solve these problems. However, there are two problems: first, we usually adopt Vertical thinking when designing objects, if we need to consider these commonalities of these objects of different classes at this time, it will not only increase the design difficulty and complexity, but also cause too many class interfaces and difficult to maintain, second, it is very difficult to dynamically add such behaviors or responsibilities to existing objects. Nowadays, many programs exist in an intermediate language, which is interpreted or compiled in real time. This also provides a better way to increase this kind of behavior or responsibility. The orientation is similar to Api hook. For specific principles and practices of Aspect-Oriented Programming, you can refer to the official website or blog of Shanghai shangxue.

Related Article

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.