One, foreword

The new Java problem punching has started, but I missed the first bus yesterday, but it doesn’t matter, the latecomer is up, from today on to participate in this activity, brushing several questions every day, improve my strength.

This article is participating in “Java Theme month – Java brush questions check”. This column is the first time for Java related brush questions knowledge, I will share related knowledge from simple to complex, if there is anything wrong, please correct.

In order to share knowledge about Java, the first thing to know is the characteristics of the Java language. The difference between object orientation and process orientation is as follows.

Two, knowledge points

1. Process-oriented:

Process oriented performance is higher than object oriented performance. Because class invocation requires instantiation, which costs a lot and consumes resources, process-oriented development is generally adopted when performance is the most important factor, such as single-chip microcomputer, embedded development, Linux/Unix, etc. However, process orientation is not as easy to maintain, reuse, and extend as object orientation.

2. Object-oriented:

Object – oriented is easy to maintain, reuse and expand. Because object-oriented has the characteristics of encapsulation, inheritance and polymorphism, it is possible to design a low coupling system, which makes the system more flexible and easier to maintain. However, object-oriented performance is lower than procedural performance.

Three, contrast

Question: Is process-oriented performance better than object-oriented performance?

Process oriented performance is higher than object oriented performance. Because class invocation requires instantiation, which costs a lot and consumes resources, process-oriented development is generally adopted when performance is the most important factor, such as single-chip microcomputer, embedded development, Linux/Unix, etc.

Fourth, expand and extend

In fact, this is not the root cause. Procedural orientation also requires allocating memory and calculating memory offsets. The main reason for Java’s poor performance is not because it is an object-oriented language, but because Java is a semi-compiled language, and the final execution code is not binary mechanical code that can be directly executed by the CPU. Most procedural languages are compiled directly into mechanical code for execution on the computer, and some other procedural scripting languages do not necessarily perform better than Java.

Five, the summary

Process oriented performance is higher than object oriented performance. From the above comparison, it should be known that process performance is better from the basics to performance. That is the knowledge of this article, welcome to criticize.