What is Java, what is Uniportal?
UB (38145) 2004-6-21
Preface:
This article is based on my experience. Mainly introduces Java's programming ideas, framework and other concepts, and introduces the relevant concepts of Uniportal according to my 2 weeks of Uniportal. This article does not explain the specific use of Uniportal, please refer to the relevant documentation. The main purpose of this article is to exchange the exchange of programming technology and ideology, and it is inevitable that there is a mistake. Please refer to it.
1. What is Java?
Java is a programming language, but he is not limited to a language, his popularity tells us that he is a process of programming ideas and the main force of network applications.
Java was launched by Sun In the 1990s, the earliest application is embedded small applications, such as microwave, remote control and other home appliances to meet the needs of the platform. Later, with the development of the Internet, it started from the Java Applet's web application. The previous programming is based on certain specific platforms (operating systems), but with the development of the network, cross-platform, portable demand is very urgent. The "Application Software" development is to be separated from the hardware platform and operating system platform, which is also the main reason for Java increasingly popular.
(Note: JDK is the basic development package of Java (which is API), mainly provided by Sun (IBM is also available, slightly different). JDK1.0 called Java, JDK1.1 changed, generally java2.)
Java programming technology is basically open source, and Java has developed very fast. At present, there are three main aspects of Java applications:
(1) J2ME: Java2 small application platform. Mainly, applications on terminals such as mobile phones, PDAs, such as wireless applications such as mobile games, mainly using MIDlet.
(2) J2SE: Java2 standard application platform. Basic Java programming core package, including Swing (AWT) interface programming, UTIL toolkit, JDBC database programming, etc.
(3) J2EE: Java2 enterprise-level application platform. The main enterprise-class network application platform, often said that the three-layer (or N layer) architecture is said to this platform. Including EJB, JSP, servlet, etc.
Note: The J2EE described above is to say "platform" (or environment), my understanding is: Software language system platform-independent software language system platform, a programming environment (actually a set of API, Java language actual application environment ). He is the basic operation layer in the operation platform (ie, operating system) and business application platform (ie, the framework, followed).
2. Why is the software hierarchical?
The development of software development will inevitably brings reusability, and the demand for scalability is increasing, which is the same as other industries, and people always do not like a lot of repetitive labor. The fundamental purpose of the layered is to clearly divide the work segmentation and responsibilities. This will divide a large system into a number of subsystems, so we can multiplex these subsystems or extend these subsystems according to different needs. This is also the goal of software: "High Poly, Low Coupling". The subsystem "high cohesion", "low coupling" between layers and layers. Many people often say "decouple", refers to reducing coupling, reducing the correlation between layers and layers, thereby increasing reuse and scalability. Common Java applications are not just the structure of the BS. The general three-layer architecture refers to: customer application layer, business logic layer, data layer. Each layer of this can also be layered according to the particular application.
(1) The client application layer is used for web applications that use the browser, so common is the use of BS applications such as JSP. However, the client can also use the GUI, and Java's GUI is very beautiful, he can download the Java Web Start, and his short connection with the server is nothing difference. For UNIPORTAL, this is why it is also required for WebAction, and the reason for EJBAction, because WebAction is a client's thing, you can replace the JSP's things into GUI as needed, and EJBAction (commercial logic layer) does not change.
(2) The business logic layer is a very important layer. Because for most application systems, clients and data layers are relatively simple, business logic is the most complicated. Especially large industry software, such as: land tax. Do not take off the business logic layer, then the programming of the entire system is difficult, and the difficulty of maintenance is unimaginable. This is also the weaknesses of many languages, you cannot separate commercial logic layers, if you want to upgrade, such as database upgrade replacement, it is likely to bring overall system redo. This is hard tolerate for a tens of millions of software projects.
(3) Data layout, our currently common data storage is the use of relational databases, and his development has long history and is already very strong. But he is not coordinated with object-oriented programming. For an alteration: your home has 2 cars, the relationship database is to remove the wheels of 2 cars in a table, remove the steering wheel and put it in another table, and remove the seat to another. The table ... and object-oriented programming, when saving, you need to put a car into the garage. When you use it, you can use the whole car out. Obviously, we prefer object-oriented storage. So, there are many, O / R mapping tools, using it to realize mapping of objects and relational databases, such as EJB (ENTITY BEAN), Hibernate, etc. This is also a kind of innovation of programming technology, a leap. On the other hand, the object-type database has also been developed for several years (a lot of XML-based), but according to what I know, difficult. It is mainly difficult to resolve problems in performance and efficiency, and this is the specialty of relational databases, such as: a variety of complex queries.
3. What is object-oriented (oo)?
Java is a real-faced object programming language, you may say that there are 8 basic types, int, char, double, etc. in Java, which is not an object. Yes, they are not objects, they are actually "keywords", but they have corresponding packaging integer, Character, which can be used by objects. Java is just considered by efficiency. What is the object? I think the object is a type of instantiation. His basic feature is: encapsulation, inheritance, dynamics. (Note, classes and types refer to the same meaning, often mixed). For example: people are type, men are his inheritance type, and men Zhang San is an object, he is a specific example, he has specific height, weight, age, etc. attribute value.
In fact, the class is a type definition, he has the attribute name definition, but there is no state (ie attribute value), and the object object is attached to the type (ie, attribute value), it is also called "instantiation" in the computer. That is to allocate memory space to these status values.
For most operating systems, the memory space of the object is allocated on "stack", he is a discontinuous memory space, because you can't know the actual size of an object, the size is the user's own definition. Basic types, such as int, char, memory space is allocated on "stack", he is a continuous memory space, because these types are fixed, and his size is in each machine. (Java is a cross-platform, so the size of the basic type is fixed, relatively large, and the requirements for types are strict, it is a strong type language).
Take it out on "Heap", naturally more slower than from "stack", so Java is relatively slow, he also consumes memory. However, hardware development is very fast, and for enterprise applications, it is generally several CPUs, number G memory, and even the cluster server, so the constraint for performance is not very strong.
Face-to-objects generally refer to object-oriented programming, but I think that object-oriented core is an object-oriented design (OOD).
The object-oriented correspondence is a process-oriented programming, such as C.
Object-oriented core is an object, he is a bottom-up programming, with an object as the core, organizational object relationship, and add business logic.
The process-oriented core is the process, he is the top-down programming, with the business process as the core, around the process to organize data.
For application, we need object-oriented design, because the business process of application software is a variation of multi-end, and many times the customer cannot describe the software process he needs, they originally handled, they can't understand software principles. It is naturally unable to describe a clear business process with software ideas. The core of the business is actually a business object (or "entity"), because the relationship between objects and objects is the most fundamental thing of the business, it is not easy to change.
In fact, I think the software should be divided into system software and business software.
(1) System software: The purpose is to control the machine or help you control the machine, C / C is very suitable. He cares about the "physical model" and is the process details of the system flow.
(2) Business software (or application software): The purpose is to build customer business processes, organize business data. Specifically, access, analyze business data. Java is very suitable, he cares about the "object model" and is the relationship between objects and objects. In addition, there is still a programming mode called AOP, facing aspects, very popular. I think he is an object-oriented complement. He is a higher programming mode. His core is an application facing a certain aspect. It can be said that the object-oriented and process-oriented programming is a longitudinal idea, and aspect programming is a transverse programming mode. Small to the comprehensive query in the system, the application of a certain field, such as the online search, or industry software, such as local tax, bank. (This is similar to another technology Web Service, but WebService is a remote Software service, and AOP is a programming method and ideas, and JBoss has begun to support him, with an article introducing JBoss 4.0 with an AOP framework.).
Because we constantly want to improve software reuse, you will continue to make software into modularity, componentization, just like wood, which can be assembled into a system, this modular "granularity" is getting bigger and bigger, In a certain aspect, or a reuse of a certain industry, for example, you can directly call the Google service interface to do search, call the bank service interface to do financial processing. This is another innovation of software programming ideas. Object-oriented is the foundation, but he generally used in a small range, because the range of object relationship is too complicated, and the cohesiveness is too high, which will bring a wide range (coarse granularity) The connection is difficult, such as the comprehensive query in the large system involves queries of each subsystem, separated is unwise and difficult. And aspect programming is the solution to this problem.
As mentioned above, it can be seen that the programming language is not only the skills, but more deeper is the difference in programming ideas.
I have been a small company, doing business software, all parts of the system, I have to care, so I have this idea, in fact, it is the production method of "small workshop". Huawei's situation is different, Huawei has formed a "software industry", has a clear production line, each department is responsible for his own work, which brings high production efficiency, but for each link Don't need to program your thoughts, the most important thing is to be familiar with business.
But Java is the trend of software development, there is very many advanced nature (I am talking about the advancement of thought). So I think we can pay more attention to some Java software ideas, such as design patterns, frameworks, etc., he is very beneficial for us to solve practical problems.
In addition, changing programming ideas is important to our current work, and the maintenance of code is important. I have seen the software documentation, most of which is a demand specification, physical model, and those things that don't see code, so many code is hard to analyze, so system code is difficult to maintain, and I see No relationship between each module, if I didn't participate in this project before, it is difficult to expand, which is very disadvantageous to software products. Therefore, for software, use UML (Rational Rose) description, it is important than using physical model (VISO) description.
What is UML? He is a unified mode language, a tool that several software is thinking. In fact, it is a graphical language describing the software. Look at the picture is always intuitive than reading text, and looks better to reflect the relationship between the code.
For example: the main UML description of the software needs:
Model:
Active map: (Generally, they can convert each other with timing chart.)
Class Diagram:
As shown above, you can easily see the structure of the system. The classes and methods used are very clear that the design ideas of the system, the design model is at a glance, and it is very convenient to maintain, and more important is that he makes your design ideas clearly. The relationship between functions is clear, and the system can be optimized to optimize. If I let me see a long Word document, I am very easy to dizzy, and rely on demand documents and physical models (only describe the structure of the hardware layer, and how do you guarantee your system correct? And is it effective?
The software products are most important to use, but it is easy to use. Because the customer does not understand the software, but software maintenance, promotion is still what we do, the software is not good, only you know.
4. What is the mode? What is a framework?
These two concepts are very vague, here is a brief description, just personal views, for reference only.
Design mode: Software design model is derived from construction project. With the maturity of an industry, there is a lot of standardized templates, and there will be a lot of repetition problems when dealing with many problems. After a constant experience, some good experience. The problem solving is summarized and "mode" is formed.
Mode has a lot of layers, with software development process management mode, such as RUP (Unified Software Process), XP (Extreme Programming). There are programming modes, the most famous is 23 design patterns written by the "Four Software" (four software cow people). The Chinese version of this book is published by Machinery Industry Press (he uses C ), which can be said to be a must-have manual for software personnel, but many people (including me) have a reflection. " Don't understand, huh, huh. Others and "Java and Mode" is written by Chinese doctors, and beginners are very suitable. Common patterns include "Factory Method", "Abstract Factory", "Agent Mode", "Facade", "Singleton", and so on. The book about Java and the model is now much like a cattle, I am just a primary application.
Frame: He is a semi-finished product of certain field systems. He can help you solve a lot of underlying problems, such as transaction, user security, etc. His main role is to make the system structure, constraint code people's code. It is like a skeleton of a house, and the code personnel only need to fill in business logic code in accordance with the business. And many specific processing details are treated by the framework, transparent to the code person, the code person can inherit the corresponding "basic class", (these "basic classes" is a framework.)
The mode is an abstract concept and working method, and the frame is a collection of code collections that actually use.
Common frameworks have Struts (web applications, apache sub-projects), Hibernate (O / R mapping, very good things, is developed by a cow called Gavin King), TCF (Java's GUI framework, charge .)
Let's take a look at the WAF framework:
Around 2000, in order to introduce the J2EE platform, SUN will introduce J2EE's core EJB applications. He made a sample of PetStore (e-commerce app on online pet store), this thing, the framework used by this system is called WAF (Web Application Framework). Let's talk about what EJB is, he is an enterprise Java Bean. The maximum difference between his use of ordinary Java is that he supports distributed processing, that is, EJB can be published on different application servers. He includes 3 parts,
(1) Session bean: Do business logic processing, built-in transaction, cache and other processing.
(2) Entity bean: Make data entity object mapping, ie O / R mapping, and built-in transaction, "state machine" mechanism, etc., but too advanced, performance has always been a problem, so then Sun is also launched Lightweight east is called JDO. However, many people (including me) also like to use hibernate.
(3) Message Driver Bean: Doing message driver processing, mainly asynchronous message processing.
(Description: In general, supporting EJB servers called application servers, such as JBoss, WebLogic, WebSphere, Resin, etc. Does not support EJB called web servers such as Tomcat, Apache, IIS, etc.)
The above is very simple, there is still a lot of complicated things in EJB (distributed application is really a very advanced thing, which is also an aspect of the Java advantage), in order to show that the complex platform, Sun has done a very Complex frame, WAF, the figure below reflects the basic appearance of this frame:
The green part is the code to do, and the other part is the core code of the framework itself.
After WebLogic installation, there is a prediction version of the system of this system, and you can see his effect directly in the startup menu. On the Sun's website, he can also download his source code, but Sun is based on his own J2EE application server issued and instructions, which is difficult to use. Learning this framework is very helpful to master Java, J2EE technology, and he itself applies to J2EE. I have studied his code, but it is very happy.
Obviously, the core of Uniportal is the framework of WAF (he renamed the HTMLAction to WebAction, and remove the Entity Bean section). To put it bluntly, Uniportal is WAF JBOSS.
5. What is uniportal?
In fact, the following has already introduced the relevant content of Uniportal, and the overall context believes that I also explain it.
Let me talk about what is Portal?
Portal is intended to be a portal. In fact, for the system of B / S, what can be seen as a website, just the difference between complex points and simple points.
However, now the concept of Portal changes, and Portal is very popular. Portal has a wide range of extensions, which is just a brief introduction to Java applications.
I used to do software projects. I first do demand analysis, then do a macro design (including software framework, and object model), do detailed design (class diagram, sequence diagram, etc.), then do coding, then test. (This is the process of big projects. The small project will naturally have a reduction.) After practical, the design and implementation of the macro design (software framework) is very expensive, and it is very expensive to be able to reuse the framework as much as possible.
(Description: Framework design is not necessary, if your object model is good, or doing small projects, you can use an existing popular ripe frame or no framework. However, for large projects, multiplayer projects Since the developer's ability is different, the framework can play a good normative role, and reduce the difficulty of code staff, the core work is completed, and it is also easy to expand and maintain.)
Later, some people simply combine the mature framework and application server, slightly change the application server (JBoss is an open source application server), integrating the frame, this is the current Portal, BEA and IBM have their portal. product. This is the same.
Recently, Sun's JCP (this organization specialized in the release of Java's new technological specification), which released JSR168, which is a PORTALET specification. (Portalet is the component of Portal). That is to say, this specification will make the portal of each manufacturer's PORTAL. However, Uniportal has not yet implemented JSR168 specification.
Regarding the use of Uniportal, the relevant documentation is already very unique, not explaining. Moreover, I haven't used it yet, but I have to continue study slowly.
Ok, thank you for your patient reading this article, welcome to correct and communicate. Please write ub5023@msn.com.
If the picture in the text can not see, please visit here: http://ub1010.51.net/computer/java/javaanduniportal.doc