Promote the reuse of software using the power of the Rational XDE

zhaozj2021-02-16  48

Wang Hui (huiwang_290@hotmail.com)

January 2004

Software reuse has always been one of the important goals of software development pursuit. The software reuse can shorten the software open cycle and improve software quality. Reusable software components, design, code is the most important asset of software development companies. However, the retroduction of software is affected by many factors, such as software design quality, project delivery time, and management and norms of work products at all stages of software development process to some extent, the software is reused. The software reuse can be divided into multiple levels: code-level reuse, component-level reuse, reuse, software architecture reuse, and reuse of solutions. For developers, more concerned about code-level reuse, component-level reuse, and reuse of software architectures. Rational XDE provides a mechanism for reused software reuse through support models and code templates, which can realize software reuse of each level. This article is to introduce you how to use the modified mode that has been created in XDE to promote the reuse of the software.

Rational XDE Mode Foundation

The benefits of using the mode is a solution to a specific issue in a particular environment. The use mode can bring us short-term or long-term benefits. But in the process of using the model, you must pay attention to the use of patterns in your software development, indicating that your software design is reasonable. Be sure to have a deep understanding of the target mode and your development problems and problems when you decide which mode. At the same time, when you use the mode, don't make your hard sleeve. When you find the most appropriate mode, you can consider extending or modifying your own mode on the basis of existing patterns. Let's take a look at the benefits of using the model:

1. Mode can be a good sharing mode is a solution that is shared between projects, companies and even companies through standardization and documentation of patterns. This shared range depends on the intent of the creation mode of the creator. There are many existing patterns on the Internet that can be used by us, the most famous is the "Four Gang" (GOF) mode. Rational XDE provides full support for the "Four Gang" mode, including implementation of some specified programming languages.

2. The pattern is solved by solving problems and methods and methods for solving specific problems in a certain environment by defining a solution. Mode users rely on a good mode document to select and apply mode. Users need to know what kind of problem can solve, and need to understand how the mode is how to solve the problem and application mode process logic. So good patterns should include good mode documents.

3. Mode can be used in a wide range of application modes to be used at all stages of software development. You can create a mode that solves a single problem or an application for an application. One model can also use other modes or mode systems to solve complex issues. The design type of the pattern can include structured, behavioral, and conditional solutions, so the scope of application is very broad and flexible.

4. Mode can improve the reuse of software's reuse software, including system creation, patches, and software components. Creating and using modes can facilitate the reuse of the software, and the mode can be used multiple times once it is created. Usage mode can be reused by avoiding redesign to save development costs, reuse can constantly improve software quality and reliability.

The concept of the pattern in Rational XDE is learning to use Rational XDE to use the Rational XDE. We need to understand the concepts involved in the Rational XDE, so that you will have a clearer idea during the process of learning and use.

Rational XDE Support Rational XDE support Rational XDE The support is reflected in several aspects: mode creation (custom mode), mode application (usage mode), support for existing mode and RAS mode support.

Mode creation: In Rational XDE, we can create your own mode, which can include mode design models represented by the mode and the modem parameters that can be parameterized, and can also contain a support code generated code template. Provide a special tool and view help mode developer's creation work in Rational XDE. When creating a mode, the mode developer can add a complete document to the mode to guide the user selection and application mode, and Rational XDE provides the mechanism for the application mode wizard to guide the mode of use of the mode. Mode developers can customize the usage wizard of a particular mode, by prompting the dialog, step by step. Pattern Application: If you are just a mode user, you can use the Rational XDE very convenient application existing mode, combined with the characteristics of the Rational XDE code and model synchronization can greatly improve the efficiency of software development and improve software quality and reliability. Support for existing patterns: In Rational XDE, it contains support for the most famous mode of the industry, such as the "Four Help" mode, J2EE core mode, etc. On the RDN (Rational Developer Network), there is a region specifically for exchange model assets, we can download available modes from this area. RAS (Reusable Asset Specification) Support: Mode in XDE can organize and archive according to RAS standards, and Ras is an industry standard for organizations that can be organized in software development. Mode The RAS Standard Organization means that the pattern can be reused by software organizations. The pattern template mode template is the core part of the mode in the XDE, almost all mode elements are defined in the mode template, including the design model and parameters. We can browse and edit it through Model Explore. Mode template is represented by asset << asset >> prototype, as shown in Figure 1. From Figure 1 we can see a mode template called Raspackage1, which contains the design model of the pattern and the definition of the model in the model.

