How do beginners develop a high-quality J2EE system

Source: Internet
Author: User
Tags jboss server
  J2EE is becoming more and more learners, J2EE technology is constantly evolving, and various concepts are emerging. This article attempts to explain these concepts from an easy-to-understand perspective to beginners, so as to grasp the learning direction of J2EE.

First of all, we need to know that Java and J2EE are two different concepts. Java is not just a language, but has already represented another huge camp different from Microsoft, therefore, Java sometimes refers to a genre of software systems. net and Java.

J2EE can be said to be implemented by Java on the database information system, from the early DBASE to C/S structures such as Delphi/Vb, developed to the B/S (Browser/Server server) structure, while J2EE mainly refers to the implementation of the B/S structure.

J2EE is a framework and standard. The framework is similar to the concepts of APIs and libraries, but beyond them. If you need a detailed understanding of the Framework, You can first learn from the design mode.

J2EE is a big concept of virtual reality. The J2EE standard mainly includes three sub-Technical Standards: Web technology, EJB technology and JMS. When talking about J2EE, we should say that the three sub-concepts should be implemented in the end.

Each of these three technologies involves two parts in application: container and application, and Web container is also a JSP/servlet container. If you want to develop a web application, JSP/servlet library or API support (except JDK/j2se) is required for both compiling and running ).

In addition to the JSP/Servlet technology, the Web technology also requires JavaBeans or Java class to implement some functions or package and carry data. Therefore, the Web technology was initially referred to as the JSP/servlet + JavaBeans system.

Speaking of the JavaBeans technology, it involves the component technology (component), which is the core foundation of Java. Many software design concepts (design patterns) are implemented through JavaBeans.

JavaBeans are not in the scope of J2EE concepts. If a JavaBeans object is called by Web Technology (that is, JSP/servlet), The JavaBeans will run in the J2EE Web container; if it is called by EJB, it runs in the EJB container.

EJB (Enterprise JavaBeans) is an improvement and specification of common JavaBeans, because enterprise information system development requires a Scalable Performance, transaction, and security mechanism, which can ensure the smooth development of enterprise systems, instead of changing a software system at a scale.

So far, after the development of the JavaBeans component to EJB, it does not mean that the previous JavaBeans form disappears, which naturally forms two kinds of JavaBeans technology: EJB and pojo, pojo is completely different from the EJB concept. It refers to the common JavaBeans, And the JavaBeans are not attached to a framework. Or you can simply say that this JavaBeans is created for the application separately.

There are many J2EE application system development tools, such as JBuilder and eclipse. These ides are first Java development tools. That is to say, their primary basic function is to develop JavaBeans or Java classes, however, to develop a J2EE system, you must implement either web or EJB technology. Therefore, you may need some special module functions (for example, eclipse requires the lomboz plug-in ), most importantly, because the J2EE system is divided into two parts: container and application, you must specify the J2EE container for developing J2EE in any development tool.

J2EE containers are divided into web containers and EJB containers. tomcat/resin is a Web container; JBoss is an EJB container + Web Container, among which web containers are directly implemented using tomcat. Therefore, the Web application you developed can run in the preceding two containers, while the Web + EJB application you developed can only run on the JBoss server, commercial products such as WebSphere and WebLogic belong to the same nature as JBoss.

J2EE containers are also called J2EE servers. Most of the time, they have the same concept.

If the database connection of your J2EE application system is obtained through JNDI, that is, from the container, then your J2EE application system is basically irrelevant to the database, if you have coupled the JDBC driver configuration in your J2EE application system, your J2EE application system will have a database concept. As a mature J2EE application system to be promoted, coupling with a specific database is not recommended. Of course, how to ensure the running performance of the J2EE application system reflects your design level.

The criteria for measuring the level of J2EE application system design and development are decoupling. Can all functions of your application system be completely detached? Whether or not they are independent, and only in this way can the maintainability and scalability of software design goals be reflected.

