43893910
Picture with Logical Software Architect Create and transform a UML 2 . 0 model into code Skill Level: Initial Eric Extended ([email, protected] ibm.
com) Software Industrial engineer IBM twenty-one Mar 2006 Rational Software program Architect nearly teems with visual tools to handle a number of development responsibilities. Of most interest to developers are UML modeling, design patterns, and UML-to-code transformations. After completing this kind of tutorial, on the boat how to create a UML model, apply a design design to that style, and, finally, transform this model in actual code. Section 1 ) Before you start
Rational Software Recorded provides programmers, architects, and analysts aesthetic tools for a wide variety of software development jobs. This tutorial introduces a few of these powerful visible tools: UML modeling, design and style patterns, and UML transformations. About this guide Learn how to make, edit, and analyze UML models employing Rational Software program Architect. This tutorial demonstrates the following Rational Software You capabilities: ¢ UML modeling Visualize with Rational Application Architect Copyright APPLE Corporation 2006. All privileges reserved. Trademarks Page one particular of 22 developerWorks ibm. com/developerWorks Design habits ¢ UML transformations This kind of tutorial is supposed for computer software developers, designers, and experts interested in understanding Rational Computer software Architect’s visual modeling capacities. If you want to master how to enhance high-level UML models into actual code without even being aware of a particular development language, this tutorial is perfect for you. Goals After completing this tutorial, you should understand how to use Rational Software Builder to create UML projects and models, apply design habits to those designs (new or perhaps existing), and transform UML models in to source code or into a different type of model.
Requirements This guide assumes that you have got some knowledge of Java¢ programming, and design and style patterns. Familiarity with UML versions is helpful, although not required. System requirements To perform the cases in this tutorial, install Logical Software Recorded. If you don’t have a copy of Realistic Software Builder, download a totally free trial version. All of the prerequisites to get Rational Software Architect can be found in the Solutions section of this kind of tutorial. Section 2 . Build a UML modeling project To begin with, you need to do a lot of initial create. First, make a UML task and model. Steps
Building a UML building project is incredibly easy: Imagine with Logical Software Recorded Copyright IBM Firm 2006. Most rights appropriated. Trademarks Page 2 of twenty-two ibm. com/developerWorks developerWorks 1 ) 2 . several. 4. 5. 6. six. Open Rational Software Builder. Open the Modeling perspective by selecting Open up Perspective >, Modeling through the Window menu. Make sure your entire open tasks are shut down. Select New >, Project, from the Document menu. Guarantee the Show All Wizards box is usually checked. Expand the Building folder. Choose UML Project. Figure 1 ) The New Project window 8. 9. Just click Next.
Identity your project DWorksPatternProject. Figure installment payments on your UML Building Project windows Visualize with Rational Software Architect Copyright APPLE Corporation 06\. All privileges reserved. Trademarks Page 3 of 22 developerWorks ibm. com/developerWorks 10. Simply click Next. eleven. Fill in the Create a UML project wizard as follows: ¢ Select UML Modeling for the Record types. ¢ Select Bare Model pertaining to the Web templates. ¢ Enter in PatternModel pertaining to the Document name. ¢ Leave the rest of the defaults. The wizard will need to look like this kind of: Figure 3. Create UML Model home window Visualize with Rational Software program Architect Copyright APPLE Corporation 2006.
All rights reserved. Logos Page four of 22 ibm. com/developerWorks developerWorks 12. Just click Finish. 13. The Version Explorer watch contains the UML Task, DWorksDesignPattern along with your blank UML model, PatternModel. emx. Physique 4. Current Model Manager view Visualize with Rational Software Recorded Copyright IBM Firm 2006. Most rights set aside. Trademarks Page 5 of twenty-two developerWorks ibm. com/developerWorks Find, wasn’t that simple? Now, on to the more thrilling part of the training. Let’s build the model using RSA’s user-friendly image tools. Section 3. Style a design and style pattern
Now you must to select a design routine, apply that design routine to a version, observe every relationships of the pattern, and add attributes and operations towards the model. Design and style patterns in RSA Rational Software You comes packed with support for all of the Team of Four style patterns. There is also the ability to importance and build your own design and style patterns. Pick a design style 1 . installment payments on your Select Demonstrate View >, Other, from your Window menu. Expand the Modeling folder and select Routine Explorer. Number 5. Select Pattern Manager Visualize with Rational Software Architect Copyright APPLE Corporation 06\.
All privileges reserved. Trademarks Page six of 22 ibm. com/developerWorks developerWorks 3. some. 5. Just click OK. In the Pattern Manager view, increase Design Habits >, Behavioral. Select the Observer pattern. Figure 6. The Observer Design Pattern Visualize with Rational Software Builder Copyright laws IBM Corporation 2006. Most rights arranged. Trademarks Page 7 of 22 developerWorks ibm. com/developerWorks 6. 7. 8. To learn regarding the design, toggle involving the Overview and Short Explanation tabs at the bottom of the Style Explorer watch. In the Style Explorer look at, drag-and-drop Viewer onto DesignPattern’s blank picture.
The publisher should contain an instance with the Observer Style Pattern that looks like this kind of: Figure several. Observer Design Instance Imagine with Logical Software Builder Copyright laws IBM Corporation 2006. Every rights arranged. Trademarks Page 8 of twenty-two ibm. com/developerWorks developerWorks Apply a design and style pattern 1 ) In DesignPattern’s editor, float over ConcreteObserver and select Enter into argument name/value,. Figure 8. Enter debate 2 . Term the variable Shopper, then simply press Enter. The Viewer instance has a cement observer named Shopper. Let’s add a unbekannte using a different approach.
From your Palette (right of diagram), click to expand the Class Diagram section. Figure 9. Palette three or more. Visualize with Rational Software program Architect Copyright IBM Corporation 06\. All rights reserved. Logos Page being unfaithful of 22 developerWorks ibm. com/developerWorks 4. a few. 6. Choose Class and click anywhere in the plan (do not click on the Observer instance). Brand the recently created course Order and press Get into. Drag-and-drop Purchase onto ConcreteSubject in the Viewer instance. Physique 10. Drag-and-drop ConcreteSubject Imagine with Rational Software Architect Copyright IBM Corporation 2006.
Almost all rights reserved. Trademarks Web page 10 of twenty-two ibm. com/developerWorks developerWorks six. Your diagram should seem similar to this (you might not discover all of the relationships, you’ll resolve that over the following section). Physique 11. Observer instance Observe the design routine relationships 1 . Right-click about any element in the DesignPattern diagram. Visualize with Logical Software You Copyright laws IBM Company 2006. Every rights reserved. Trademarks Page 11 of 22 developerWorks apple. com/developerWorks installment payments on your Select Filters >, Display Related Elements, from the circumstance menu.
Physique 12. Demonstrate relationships several. Select Display All Human relationships from the Custom Query list. Figure 13. Show/Hide Interactions Visualize with Rational Software Architect Copyright APPLE Corporation 2006. All privileges reserved. Trademarks Page doze of 22 ibm. com/developerWorks developerWorks Visualize with Rational Software Architect Copyright IBM Corporation 06\. All privileges reserved. Logos Page 13 of 22 developerWorks ibm. com/developerWorks 4. your five. Click ALRIGHT You can see all the elements and relationships displayed in this version: Figure 13. Observer style 6.
You are ready to then add elements on your blank Observer design pattern model. Add methods and attributes to a model Visualize with Rational Software Recorded Copyright laws IBM Company 2006. Almost all rights arranged. Trademarks Webpage 14 of twenty-two ibm. com/developerWorks developerWorks 1 . 2 . In the PatternModel editor, right-click the Order concrete floor subject. Select Add UML >, feature. Figure 15. Add characteristic 3. some. 5. six. 7. eight. 9. Type -orderNum: Thread (the “-” makes the characteristic private). Press Enter. Replicate the same ways on Shopper, nevertheless name the attribute -custID: String.
Inside the PatternModel manager, right-click the consumer concrete subject. Select Put UML >, operation. Type +makeOrder() (the “+” makes the operation public). PatternModel’s publisher should right now look like this: Figure of sixteen. Observer design Visualize with Rational Software Architect Copyright APPLE Corporation 06\. All rights reserved. Logos Page 15 of 22 developerWorks ibm. com/developerWorks Good operate! You have finished your model (a quite simple model) and may use Logical Software Architect’s tools to remodel this model into actual code. Section 5. Transform the model in to Java code
Now that you have a completed version within your UML project, you will transform that model to actual code. Rational Computer software Architect helps the Visualize with Realistic Software Builder Copyright laws IBM Firm 2006. All rights appropriated. Trademarks Site 16 of 22 ibm. com/developerWorks developerWorks following model-to-code conversions out of the field: ¢ UML ->, Java ¢ UML ->, EJB ¢ UML ->, XSD ¢ UML ->, CORBA ¢ UML ->, C++ However , if you want more options, you will find built-in equipment and wizards that let you create customized transformations in Rational Software program Architect.
You are going to transform your existing style into Java. Transform a UML model to Java code 1 ) In the Version Explorer view, expand DWorksPatternProject. Figure 18. Expanded project 2 . several. In the Unit Explorer watch, select both equally Order and Shopper. Right-click on both of the selected objects and choose Transform >, Run Alteration >, UML , Java. Figure 18. Run alteration Visualize with Rational Software Architect Copyright APPLE Corporation 06\. All rights reserved. Logos Page seventeen of 22 developerWorks ibm. com/developerWorks 4.
In the Run this kind of Transformation windows, click Make new Goal Container,. Physique 19. Modification window Visualize with Logical Software Recorded Copyright laws IBM Firm 2006. All rights set aside. Trademarks Page 18 of twenty-two ibm. com/developerWorks developerWorks a few. In the New Java Project window, term the task DWorksTransformedJava. Figure 20. New Java job Visualize with Rational Computer software Architect Copyright IBM Corporation 06\. All rights reserved. Art logos Page 19 of 22 developerWorks ibm. com/developerWorks 6. 7. Click Complete.
Now that you are back in the Run this Transformation windowpane, click Operate. RSA converts the version into Java source code. The Style Explorer view should include this Java project: Number 21. Converted Java project 8. Double-click Order. java to see the changed code. The code should look like this kind of: Figure 22. Transformed Order class Imagine with Realistic Software Builder Copyright IBM Firm 2006. Every rights arranged. Trademarks Webpage 20 of twenty-two ibm. com/developerWorks developerWorks Make an effort running a distinct transformation via UML-to-C++ and explore the results. Section 5. Summary Congratulations!
From this tutorial, you covered the creation of a UML task and unit, selecting and applying a design pattern to a version, adding and editing qualities and operations to a version, and transforming that version into actual code. You did all of this without even publishing a distinctive line of code! You can actually see (even with this kind of simple tutorial) how visual UML building tools easily simplify code advancement. At this point, you should explore a number of the links inside the Resources part of this training. Visualize with Rational Software program Architect Copyright APPLE Corporation 06\. All legal rights reserved. Art logos Page 21 of 22 developerWorks ibm. om/developerWorks Resources Master ¢ Visit the developerWorks Logical zone to expand your Rational skills. ¢ “Exposing Design flaws in your code: Part 1, (developerWorks, September 2005) particulars the visible tools offered to run inside code testimonials in Realistic Software You. ¢ inch Visualize with Rational Software Developer” (developerWorks, February 2006) details the visualization capabilities of Logical Application Programmer. ¢ “Discover IBM Logical visual equipment for program development” (developerWorks, February 2006) covers all the different aesthetic tools accessible in the Logical Software Creation Platform. Keep up on, be in the know, keep up to date, be well-informed with developerWorks technical occasions and webcasts. Get products and technologies ¢ Download a no cost trial version of Rational Application Architect. ¢ Build your next development project with APPLE trial software, available for down load directly from developerWorks. Discuss ¢ Participate in developerWorks blogs and get involved in the developerWorks community. About the writer Eric Extended Eric Extended is a Software program Engineer in the IBM Designer Skills Plan. Eric managed to graduate from The University or college of Texas with a level in Laptop Science.
He joined IBM in July of 2004 and currently works in austin tx, Texas. As a Software Professional, he delivers technical data to programmers on open source and industry trends and technologies through speaking engagements, web content, and faculty consultations in IBM Academics Initiative affiliate universities. His work also contains technical training, demos, articles, and lessons available at http://www. ibm. com/university and http://www. ibm. com/developerworks. Visualize with Rational Software Architect Copyright APPLE Corporation 2006. All privileges reserved. Trademarks Page 22 of 22