Joke Collection Website - Public benefit messages - Javaweb development, what is a framework and what is middleware?

Javaweb development, what is a framework and what is middleware?

Framework:

1 What is it? A framework is a set of specifications. Since it is a specification, you must abide by the constraints stipulated in this framework when using it. In Java development, a framework is represented by a set of rules and a set of jar packages.

Why: Why do we use frameworks?

(1) Reason: Just like building a house. There are 10 people working together to build Qi Xin. At this time, the picture frame is like a painting. If there are no drawings to build a house, then everyone has their own ideas, so the house built must not be what the owner wants. With the drawings, we can restrain everyone how to build our house, what bricklayers should cut, and the door faces north and south. This is convenient for team cooperation and development. In our development, if Class A is named A.java and Class B is named B.java, but in fact, the * * actions of the two classes are the same, just because there is no specification, which leads to confusion and is not conducive to team cooperation and development. If you use a framework, there will be constraints on class names, such as Struts and control class, which will make it easy for people to understand the function.

(2) Significance: The framework not only completes these simple constraints, but also encapsulates some redundant codes with low reuse rate for us. And using reflection and dynamic proxy mechanism, the code is universal. For example, servlet development needs to get the parameters of the form from the servlet, which is very troublesome every time. But struts uses reflection mechanism and interceptor mechanism to help us get the value of the form, so we don't have to write those codes by hand every time, which simplifies the development. Of course, you must follow some rules to configure. Another example is hibernate, which provides some general functions of adding, deleting and correcting the database. If you use jdbc, you have to write sql every time you do some simple crud, but you don't have to bother with hibernate, just save it and update it. . . Of course, you still have to follow some of its norms. Similarly, so is spring.

3 How to use it As I said just now, the framework is embodied in java through jar. If using this is a learning thing, I can't say it, but first you need to import jar before you can use its "regulations". Write helloworld first. . . Learn slowly. . .

Supplement-Advantages and disadvantages of the framework: The advantages of the framework have been said a lot, which is convenient for team development, provides some ready-made mechanisms to simplify the development difficulty, and some frameworks can be decoupled, such as spring. The disadvantage is that it is not as efficient as servlet development, but with the improvement of hardware, these are not problems. There is not much difference. In fact, servlet+jdbc is the best if efficiency is required, but it is better to use framework if many aspects are considered.

What is message middleware?

1 Used to improve system performance:

The simple understanding is that applications don't have to care about the processing results, and can notify messages asynchronously through message middleware. Then other application servers receive the message and process it slowly.

2 application decoupling and communication:

Simple understanding is the data interaction between multiple applications.

Example: SMS sending, can't wait until SMS sending is successful. Then process the logic, so that you can use message middleware to inform the system that can send short messages to send them slowly.

My Batisharo above belongs to the framework of java, RabbitMQ and Redis belong to message middleware, and Eureka is the registry, which is equivalent to the client of java. I hope it helps you. If you want to know more about this, please follow me and show you around java.