Figure 1: Mode Template

The design of the template parameter mode must set the template parameter for the mode template, even if the mode template itself does not require parameters, this template parameter is also necessary. You can set the default value for the template parameter, or assign a value for the template parameter when the mode is applied.

Root Context The root context is an attribute of the mode, with it to indicate a mode content of the mode template to be applied, this range can be the whole of the mode template content body, or one of the mode template content body. Pack or a class. Through this setting, we can implement different parts of the same model can be used in different mode.

Binding and binding location (Binding and Binding Location) Binding is the process of parameters in the mode to give a specific parameter value, this parameter value can be a model element specified by the user, or it can be automatically created with default values. element. When a model is applied, there is a binding object in the specified binding point, which is used to maintain the template parameter of this mode and the bound relationship between the specific parameter values. You can modify the bound parameter values ​​directly in the binding object. In the default, the binding point and the extension point are the same location.

The Expansion Location extension is where the mode is stored when the mode is used. You have to set it with the application application.

Model Application If you just want to use mode in your application development, this part of this part is most important to you. We will describe how to apply existing patterns in Rational XDE from the perspective of the mode user. We will tell every step in this process.

Step 1: Select mode, learning mode Usage Before using the mode, we must choose the mode of software development that suits your software according to the actual needs. If you don't know much about the pattern, you first need the basic knowledge and concept of learning model, "design mode" book is a good choice for learning mode. We assume that you have a certain understanding of the model, now we choose the FACADE mode in the "Tourism" mode as an example of our learning mode application. If you don't understand the Facade mode, there is no relationship, here we will make a comprehensive introduction to the Usage of the Facade mode, solve the problem and how to use. In Rational XDE, supporting many classic patterns, the "Four Help" mode is some of them. You can set up the available mode in the submenu of the Patterns menu item in the XDE Tools menu OrganIze Favorites. Figure 2: Organizational Mode dialog

As shown in Figure 2, you can add the model you need to XDE so you can use other people developed in your application development. However, it should be noted that in XDE, the mode is organized in the form of RAS assets, mode is stored in the RAS asset library, the file form of the asset library is RAS to extension, such as you can in the XDE The /addins/patterns/content/gof/java/v2.5 directory found a file named GOF.RAS, which stores the "Four Help" mode in this file. That is to say that the model you want to use in other people must also match the RAS standard to use in XDE. You can access the mode switching area in the Rational Developer Network (RDN), where there are many modes that have been developed can be used to speed up your software development process.

Now let's take a look at the content of the Facade mode. Let's take a look at the documentation of the Facade mode. In order to view the schema, we first need to open the mode in the mode browser (Pattern Explore), you can open the menu Tool> Patterns> Open Favorites Libray> Gof Pattern Libray for Java V2.5 to open The entire "Four Help" mode library, then you will see all the modes in the "Four Gang" in the mode browser, as shown in Figure 3.

Figure 3: Mode browser

Use the mouse to select the Facade mode, then select the display view> Pattern Documentation in the Window menu, you will see the mode document view, as shown in Figure 4.

Figure 4: Mode document view

Mode documentation provides you with a mode application environment that can solve the problem and how to apply a mode in XDE. Let's take a look at the various parts of the mode document.

SHORT DESCRIPTION: The brief description is described.

Version: Mode version

