Java is my three months - the fun ofo

zhaozj2021-02-16  63

I found that learning from JSP then to Java language is a good process for me. The programming master said that "object-oriented technology has lowered the threshold for the program". This sentence should be able to put it in network technology, change to "JSP technology has reduced the threshold for the Java program." With JSP technology, "Hello World" can be implemented with fewer statements than ordinary Java code.

JSP technology encapsulates the client Java code and network application servers, coupled with the background support of Servlet technology, enabling developers to encapsulate program control logic to web pages, generate dynamic web pages. JSP / servlet technology constitutes the front end of J2EE's platform, which makes developers to focus more on independent and implementation of backend business logic. This is also the best performance of MVC I have seen so far. MVC is the most widely used architecture so far, the model-view-controller structure division makes the program structure very clear, the process of performance is more diverse, the coupling of the program function is more relaxed, and the business logic is more independent, which guarantees the system. Maintainability and scalability.

Since Java is a pure OO language, this makes some design patterns to be very easy to implement in Java, you can easily use design models to increase the quality of code, and even don't know, you have "created" A design pattern, even if you have never contacted this design pattern. When we develop JSP in our group, different developers need to use JDBC to deal with the database. At first, each developer tried to use its own connection method, most people used the simplest drivermanager.getConnection () method to get database connections, but Soon I found a lot of online and javabean, this is a very horrible thing: if there are many pages need to request database connections, this will cause great resource occupancy and waste, and once the database changes System maintenance will be abnormally complicated. So I immediately wrote a database connection javabean containing the getConnection () static method, handed over to each developer. This can easily get a database connection during the development process, saving development time. Also unified data connection interface. Due to the use of static methods, database connections are faster. Most importantly, since there is more packages on data connection, this makes it easy to change the database connection method, such as easy to use the database connection pool to improve the performance of the system. Later I only knew that this is actually a FA? ADE mode, although I didn't know the FA? ADE mode before.

When developing a web application server, the functionality of servlet may be unlimited. I refer to the Action method in the JSP Design book, and I have implemented my own servlet-action structure. I made some modifications to this action, adding the second request parameter "down", which makes an action to perform more tasks to reduce the development efforts of the action. During the actual development process, developers are very good to accept such server program structure.

Java's SWING technology is also very interesting. The design of Java has once again implemented the MVC architecture, which makes Java window interface development also have the same flexibility in JSP development. (Here, since I first contacted the JSP, then contact Swing, so it feels like this. In fact, Swing technology is far from JSP technology)

With Java interfaces and implementations, you can better loosen your system. The Java interface and the implementation are completely different from interfaces and implementations of the C / C language (.h file and .cpp file). The Java interface and the implementation are very good to reflect the "plug-in" concept, while C / C interface and implementation separation does not bring the concept of interface, just very boring on the code file, except for In addition to the implementation efficiency of the Inline function, I can't see more advantages. The new C # language also abandoned the pattern of C / C . Java's interface and implementation make more convenient to extension. The current J2EE system development has been clearly divided into two major parts of the development of the interface and business logic. In the process of business logic, considering system performance and upgrade, we should first determine the functional range of the system, then write functionality with the fastest speed according to functionality, which is often not the best implementation, better The implementation will be developed as a system upgrade. The "implementation" here should refer to the specific object, and "function" is not an object. When using C development, it is often considered to use class inheritance to implement functional upgraded and scalability, using different subclasses to implement the same functional interface. This different implementation reflects a parallel object relationship, "implementation" is expanded to "function" this "object" - but the facts and implementation is the concept on different levels. Using Java interfaces and can be well separated from conceptual separation function and implementation, more clearly of different classes (including interface) development requirements, developers can use interfaces, without excessive consideration of changes in specific classes.

转载请注明原文地址:https://www.9cbs.com/read-28094.html

New Post(0)