Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand object-oriented in Java programming

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article focuses on "how to understand object-oriented programming in Java". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to understand object-oriented in Java programming.

Many people have just finished learning a process-oriented language that seems to be about to become obsolete. Their brains have not been freed from the shackles of process-oriented thinking, only to find that "object-oriented" has long been popular, and this strange word is flying all over the sky.

Pick up any popular computer technology book, there will be no "object-oriented" word! So I was confused: what is "object-oriented"? Those who are not interested will pass by; those who are interested in developing in this area will hastily find a relevant book to study what "object-oriented" is. However, it is not difficult to break through the shackles of thought, but it is not easy to say that it is difficult to have a deep understanding. After doing some lightweight work, the author thinks that he has some experience and is not afraid to make people laugh. He has written it for the majority of colleagues to criticize and correct.

The term "Object" was put forward and defined by Husserl, a phenomenological master, as early as the 19th century. The object is the reflection of the objects in the world in the human brain, the reflection of human consciousness as consciousness, the preconceived thing that exists as a concept, and it also includes human will. Give me an example.

When we realize a new object, it is called a tree, so the concept of tree is formed in our consciousness. This concept will always exist in our minds and will not disappear because the tree has been cut down. This concept is the reflection of objects in the real world in our consciousness. We can still have our own will for it, although we don't need to put it into practice-as long as you want to cut down the tree in your mind to make tables, stools, etc.-we call it intention. Therefore, the object is the reflection of the object in the human brain and the human intention in the objective world. As long as this object exists in our mental consciousness, we can judge the same kind of things.

For example, when we see another tree, we don't recognize the tree because it is gone and loses the template for reference. When we come into contact with something new, our consciousness establishes an object for these things. Of course, how this process is formed is not a question that we can discuss. The object mentioned above studies problems in a general sense, so it can be extrapolated to everything. When we often say "object", Class 1 refers to the solution to the problems encountered in the field of information. In particular, the application of software technology to solve problems.

Such as object-oriented programming (Object-Oriented Programming), object-oriented analysis (Object-Oriented Analysis), object-oriented design (Object-Oriented Design) and so on. With the application of the concept of objects introduced earlier, these problems can be further analyzed. In the face of a more complex system, we can analyze it as an object. A system (a complete solution to a problem) can be made up of multiple parts as an object.

Similarly, this object can be made up of multiple objects. For things of the same kind, they can be represented by an object. The benefits of this are obvious. It is flexible and efficient. It can greatly reduce the workload of designers and simplify the actual model. Give me an example. In the design of relational database, we can take a tuple as an object and define a set of operation methods for it. These methods will apply to all tuples, so we don't have to consider different tuples in detail on a larger scale (such as judging whether an element is legal): because they have a common set of self-oriented methods, they can "solve" their own problems. The object at a higher level can be a table, view, and so on. Table objects have their own methods on the basis of tuple objects, such as adding, deleting, and so on.

At this level, it only needs to do its own things, because with the support of tuple objects, it does not have to think about things like whether the element is legal or not. Even, sometimes we can treat elements or table groups as real-time objects and define their own methods to satisfy them. In this way, it can better show the advantages of object-oriented.

What is discussed above can be said to be an object-oriented analysis method. In the specific design process, an appropriate way should also be adopted. Because although the object-oriented idea is very advanced, if it is not done well, it will not be able to achieve the desired results. This is mainly manifested in not doing a good job in dealing with the relationship between objects and objects, and the hierarchy between objects and objects is not clear.

As the example of relational database cited above, if there are too many objects at the tuple level to consider the factors of a table object, or a surface object to consider the factors of a tuple object too much, or even to consider the factors at the element level, these are not good object-oriented design methods. At this point, Java has an advantage over C++ in terms of language implementation because it does not allow multiple inheritance, which makes the relationship between objects clearer. No one can deny that C++ is more powerful, but it also has to pay a huge price-- when the code base develops to a certain extent and scale, the hierarchical relationship between objects will become extremely complex. It brings great difficulties for subsequent users to learn and understand, and it is difficult to grasp in application.

In addition, although C++ has object-oriented processing power, it still retains a lot of process-oriented things. C++ can be used for programming without object-oriented thinking, of course, people will not do so-except for those who just regard C++ as a C extension for beginners, which lays a hidden danger for future development.

On the one hand, Java is a little more restrictive. Just a little bit is not enough. It is the people who engage in the development, and the development method is determined by the people. In order to develop excellent software by using object-oriented method, developers must have a good object-oriented idea. A good engineer can use the right tools to develop excellent software, regardless of the language tools he uses, such as Java, C++, Object Pascal, Ada and so on.

At this point, I believe you have a deeper understanding of "how to understand object-oriented in Java programming". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report