Detailed analysis on how to develop components

Source: Internet
Author: User
I. Principles

After selecting the system framework and uniform development policy, the development of system components should make full use of the services and tools provided by the existing framework. The development of components should follow the following principles:

1. hierarchical system structure, separation of business and implementation, and separation of logic and Data

First, the application system is layered by client, web server, application server, and data server. Second, the components on the client browser and web server are extracted from the above layers, that is, the user visual interface component and the application logic component on the application server. At this level, pay special attention to separating the application logic from the data. Reasons:

Application logic changes frequently, especially in the current highly competitive market, so we must constantly adapt to the increasingly demanding demands of users. The application logic is separated independently, and plug-and-play replacement components can be used to make the system easy to upgrade.

Application logic is the core of the application system, which is conducive to high-quality and efficient processing.

In a multilayer application system, if the middleware used on the Application Server changes, the application logic separated independently will not be affected. How can the application logic be separated independently? It should be divided by functional features in the application domain. In general, functions represent a group of enterprise activities. The execution and processing, operation control, policy rules, and restrictions of enterprise activities are all application logics. Data processing components must be placed on the data server.

For example, when using the UML language and the Rose tool, the specific practices are as follows:

Use the User case diagram to describe the application system domain.

Creates an event stream description for each user case and follows the topic event stream function. It is often the prototype of the application logic component.

Use the class chart and package chart to find the underlying and high-level logical components. Generally, the event control function or transaction function is a candidate component of the application logic component. When using existing or purchased components for assembly, you need to prepare some bonding Code. It is best to componentialize the code for these custom components to be bonded, and try to construct the code in container mode as much as possible, to form components on the higher level.

2. Use open standards with interfaces as the core

The purpose of the component design is to plug and play, write once, and be available everywhere. The key to achieving this goal is that the component provides a contractual interface. Its input interface represents the services provided by the Environment, and the output interface represents the services provided by the environment. Component Input and Output interfaces determine the connection between components. To be independent from component suppliers, open standards should be used for uniform standards, such as CORBA, DCOM, JavaBean, and EJB.

The interface is very important for custom development by component combination. It is the contract between components. An interface provides a service to complete a certain logical action. The component interface consists of two parts: one is the signature part, that is, the component itself provides the service description; the other is the behavior part, that is, the component behavior description. A component can have one or more interfaces. In an application system, the interfaces of each component must use unified standards. Components developed by developers must also provide API interfaces using the same standards.

3. The description of component semantics should be formal.

The standardization of component interfaces is essentially an important aspect of the Formal Description of component semantics. In addition, there are pre-and subsequent condition definition operations, naming and naming context standards in the Naming Service, directory and directory context standards, Transaction Service descriptors, deployment descriptors, and so on, there are also naming rules, directory and naming binding rules, transaction semantic definitions, and resource distribution deployment instructions. In different standards, they all have their own formal semantic rules. For example, JNDI provides the thin Directory Access Protocol (LDAP), which can be divided into different names and tree context descriptions to query users and objects; in ejbs, session beans, Entity Bean transaction descriptors, and EJB deployment descriptors are available. In top-level elements of EJB deployment descriptors, defines the container, EJB data structure, assembly information, and various file names of application metadata.

4. Strictly record the process of refining and encapsulating Components

As the components allow third parties to use them, to ensure that third-party users can correctly understand the component design ideas, they must record the changes made each time they are extracted. Generally, versions are used for management. When selecting tools during component development, you should select Tools with version management functions. The version consistency must be ensured throughout the application software. After the component is upgraded, the container must be upgraded accordingly.

5. design patterns can also be reused.

One of the main advantages of CBSD is reuse. Its goal is to reuse code, design, and solutions. The design pattern is a record of design experience, which can achieve twice the result with half the effort. Currently, there are dozens of design patterns available for reference applications, and the user interface design MVC pattern is the most commonly used one.

6. Use development tools

Because the component has the features of self-check, persistence, context-dependent, and standard interface, development tools are usually used to create components and application software, these tools, such as beanbox, JBuilder, visualage for Java, ejbmaker, webgain studio, and webgain, provide signatures and behavior descriptions of standard interfaces, and test and customize component attributes.

Ii. Process

CBSD mainly integrates with existing components. Its development process is different from the traditional method.

1. Demand Analysis and component selection

In addition to analysis, the demand analysis stage also selects components. Generally, two steps are involved: Search for the desired component and evaluation component.