Last Modified Date: Modification time

The above part is the basic information of the pattern, below is the subject portion of the mode document.

Participants: Participants represent the parameters of the mode template, which describes the role, quantity relationship, type, source of the mode, quantity relationship, type, parameter value in this mode, the source, the default value, and the code template.

There are three participants in the Facade mode: Facade, SubsystemInterface and Operation.

The FACADE participant knows which subsystem is responsible for handling the user's request and forwards the request to the appropriate subsystem object. Its type is Class, and its source of parameter value can be the existing class provided by the user, or XDE can create a class for you. This participant is set for default Facade, which means if you don't set a parameter value for it, it will use Facade as a parameter value.

The SubsystemInterface participant implements the functionality of the subsystem, which handles the user request being forwarded by Facade. Its type is Class, the source of the parameter value is that the user provides the existing processing class. Users need to build this subsystem class before applying the FACADE mode. The Operation participant is a subsystem handling the user's request or can be said to be a function. Its type is an operation (OPERATION), and the parameter value can be provided by the user or from a collection.

Below we understand the relationship between the participants in the mode by pattern class diagrams and timing charts.

Figure 5: Class diagram of the Facade mode

In this class diagram we can see the relationship between the participant's Facade and SubsystemInterFace. Note that in this figure, you can find a expression of <% = facade%>, where facade represents a parameter of the mode template, assigning the corresponding class name by assigning this parameter when appging mode, such as you can FacadeTest assigned to it, the name of this produced FACADE class is FacadeTest, while the value of the place that references the Facade parameter is also FacadeTest. When you apply this mode, this class diagram will also appear in your model, which is different from this figure that the parameter section has been assigned.

Figure 6: Timing diagram of the FACADE mode

Figure 6 is a timing chart of the FACADE, which describes the interaction between the various objects in the mode. After applying this mode, this timing chart will also appear in your model. Different from this figure is that the parameter portion has been assigned.

The classification section describes information as the RAS asset mode.

Author: The author of the model can be used to search the model

Packager: Packagers

Keyword: Keywords used to retrieve

Problem SOLVED: Mode Solved Problem

Benefit: Use this mode benefits

The USAGE section describes the steps and activities of this mode

Now we have a certain understanding of the participants in the facade model and the relationships and patterns between them, and let us develop this mode.

Step 2: Application Mode If you have understood the concept of the pattern in the previous XDE and the various parts of the FACADE mode, the process of application mode is very simple, we can think of it as a parameter assignment to the mode template the process of.

First we need to create a Java modeling project and apply the FACADE mode in this project. Create a Java modeling item by the following steps:

Document> New> Project Popup New Project Dialog box See Figure 7

Figure 7: Creating a Java modeling project

Select Modeling in the navigation bar on the right side of the new project dialog, then select Java Modeling Project in the browsing bar on the right side of the new project dialog.

Click Next to enter FacadeTest in the text box of the project name. Click to complete. XDE will create a Java modeling item, as shown in Figure 8.

Figure 8: Java modeling project

In the Model Explore view, you can see Java Code Model, just created, on the right of XDE is the pattern browser we just opened, and we will start using the FACADE mode here. Now our task is to create a class representing a subsystem, which is the requirements of the SubsystemInterface participant of the Facade mode. We simply create a class named subsystem. Proceed as follows:

Right click on Java Code Model to select Add Uml> Class, name Subsystem.

Then add an operation name Test () for class subsystem. This action will become the value of the Facade mode Operation mode template parameter. The steps are as follows: Right-click on the class subsysteminterface, select Add UML> Operation, named Test.

Next, start the application mode FACADE, steps below:

Right click on the FACADE mode in the mode browser (Pattern EXLPORE), select Apply this Pattern. Application Mode Wizard Picture Selector dialog box, as shown in Figure 9

Figure 9: Application mode

Select Apply Pattern Dialog to apply the FACADE mode dialog box to pop up as shown in Figure 10.