To achieve this purpose, various Framework concepts were created. The J2EE framework standard divides a system into the main parts of Web and EJB. Of course, we sometimes do not distinguish this specific technology, instead, it is abstracted from the design to the presentation layer, service layer, and persistent layer. These three layers separated J2EE from each other to achieve decoupling.

Therefore, in actual programming, We need to align our functions to these three levels to make the general direction clear and distinct, however, it is not easy to do this without technical constraints. Therefore, we must use the specific J2EE technology. At this time, you can use the EJB specification to implement the service layer and persistence layer, web technology implementation presentation layer;

Why can EJB separate the service layer from the JSP/servlet, because it has mandatory constraints on the JavaBeans encoding, and now there is a weak constraint on the JavaBeans, implemented in the IOC mode (of course, this method is also used in EJB 3.0). Prior to the birth of the IOC mode, the factory mode was generally used to constrain the javans and form a service layer, this is also one of the design principles of open source forums such as jive.

Therefore, the service layer is separated from the presentation layer. Currently, there are two optional architecture options: managing the common ans (pojo) framework (such as spring and jdonframework) and managing the EJB framework, because EJB is not just a framework or a standard, but a standard can be extended and developed, the two differences may be vague in the future and incorporated into the same standard. However, I personally think: standards are designed to serve a specific purpose, and they always have to sacrifice some in exchange for others. Therefore, these two architectures will coexist for a long time.

These two kinds of architecture differences have also emerged as a new term: a fully pojo system is also called a lightweight System (lightweight). In fact, this term is not strictly defined by itself, what's more, it's an attractive sign. Is light weight easy to learn and use? According to this definition, simple spring and other systems are not easy to learn. Can systems after EJB 3.0 (still called EJB) be called Lightweight?

Previously, I talked about the service layer framework. The service layer framework can be used to separate ans from JSP/servlet, while the presentation layer framework can be used to completely separate the remaining JavaBeans in JSP, these JavaBeans are mainly responsible for display. Generally, they are implemented through taglib. Different frameworks have different tag libraries. Struts is a widely used presentation layer framework.

In this way, the separation between the presentation layer and the service layer is achieved through two frameworks, and the rest is the persistence layer framework, the purpose of separating database storage from the service layer through the persistence layer framework is that the persistence layer framework has two directions: Directly Writing JDBC and other SQL statements (such as ibatis ); hibernate and JDO technologies implemented using the O/R Mapping technology; of course, there is also the Entity Bean Technology in EJB.

The persistence layer framework is currently available in a variety of ways, with its own advantages and disadvantages. So, just like the presentation layer framework, no framework is currently specified as a standard framework. Of course, the presentation layer framework now comes up with another JSF, which represents the concept of page components as a new development direction, but complicated implementations are somewhat confusing.

Sun has played a major role in all of these J2EE technologies, but in general, sun's theory is invincible; sun products are used to hit the wall. For Beginners, especially those who attempt to pass or have already passed the sun certification, they can quickly get rid of the Sun Shadow and get away immediately, use open-source products to implement your own application systems.

Finally, if your J2EE application system is implemented using the framework of the presentation layer, service layer, and persistence layer mentioned above, you can also develop a high-quality application system without having to have a deep understanding of the design model.

It should also be noted that the development of a high-quality J2EE system requires correct understanding of business requirements, so Domain Modeling provides a more practical and feasible way to correctly understand business requirements, the detailed knowledge can be understood from the UML perspective.

Of course, if you want to design your own industrial framework, start with the design mode, because the design mode provides you with a reference implementation method to implement decoupling between JavaBeans or classes, when you learn how to decouple the system's basic unit JavaBean or class, you may be able to master the decoupling between system modules, and then you can refine the industry framework, this is another development direction.

The above concepts can be summarized as one sentence:

Three treasure for J2EE development: domain model, patterns, and framework ).

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.