Patterns and frameworks are everywhere in software design. A friend once asked me what is the mode? I am also studying and give the following summary about my learning experience. (Note: personal opinions are for reference only. please correct me .)
1. What is the mode?
Pattern. It is actually a methodology for solving a certain type of problems. You sum up the methods for solving a certain type of problems to the theoretical level, that is, the mode.
Alexander's classic definition is that each mode describes a problem that is constantly emerging in our environment, and then describes the core of the solution to the problem. In this way, you can use existing solutions countless times without repeating the same work.
The mode has different fields, the construction field has the construction mode, and the software design field also has the design mode. When a domain gradually matures, many models will naturally emerge.
What is a framework?
Framework. In fact, it is a semi-finished product of an application, that is, a group of parts for you to choose to complete your own system. Simply put, you can use a stage set up by others to perform performances. In addition, the framework is generally mature and constantly upgraded software.
2. Why use the mode?
Because the mode is a kind of guidance, under a good guidance, it will help you complete the task, and help you make a good design solution to achieve twice the result with half the effort. In addition, we can find the best solution to the problem.
Why use the framework?
As software systems have become very complex today, especially the knowledge, content, and problems of server-side software and design. Using someone else's mature framework in some ways is equivalent to letting someone else do some basic work for you. You only need to concentrate on completing the business logic design of the system. In addition, the framework is generally mature and robust. It can handle many details of the system, such as transaction processing, security, and data flow control. There are also frameworks that are generally used by many people, so the structure is very good, so the scalability is also good, and it is constantly upgraded, you can directly enjoy the benefits of other people upgrading code.
The framework is generally located at the intermediate layer between the low-level application platform (such as J2EE) and the high-level business logic.
Why is software layered?
To achieve high cohesion and low coupling ". Divide the problem into various solutions, which are easy to control, easy to extend, and easy to allocate resources... In short, there are many advantages :).
3. The following describes the Java and J2EE models and frameworks:
What are common design patterns?
First, you need to understand the book gof's design patterns-the basis for reusable object-oriented software (this can be said to be a must for programmers). Note: gof is not a single person, it refers to four people. Its original intention is gangs of four, which refers to the four authors of this book: Erich Gamma, Richard Helm, Ralph Johnson, and John vlissides. This book describes 23 main models, including abstract factory, adapter, and appearance model.
There are many other models, estimated to be more than 100.
There are too many software design patterns, so let me briefly describe the most common MVC pattern.
The MVC pattern was proposed by buschmann in 1996:
Model: encapsulates data and all operations based on the data.
View: encapsulates the display of data, that is, the user interface.
Controller: encapsulates operations on the model and controls the flow of data.
In addition:
The Unified Process of software (Rational Unified Process), XP (eXtreme Programming) Extreme Programming, these are usually called "process methods", is a methodology of the implementation process of software projects, it is a method strategy proposed for the implementation process of software projects. It is also another mode.
4. What are common Java frameworks?
WAF:
Full name: Web Application Framework
Main Application: EJB layer (web layer also exists, but it is relatively weak ).
Main application technologies: EJB, etc.
Source: http://java.sun.com/blueprints/code/index.html
Brief description: this is an example that Sun used to demonstrate the J2EE platform. The framework in PetStore is as follows. It is the application framework proposed in the sun blue book example program. It implements MVC and other good design patterns. Sun's website has technical information. It is best to download PetStore for research. WebLogic comes with this system. The source code is Bea/weblogic700/samples/Server/src/PetStore. This is the preferred framework for learning about J2EE.
Free of charge.
Struts:
Main Application: web layer.
Main application technologies: JSP, taglib, JavaBean, XML, etc.
Source: http://jakarta.apache.org/struts/index.html
Brief description: this is an open-source project of Apache, which is widely used at present. Based on the MVC mode, the structure is good and Based on JSP. In jbuilder8, struts1.02 has been integrated.
Free of charge.
Briefly describe the example of combining WAF with Struts: struts for the web layer and WAF for the EJB layer:
JSP (taglib) --> actionform --> action -->
Event --> ejbaction --> EJB --> Dao --> Database
JSP (taglib) (forward) <-- Action <-- eventresponse <--
Turbine:
Main Application: web layer.
Main application technologies: servlet, etc.
Source: http://jakarta.apache.org/turbine/index.html
Brief description: this is an open-source project of Apache. Based on servlet. It is said that the speed is relatively fast, and various services are provided based on the Service (Pluggable implementation pluggable Execution Component) method.
Free of charge.
Cocoon:
Main Application: web layer.
Main application technologies: XML, xsp, Servlet, etc.
Source: http://cocoon.apache.org/2.0/
Summary: this is an open-source project of Apache. XML-based and xsp-based (generally speaking, xsp is a dynamic XML document formed after Java program segments are added to XML static documents .). It can interact with a variety of data sources, including file systems, databases, LDAP, XML resource libraries, and network data sources.
Free of charge.
Echo:
Main Application: web layer.
Main application technologies: servlet, etc.
Source: http://www.nextapp.com/products/echo/
Brief description: an open source project of nextapp. Based on servlet. The page can be very beautiful. Combined with echopoint, you can make a lot of graphic effects (jfreechart package is used in it ). Use the swing idea for web pages and use HTML as a Java class. However, when a large number of sessions are used, there are a lot of page frames, which consumes a lot of system resources.
Free of charge.
Jato:
Full name: Sun ONE Application Framework
Main Application: web layer.
Main application technologies: JSP, taglib, and JavaBean
Source: http://www.sun.com/
Brief description: this is a commercial framework launched by Sun. It is known that it is based on Sun ONE's platform. I downloaded jato2.0 and looked at it. It seems a bit simple. I used JSP + taglib + JavaBean. As his doc says, Jato is suitable for small web applications.
Free of charge.
TCF:
Full name: Thin-client framework
Main Application: Java GUI.
Main application technologies: Java application
Source: http://www.alphaworks.ibm.com/tech/tcf
Summary: this is a framework developed by IBM. Based on the MVC mode and Java application. I recommend an introduction to: http://www-900.ibm.com/developerWorks/cn/java/j-tcf1/index.shtml
Fee: License for each enterprise: USD 2000.