Transferred from: http://blog.csdn.net/zzzkk2009/article/details/9849431
Over the next few months, I'm going to write a series of articles about complete Web development. This first article is sketchy, but it also gives a good overview of how Web applications have evolved over the previous 15 years or more. And in the end, I will cover the relevant technologies that have been written during this time.
In the good old days, we used simple Web pages (including animated GIF images!). )。 As a paragon of fine design, Apple has a website like this:
At the time, Web development was relatively simple, and developers often went to operate the Web server (mostly his own), and he would write some HTML pages down to the server-specified folder (/WWW). These HTML pages are used when the browser requests the page.
The problem arises, and you can only get static content. If you want visitors to see how many other visitors have visited this site (do you remember those rotating pictures of statistics traffic?!). ), or if you want visitors to fill out such a form with a name and email address? It turns to CGI and Perl scripts, runs a short code on the Web server side, and interacts with the file system or database.
At that time, the organization Cgi/perl such script code was too confusing. CGI scalability is not too good (often a new process is allocated for each request), nor is it too secure (directly using a file system or environment variable), nor does it provide a structured way to construct dynamic applications. It's been confusing for years, until around 2005, when Java Server Pages (JSP), Microsoft's ASP, and php! I like to compare the reference architectures of the time to IIS and ASP. You can quickly build a scalable and secure application with Visual Studio.
Until then, the Web server would probably return the entire page or document, but the advent of Ajax (2005) had made things interesting. Ajax allows a client's JavaScript script to provide a request service for a local page, and then dynamically refresh some of the pages without going back to the server-that is, updating the Document object in the browser, often called the DOM, or the Document Object model.
Although HTML is still returned from the server side, the code on the browser can embed the HTML fragment into the current page. This means that the response of the Web application can be faster, when we actually replace the Web page with a Web application. Google's Gmail and Google Maps were the killer products of Ajax at the time. Then local refreshes with Ajax are springing up.
Over the next few years, Ajax became the focus, but the old technology was still used on the server side. Probably in 2007, 37signals disclosed its members –ruby on Rails. The presentation of the Ruby on Rails 5-minute build blog completely conquered the world's developers. Overnight, so the focus is all about rails! Rails differs in designing your Web application in a defined way, using a development model that has been developed extensively in desktop applications but not moved to a Web application. This pattern is called pattern (data)-View (template)-Controller (business logic). Rails emphasizes that "this is the way to do this" and makes building Web applications more robust through many plugins.
During the 2007-2010, 3 development trends emerged:
The first is the trend of smartphones and mobile apps. Often, many applications have both Web and mobile applications. Nonetheless, the server still returns HTML pages, not other mobile apps that can recognize them. Therefore, you need to return the structured data to replace the HTML.
A second development trend is jquery. This is a very popular JavaScript library that makes it easy to build dynamic, wonderful Web applications, even ajax!
A third trend is the release of node. js. This is the first time you can use JavaScript to develop high-performance service-side programs, which may end up "client developers" to know Html/javascript, "server developers" to know. Net/c#/ruby such a nightmare.
While this is a good architecture, we can reuse some of the gains on the client side to simplify the jquery code that once happened in the spaghetti like the client. Like the rails spirit, we need to get the data from the server in a defined way, and then wrap the client's HTML page. So over the next 2 years, there have been many frameworks for simplifying client development, such as Backbone,ember,derby and Meteor, and of course my favorites, AngularJS.
So that's what we see today, and the reference architectures that I'm going to talk about, MongoDB as a database server, node/express as a Web application server, clients using ANGULARJS, and bootstrap style. I found this architecture to allow me to quickly build Web services and ANGULARJS-based client interfaces, and even to develop mobile applications like other services such as PhoneGap or other native mobile development tools.
Over the next few weeks, I will post articles explaining these components, including: Mongodb,node/expressjs,json and Rest interfaces, Angularjs,karma-mocha testing and bootstrap style pages.
Recommended reading: "Evolution of Web Development Technology"
Inspired by the great history of web development, write down my understanding of web development technology.
1. Static page times
University, on the machine also have to change card wearing slippers, Novell's network is very magical, but more magical is the communication principle of the teacher half mysterious said he on the Internet, "Cernet (Education Network) has a 64K export, half a year ago also very quickly, now has compared card." In this way, we use Netscape to point to Yahoo. It is an HTML plus picture of the world, filled with all kinds of fancy shiny fonts and bows of the villain, blue connection click will be magical color.
We began to use the unskilled HTML and simple design to design the page, and know that there is a browser, there is a call webserver, but the management of the Sun Workstation room teacher is always very tight, will not let you move the system half points. I heard there is a magical thing called Linux, ok I want to try, but I only have a saved computer, and several 5-inch 3-inch floppy disk. I thank a senior, he helped me to download and split a version of the Mandrake, so the roommate saw a very strange scene, I run in the room between the dormitory, carefully calculate the capacity to copy, so in the holiday I first built Apache.
2. The CGI era
Soon popular on the page is a call counter things, free toll of the site is used as a selling point, "three-dimensional super-color fashion Counter", soon we see almost every page has a click on the 88888 cool device, just no matter how the point will not change. And the campus posted an enviable advertisement, "Levy people write CGI program, a 500 yuan!" “。
Slowly, knowing that CGI is the use of inter-process input and output communication, and webserver to communicate, so that can write programs to control the content of the page output. But at that time will give hard disk partition in Zhongguancun is regarded as a computer master of the age, it is very few. Even today, I'm still at a distance from Perl. Some seniors use C to write more advanced CGI applications, such as webmail, and dig into the first bucket of gold to become the pioneer of today's Internet.
3. PHP is showing a sharpness
To be honest, I think PHP is the language that most benefited from the Internet wave, and at the right time good partner MySQL appeared together. Using Apache's module mod-php, PHP is running as part of a Web server, and the efficiency and maintainability are well improved. The scripting language became the backbone of the Internet front-end development until today. PHP and Big Brother Perl, as well as Brother Python,ruby together, are in the programming language leaderboard 5-10 positions.
The same MySQL is the age of the Jiao son, it quickly and flexibly easy to use as a site database of choice, but for a long time, MySQL was criticized by other databases, don't say Oracle and other high-handsome, even if the same as open source Postgres community, there will be such a voice, "Do not support the transaction is also called the database?" ”。 It doesn't matter, the open source community quickly joins a variety of engines, and now MySQL is definitely the first database to be installed.
4. Java EE
The advent of the Java era, a cup of coffee, a bouncing elf has affected all large software companies. Yes, all of them, including Microsoft, Sun, a moment of starlight, all developers are talking about Java. When people were disappointed with their desktop performance and questioned, the Java EE appeared in time, and servlet+jsp quickly became a useful technology for web development. The ability to cross-platform, self-unpacking the use of the Web server, hooking up any database JDBC interface, the moment the world becomes very beautiful.
Microsoft's ASP also appeared, the beginning is a script interpretation, and PHP and other technologies similar. Soon Microsoft's C # and dotnet Strategy, ASP also upgraded to ASP, since dotnet and Java EE is a competitor, is a pair of friends standing in the same station trench, learn from each other and copy each other's technology and design, until today.
5. The Web layer framework is flourishing
Servlet is an excellent web technical specification, but it is still not well covered in the face of the development requirements of the Plex. The struts framework quickly became mainstream, and today we still see a lot of. Do suffixes of the page. Struts has done three things, one is to comb the request URL well, through the command mode to match the request to the action object, and can be injected with the same time the IOC framework. The second is to comb out a number of useful intecepter, and can freely combine to form their own stack. Third, the flow of pages through the XML way can be flexibly defined.
Over the same period, hundreds of various frameworks have emerged, most of them are for the servlet blank, in several aspects of code or configuration of the Convention, is flourishing, I think the Java community can still prosper today, this sea of rivers, open attitude is the root cause. Many of these frameworks have gone through their lifetimes, but there are many more active, including WebWork, Struts2, and SPRINGMVC, the most outstanding of the template technology category. Gwt,wicket and so on the page component class performance is good, also has out of the servlet bondage play and so on frame.
6. WITHOUTEJB
In the Java EE, an EJB is another heavyweight specification beyond the servlet. The source of EJB design is CORBA technology, and the Distributed object technology has a complete embodiment in the EJB specification. In his writings, Rod challenged the large and difficult EJB specification, especially its mandatory distribution requirements. My idea is that distributed support is not wrong, and now the definition of local and remote in the EJB specification is correct. Developers should start by understanding the partitioning of interface granularity, where local and remote interfaces are different. For general small applications, servlets and EJB containers are all in one virtual machine, and the local interface is reasonable, but for large enterprise applications and Internet-level applications, remote partitioning and invocation of services is required. So early EJB, can be said on the one hand design is not complete, on the other hand over design. But EJB has been completely reborn since 3, becoming a well-designed specification.
Spring is the mainstream of Java Web development as a development framework that combines IOC and AOP capabilities with other technologies and project libraries at all levels. But in the face of CDI and other Java EE specifications, in injection, life management, object decoupling and other advantages are not. I expect spring, Java EE and OSGi to compete in the mainstream Java development framework and to learn from and integrate with each other.
7. Ajax
JavaScript is the browser's orthodox scripting language, but in the era of poor machine performance, a section of JS code causes the mouse to not respond to the situation abound. JS's influence is to float on the page "Click Me" dialog box, the page merry effect of color notice, or the dozens of-layer modal dialog box malicious page, many Internet cafes machine default JS is disabled. For a long time, Java web Development A latent rule is to write less handwritten JS files, so that it can support a variety of browsers and improve efficiency.
Google Fire, Ajax has become a hot front-end technology, we use Gmail,google map and other products, there is another experience, click the link or button, even if the network is not smooth, the page is no longer full white re-refresh, but the content gradually appeared. The principle is to use the JS script to the background server to obtain data, in the browser front-end data parsing and rendering, in this process, most of the pages do not need to change, just update a portion of the page. Google's strong support for Firefox to regenerate, and Apple together with the development of the WebKit project, respectively, the development of Chrome and Safari browser, accompanied by a significant increase in page rendering ability, JS script parsing ability also leaps and bounds. I personally think that the Ajax technology seems simple, but it is a new generation of web, so-called Web2.0 of the cornerstone of the nature of technology, the internet after the dotcom boom and the revival of the day has played an important role.
8. Ruby and Rails
The rapid growth of the Internet requires rapid web development capabilities, the rails framework has emerged, but also the popular Ruby language, its appearance to meet the needs of developers at that time, rapid development, play cool things, a complete back-end model support. Let's take a closer look at the MVC in rails and find out that the definition of the relationship between entity objects in model is consistent with many of the JPA concepts of Java EE, but with the meta-capabilities of the Ruby language, you can extend the functionality of entity objects directly, while the Java community is still anemic, The congestion object was debated. Control,view levels can also be consistent with some Java framework concepts, but some design ideas are more ingenious, and rails ' genes are designed to meet the needs of Internet development, which differs from Java EE enterprise applications.
Soon, a variety of languages have appeared to mimic rails projects, Java grails, Springroo,jbossforge,python django,php symfony and so on. Without exception, the influential are open source, with good community capacity-building projects.
9. JSF and CDI
Let's go back to enterprise application development, have you ever thought about the so-called enterprise applications and Internet applications The biggest difference is what? I think is the number of user levels of differences, leading to the front-end design, software system, background database, caching technology applications, there are different design concepts and methods. In a more technical sense, it is conversation and business. Enterprise applications have strong conversational and transactional requirements, and these two technical terms are also associated. It's easy to go through multiple sessions in a transaction until the transaction is all done. And our daily work is the same, fill out the list, and the staff to communicate, modify documents, stamps, all kinds of words, the final feeling, work really difficult.
From the software level, an enterprise application software may not be a lot of users, in the enterprise Be people, but the front background of the interaction is a long time, multiple sessions interaction. JSF technology is in fact borrowed from Microsoft ASP, they inherit the traditional IDE rapid development of ideas, I hope that by dragging the connection can quickly develop an application. Components on the page, corresponding to the business components of the background server, after the server request, the component needs to do a series of actions to complete the parsing, validation, model reconstruction, business method calls, page rendering and other steps, these must have a longer process. Complexity, efficiency, and the integration of other technologies, JSF technology has been questioned from the moment of birth, and in the face of every star technology, a bit out of tune, such as Ajax, and JSF requires the Post method also need to re-brush the page. But JSF has been improving and getting more and more scientifically perfected. Today, with CDI,JSF is one of the preferred technologies for enterprise application development, you can study Oracle's application products and ADF development framework.
CDI is the technical essence of seam framework to form the Java EE specification, in JavaEE7 has become one of the most important specifications. Like hibernate eventually forms JPA, CDI is also gavinking conceived, developed and driven. Careful analysis will find that CDI almost make up for Java EE in the modern development requirements, the object aspects of the definition of the vast majority of deficiencies, such as the DI specification definition of injection, life management and Session scope definition, perfect the EJB for ordinary Pojo for the transaction, asynchronous notification mechanism definition, as well as the stacking definition of annotations , decoration mode and so on. Sometimes I think, if Java EE is a GK from scratch, we developers will take a lot of detours, because his understanding of enterprise applications and the use of Java to build frameworks and define specifications are close to the needs of frontline developers. The only regret is that CDI has not been pushed to finish, and he has shifted his interest to play language. About JSF and CDI, I suggest to do the related products of friends, even without such a combination, it is best to know the basic content of its technology, I would like to expand the idea is very good.
Netty,nodejs,vertx and the trend of asynchrony
Netty's leader and Mina's main developer, Trustlee, is a South Korean who speaks slow-line. Ask me a question about volatile in the interview, both sides feel that the non-native language is very awkward, so it is simple to express even. But I did not expect this age of developers, the future of Java in the Internet company's status promotion, play such a big role, this project is Netty. We all know the author of the Java Asynchronous Collection library Douglea credit, Nio1 generation, for the asynchronous socket is not very perfect, even Nio2, the work center of gravity or file system asynchronous processing, the network layer of asynchronous design gradually improve. Because of the Java design concept, orthogonality, interface stacking, the bottom function platform unification and so on to the asynchronous distributed network framework to set aside enough space to play, netty,mina,grizzly and other projects have emerged. Twitter is announcing its move from Ruby to Scala and using Netty to make it rounds.
The so-called asynchronous network Framework, is to call the network layer, asynchronous, and interface encapsulation, making it easy to understand and use. Asynchronous capabilities are also implemented through the existing capabilities of the Java virtual machine, processing data streams and state awareness, rather than traditional blocking messaging. This is in line with our feelings in life, when you make a booking, you will call to tell you what you need, say the booking of the ticket to my phone, and then you go to do other things, until the ticket clerk informed you booked to pay the ticket and then proceed to the next step, if the booking is synchronized, then you will have to wait for the booking It may take all day to catch the spring rush.
Why the asynchronous network framework is also valued, the answer is also the internet, hundreds of millions of requests click on the rush, the traditional webserver, the use of a thread service a request model of the webserver, can not withstand such a large data access, especially for Java, such as eating memory language, A request takes up a thread and also consumes a number of corresponding resources. The whole architecture of enterprise application design faces a bit of a crash when it comes to Internet-level applications. The way to resolve high concurrent requests is high throughput plus a scalable software architecture. Asynchronous can improve throughput, and the bank's queuing machine, customers come to get queued services, when there are available counter services will be actively inform customers, we can imagine, even if there are more customers, can also be added to the business counter, a little more queuing machine and a small amount of manual coordination processing to solve.
Nodejs is an asynchronous JavaScript-based development framework, is the current star technology, in line with some of the current development needs, such as asynchronous, front-end JS technology is widely used, JS engine capabilities greatly improved,NoSQL hot, component Building model changes and so on. Using the JS language function programming ability, JS developers can easily use the existing components to develop back-end applications, the front-end can be directly with the browser to deal with JS, do not forget that JS is the only browser can be unified to identify the scripting language, or with JQUERY,ANGULARJS and other popular framework, the world is very clean, It's all JS.
But we need to understand that in the resident Memory service program, Java and other languages occupy a great advantage, the Java community quickly appeared and Nodejs have the same design ideas of the project, Vertx is one of the excellent representatives. It draws on the excellent design of Nodejs and ERLANG/OTP Actor model, uses the distributed message mechanism to communicate between objects, uses Netty to carry out the asynchronous operation of the network, invokes the asynchronous invocation, and has its own modularization mechanism. In this way, the Java community has emerged and nodejs competitive technical framework, good use, can solve the demand for large-scale Internet applications.
The asynchronous trend of the Java domain can be said to have just begun, we see the servlet and EJB join asynchronous support, Spring's Reactor,jboss undertow, along with the Java8 on the function language ability enhancement, can anticipate will have the clump many projects to produce. I'm looking at the convergence of the asynchronous trend and Java EE development approach, which I believe is the future of web development.
Evolution of web development---the development of web technology