First, based on the demand analysis results, find the required standard components from the component library or component market, and understand the features of the component, such as function, reliability, and predictability, including market share and previous performance; then some candidate components are selected for evaluation and decision-making. Because the evaluation method is not accurate and the demand is sometimes not very clear, it is difficult to evaluate and make decisions. This step mainly determines component adaptability, and mainly considers modifying the investment and risks of custom components.

2. Component tailoring and Expansion

The selected components cannot be used immediately. Sometimes attributes of existing components must be extended or modified, which is called the tailoring and extension of components. This usually requires the component developers to propose extensions or modifications. Note that you only need to change the internal attribute and cannot change the interface.

3. Component Testing

After tailoring and expansion, you may also need to re-develop some new components. These extended or newly developed components must be tested on the construction application tool, ensure the implementation of component functions and interface specifications. This step is faster and easier than traditional unit tests.

4. component assembly and integration

Component Assembly and integration assemble the component into a module or package, and you can have your own custom descriptor in the module or package. For example, when using the EJB model, assemble the component and EJB deployment descriptor into the EJB jar module, and then package the EJB module and J2EE deployment descriptor into applications on the J2EE platform; finally, it is deployed in the application server environment. The client creates an EJB client database to generate an EJB client interface and corresponding EJB stubs. The customer component and client EJB deployment descriptor are packaged into customer applications on the J2EE platform. For large systems, integration with traditional systems has also become a problem that can be solved using the Java Local interface JNI. However, this is only applicable to non-distributed and simple integration of old systems. When multiple old systems are accessed, JNI cannot be used and other technologies must be used, for example, integration is implemented by using the following methods: CORBA, HTTP, RMI, TCP/IP, JMS, and XML.

5. Deployment of application systems

Before the emergence of the EJB framework, the application system was an independent Java application. To achieve multi-customer, heterogeneous, distributed, secure, and scalable functions, developers need to do a lot of programming work and cannot do it within a few months. After the emergence of the EJB framework, the application system can be developed based on the Application Server. The application server provides services for accessing resources and online communication of the application system. Application System Development only focuses on application logic and data definition, making it easy to complete the entire application system. After completing the application logic and data definition programming, you can configure and deploy the application server and the customer according to the standard XML file, and complete the deployment of the entire application system.

6. System Evolution

Maintenance of application systems is the process of system evolution. The continuous improvement and expansion of system functions are achieved through upgrading and replacing system components. With the transformation of component versions, application systems have also formed different versions. This is the evolution of the system.

 

Iii. Java application component platform

Sun has made many contributions to Java applications after years of efforts. So far, there are four application platforms: Java card, j2se, j2se, and J2EE, as shown in the figure below.

  

Java card is the smallest application platform and a platform for setting Java smart credit cards. It is widely used in the United States. Java card has a set of API interfaces that run on the card virtual machine. Java card unifies the smart card programming interface, provides a powerful security mechanism, supports multiple loading of the applet, supports the function of one card and multiple applets.

Java 2 is a micro version of Java 2. It is divided into two parts: CDC (connected device configuration) and cldc (connected limited device configuration. CDC runs on a virtual machine and provides an application platform for a complex mobile device such as a portable computer. cldc runs on a core Virtual Machine (KVM) and implements the MIDP (mobile information device profile) mobile Information device application platform, that is, a mobile computing platform for devices such as mobile phones.

J2se is the Standard Edition of the Java 2 platform. It is applicable to desktop systems and provides orb Technology Based on the CORBA standard. It supports distributed interoperability environments in conjunction with Java RMI. It runs on a Java virtual machine. After Java IDL is introduced, j2se supports IIOP communication. It is a highly portable and heterogeneous implementation environment and a robust platform, and is also a standard platform for developing scalable, portable, and distributed heterogeneous interoperability applications.

J2EE is the Enterprise Edition of the Java 2 platform. The foundation of J2EE technology is the j2se Standard Edition, which consolidates many advantages in the Standard Edition. The ultimate goal is to become an architecture that can greatly shorten the time to market for enterprise developers. It provides powerful service functions for flexible configuration of various multi-layer enterprise applications, especially B2B and B2C e-commerce applications. Recently, the connector API service has been added to enable a series of mature technologies for enterprise application development and deployment. J2EE has become the industrial standard for enterprise solutions, and 29 companies have obtained a license to use J2EE technology.

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.