Hello everyone, this class discusses Web and Java application development.
This lesson is divided into three sections: Web principle, javaee framework, and design mode.
First, we need to understand the concept and principle of web.
We are no stranger to the Web.
Sina, Netease is a Web site. They all rely on providing information content to generate value.
The birth of the Web can be traced back to a foreigner's information distributed sharing project thirty years ago,
I will not repeat its history too much here. If you are interested, you can learn about it yourself.
From the technical perspective, Web is a typical distributed architecture,
Users can use any electronic devices, PCs, PDAs, mobile phones, and game consoles anywhere.
Convenient access to the Web server is proud of its three basic technologies:
Uniform Resource Locator:
Domain Name DNS system:
Hypertext Transfer protocol HTTP:
When people type a convenient and easy-to-remember unified resource locator in a browser,
The browser began to work hard,
First, the browser sends the domain name (the Uniform Resource Locator marks the address part) to the DNS System for resolution,
When the destination IP address is obtained, the request message is sent through the HTTP protocol,
The Web server receives a browser request and uses the same HTTP protocol to return HTML, CSS, images, and other information,
Next, the browser displays the information for users to read.
From the interaction diagram, we can see that every information exchange in a web application involves both the client and server.
Therefore, web development technology can be divided into client and server technologies.
Client technology is a broad concept, indicating that it is a technology for information exchange and presentation with servers,
Information exchange technology, which defines how to communicate, how to transmit data, and the format of data organization
The presentation technology is to tell the browser how to display the obtained information.
The client presentation technology is divided into three layers:
Structure layer, specifying how information is organized (HTML)
Presentation layer, how should information be presented (CSS)
Behavior layer, capable of controlling the behavior of the Structure and Performance layer (JavaScript)
If you have some knowledge about the design pattern, we can see that it is very similar to the MVC pattern.
Next, let's take a look at several images to have a perceptual knowledge of web pages,
The text in the figure is the HTML part, which specifies which part is the title and which part is the body.
The specific text display position is displayed on the left or right of the entire page,
Or the color is defined by CSS. If you click an image, you can see some dynamic effects,
That's JavaScript's credit.
Javascript not only achieves various special effects, such as pop-up menus and scroll bars, but also implements very powerful and practical functions.
. Google map front-end technology uses this technology.
Of course, as a front-end technology, there are not only three standardization technologies (HTML, CSS, JavaScript), but also various commercial companies.
To improve user experience, rich client technologies such as flash, Silverlight and javafx are proposed.
After learning about the front-end customer technology, let's take a look at how the Web server operates and the background technologies.
What is a web server? Simply put, it is a machine that uses the HTTP protocol to provide content information.
For example, the most widely used apache, Microsoft's IIS, and nginx with the best performance
What is Web server technology? The program generates data that can be viewed by the client, as shown in:
The Web server technology refers to the JSP technology in the figure.
Mainstream background technologies include javaee, ASP. NET, PHP, and ror.
To put it simply, PHP is the representative of the grassroots technology, but it occupies most of the Internet fields due to its simple and easy free deployment.
Lamp is usually used for combined development and deployment.
ASP. NET is a product of the Technical oligarchy Microsoft. It has the advantages of powerful development tools, sound class library support, single disadvantage platform, and high cost.
Now I want to explain the Java EE technology developed specifically for enterprises, which is actually for the enterprise, so its complexity is not average,
There are many technologies involved. Full Development from scratch will consume a lot of development cycles, so a bunch of frameworks were created,
Such as the MVC Framework, component framework, and persistent layer framework.
The mainstream agile framework in the industry is SSH, which corresponds to the presentation layer, behavior layer, and data layer.
For more information about what frameworks are and why they are used, see the definition:
Simply put, a framework is a group of components, a semi-finished product of an application, and a platform. You can use others' platforms for development.
Why is framework required?
Today's development is already very complex, especially for server-side software, involving too many knowledge, content, and problems,
Using a mature framework can greatly shorten the development cycle and reduce investment in basic work. Most mainstream frameworks
It is developed by industry experts and has strong stability, robustness, and scalability. It also handles details.
Relatively complete.
Now I will briefly introduce several frameworks that I often hear during Java Development:
Spring is a lightweight application framework of enterprises. By using IOC and AOP principles, the coupling degree of modules is weakened to reduce system complexity.
It mainly includes the following modules,
Core spring kernel module, the basis of spring containers, and the basic quality is the application of the factory model. In short
A factory that generates various objects.
AOP aspect programming component. Object-Oriented Programming OOP is an entity and its attributes in the problem field and in the business process.
And operations are abstracted and encapsulated. Vertical methods are used to divide business logic units. AOP focuses on various components.
Business logic of the module. It may not sound easy to understand. You need to understand it in the programming and development process.
Support components for ORM Object Relational ing databases, which are used to facilitate integration with third-party ORM frameworks, hibernate, ibats, and Orm, which map objects to relational databases,
MVC Spring provides a set of good MVC frameworks. However, due to historical reasons, most developers use structs for MVC development.
The DAO Database Access Component encapsulates JDBC to operate databases in an object-oriented manner.
The strength of spring is that it can not only combine its own components at will, but also allow convenient Integration of Third-Party frameworks.
Most application development requires dealing with databases. Traditional development requires JDBC operations, connection pool management, and processing.
Transaction exception: queries the database using SQL statements, which is suitable for simple application development...
Hibernate encapsulates JDBC in a lightweight manner, allowing developers to use the object-oriented way of thinking.
Operate databases, and help developers manage connection pools, submit transactions, handle exceptions, and complete persistence tasks.
A mature software is inseparable from testing. Some programming ideas advocate testing to drive business development.
In Java, the common testing framework is JUnit.
These excellent frameworks bring us great benefits, reducing the difficulty of enterprise development, shortening the development cycle, and improving
The quality of software products. However, we cannot help but ask how these frameworks can be designed to solve general problems,
What is its core principle?
Of course, to answer this question, we can only tell you the direction here.
A simple understanding of design patterns is a methodology for solving a type of problems. correct use of these methodologies can achieve a half-common effect.
The basis of the design pattern is the design principle,
For example, the GRASP principle, whose core idea is responsibility allocation, can be divided into the following nine principles:
In a single sentence: Do what you can
It is not difficult to understand this, but it takes some time to apply the integrated application to daily development.
I personally think that the solid principle is easier to grasp. When the source code of the Spring framework is uncovered, a large number of principles will be observed in the system.
The principle of single responsibility, that is, the expert model. One Class and module only do one thing.
The open/closed principle disables extension development and modifications,
Dependency inversion principle
The principle of interface separation is not to force users to rely on interfaces they do not use. There are not many interface methods,
These design and development principles are not easy to understand and need to be realized in later programming.
Compared with the design principles, the design mode is easier to understand.
It is applied to daily development and solves some common problems. For the design model, you can search online.
Go to gof to find many teaching materials.
Everything pays attention to the balance of yin and yang. To a certain extent, the balance is maintained, and the design model is the same,
When you think of the design pattern as a panacea in the design and development process,
At this time, you need to purchase a book CC called "anti-pattern ".
The content of this lesson is here. If you are interested in it, you can discuss it in private.
For the Web architecture principles, common web development technologies, mainstream javaee frameworks and design principles, just remember the design patterns.