Figure 10: Applying the Facade Mode dialog

This dialog is divided into several parts, the top is the mode description section, which briefly illustrates the use of the FACADE mode. The next part is the mode template parameter information section, which is the core part of our application mode, where we need to assign a value for the parameter template. In the FACADE mode, we need to assign values ​​for four parameters.

FACADE Parameters: Types to Class, so we need to set a class for him. In the value domain of the FACADE parameter, we can see that there is already a Facade value, which is the default value of the Facade mode, if you don't want to use this The default value can pop as a dialog box as shown in Figure 11 by the mouse dual-strike domain.

Figure 11: Select Parameter Value Dialog Box of Facade

You can reset the value of the Facade parameter, where we use the default value facade.

Next to the subsystemclass parameter assignment, the type of this parameter is Class, we have to specify a class for it, this parameter does not have a default, so we must assign one for it. Double-click the value domain of the subsystemclass parameter, pop up the selection parameter dialog box for the subsystemclass parameter, as shown in Figure 12

Figure 12: SubsystemClass selection parameter value dialog

In the left side of the dialog box, select We have created a good Subsystem class before, click the Select button so that we set a value for subsystemclass. SubsystemClass will have a Subsystem class.

Next, the parameter Operation assignment, the parameter type of Operation is an operation, so we have to set an action value for it. Figure 13

Figure 13: Select Parameter Value Dialog Box of Operation

You can see two options above the dialog: User and Collection. Select User means you need to set an action as a parameter value, and the Collection represents a collection of multiple operations as a parameter value. Here we choose the user option and find the test () operation we have created as a parameter value in the brownd of the on the left side of the dialog.

Next, it is assigned to the subsystem parameter, its type is package, and has the default value subsystem, the function of this parameter is to store the elements in the build mode. We use the defaults subsystem, when generating mode elements, you will see a package named subsystem's package is generated, under this package is the model element.

We have assigned values ​​for the four parameters of the FACADE mode, and the next thing is to set the extension point and binding point. As we have introduced the concept of extension points and binding points, the extension is the storage location of the model element of the model, and the binding point refers to the storage location of the bound object.

Here we all choose the Java Code Model package. This way we have set all the parameter values ​​for the FACADE mode, as shown in Figure 14

Figure 14: Assignment of parameters for FACADE mode

Here you click on the Apply button to complete the mode, XDE will generate the model element based on the parameter value we set. We have successfully completed the steps to apply the FACADE mode, let's take a look at what model elements for us to generate us. First let's take a look at the content in the model browser, see Figure 15 Figure 15: Application mode Facade generated model elements

First we can see a package called subsystem's package under Java Code Model, which is created based on the subsystem parameter value of the Facade mode. In this package, you can see two types of models facade and subsystem, and their name is also based on the parameter values ​​we set before. There is a class diagram called Facade Participants as shown in Figure 15 with a package subsystem.

Figure 16: Class diagram generated by applying a FACADE mode

Compared to class charts in Mode Facade, they can find that their difference is that the parameters of the Facade mode template are replaced by the parameters we set.

There is also an instance of collaboration called AccessSubystem with the class chart of facade participants. See Figure 16

Figure 17

In the model browser, you can see several objects (ACLIENT, AFACADE, and ASYBSystemClass), and an interactive instance, interactive instance describes the interaction process between certain objects in the system, typical use timing chart To represent. Double-click timing map AccessSystem you can see the timing chart generated by the Facade mode, see Figure 17

Figure 18: Timing diagram generated by FACADE mode

In the figure, you can find the difference between the timing chart in the FACADE mode is that the parameters of the mode template are replaced by our values.

We have completely experienced the process of applying mode. The application mode in XDE can create a framework for you to complete the implementation of the mode on the basis of the generated framework.

转载请注明原文地址:https://www.9cbs.com/read-27707.html

New Post(0)