`

UML Modeling for Java with Rhapsody

阅读更多

UML Modeling for Java with Rhapsody

by Peter Varhol
01/25/2001

While there are sophisticated development environments and tools for building Java applications, including some good visual tools (IBM's VisualAge comes to mind), most of them are geared toward specific tasks in the development process, usually writing code. For most Java developers, there's no inherent connection between designing software systems and writing code.

<!----><!----><script language="JavaScript" type="text/javascript"> //<!----><\/script>'); //]]> </script><script language="JavaScript" src="http://ad.doubleclick.net/adj/ttm.onjava/jdart;sz=336x280;tile=3;ord=3920778244742149?" type="text/javascript"></script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </script><iframe name="google_ads_frame" marginwidth="0" marginheight="0" src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-3431100313772407&amp;amp;dt=1184272131734&amp;amp;lmt=1184264314&amp;amp;format=336x280_as&amp;amp;output=html&amp;amp;correlator=1184272131734&amp;amp;channel=7606148911&amp;amp;url=http%3A%2F%2Fwww.onjava.com%2Fpub%2Fa%2Fonjava%2F2001%2F01%2F25%2Fuml_rhapsody.html&amp;amp;color_bg=EFEFEF&amp;amp;color_text=000000&amp;amp;color_link=000000&amp;amp;color_url=0000CC&amp;amp;color_border=006666&amp;amp;ad_type=text&amp;amp;cc=100&amp;amp;flash=9&amp;amp;u_h=800&amp;amp;u_w=1280&amp;amp;u_ah=770&amp;amp;u_aw=1280&amp;amp;u_cd=32&amp;amp;u_tz=120&amp;amp;u_his=1&amp;amp;u_java=true" frameborder="0" width="336" scrolling="no" height="280" allowtransparency="allowtransparency"></iframe><noscript></noscript><!---->

I-Logix's Rhapsody changes the developer's point of view from writing code, or assembling software components, to modeling the system to be built. The design methodology it incorporates is the Unified Modeling Language (UML). UML is based on OMT, Booch, OOSE, and other earlier modeling techniques that by themselves only modeled a single aspect of the system. UML diagrams are able to represent unambiguously all aspects of the system being built.

Rhapsody is unique in that it builds Java applications visually but not in the same sense as VisualAge or Visual Café. Instead it uses a type of visual programming that translates detailed, formal graphical models based on UML directly into Java code.

UML provides a combination of visual modeling techniques that unambiguously describe a software system. These views describe the system's architecture, behavior, and component collaboration. Once these views are created, you can generate high-level code or executables that correctly reflect the software design.

UML defines a number of views that provide different perspectives of the system under development. Each view shows a different aspect of the full software model, and each is necessarily incomplete. Think of it like three dimensional photography. To get a complete picture of a car, for example, you have to photograph it from a number of different angles and perspectives. UML offers a total of nine views of a model, including class diagrams, Statecharts, use-case diagrams, and sequence charts. Not all are needed to represent unambiguously every software system, often three or four are sufficient.

UML and Rhapsody

Rhapsody in J (I-Logix offers implementations of Rhapsody for generating Java, C++, C, and Ada) provides more than just an environment for developing Java code. It's a visual design environment that enforces a comprehensive methodology for building formally correct system models. Like most UML design tools, it lets you build formal models that prevent ambiguities and illogicalities. Unlike others, it takes those designs and creates Java code that implements the UML design.

Compiling a UML model into Java code works in two parts. First, Rhapsody checks the model's syntax and to a certain extent its semantics. This is possible because the model should be logically consistent; the editor doesn't allow things that are illegal in the modeling language. It can also do some checking for internal consistency, primarily to make sure that the model as represented by one diagram coheres with any related diagrams.

Once the model is verified, the next step is to produce Java code. This works through a mapping between UML constructs and Java classes derived from the Java class library. What results from this process is a software implementation that uses the standard Java object model.

Rhapsody includes an editor for four different diagram types: sequence, object model, use case, and statecharts. Rhapsody diagrams are combined into one model, ensuring consistency across the different views. You can inspect the entire model or automatically review it for consistency and syntactical accuracy.

Rhapsody screen shot.

Figure 1. Use cases are a structured way of describing the behavior of an embedded system. (Click for full-size view)

A good place to begin a Rhapsody design with UML is with use cases (see Figure 1 for an example). As the name implies, a use case is a structured way of describing the desired behavior of a system. Think of a use case as an entire class of examples. Individual variations of the class are called scenarios. Scenarios may help users accurately describe the requirements of the system, but they're not necessary to the design process.

A statechart joins behavior to architecture, very similar to an old-fashioned state transition diagram. Statecharts have additional structure and constraints so that they unambiguously define the movement from one state to the next. Anyone who has worked with state transition diagrams or even finite state machines will grasp the statecharts quickly (Figure 2).

Rhapsody screen shot.

Figure 2. A statechart is very similar to an old-fashioned state transition diagram. (Click for full-size view)

Object modeling diagrams join architecture to collaboration. They have an architectural aspect because your code will likely be built along the lines indicated by the objects you define, even if you don't use code generation or object-oriented programming languages. And they have a collaborative aspect because properly designed objects are intended to pass messages to one another. Sequence diagrams illustrate the way different components of a system collaborate. They show the flow of data and control between different aspects of the system as the application executes.

Using these four for moderately simple (but not trivial) applications will probably take a novice from three to four days, most of which will be spent learning UML and the software. Once you've gained experience, you can expect your productivity over manual coding to improve by about fifty percent. For those who want to incorporate existing Java code, or rewrite some of the generated code manually, Rhapsody in J can encapsulate changes to the code, incorporate them back into the model, thus keeping the model and code synchronized.

If you need to pursue system views beyond these four, you must look elsewhere for tools, possibly committing to the entire Rational Unified Process. Using all nine UML views is probably most appropriate for complex and highly interactive software systems. But Rhapsody in J lets software designers use UML as a higher level of abstraction for developing Java code without the overhead of full UML.

Many modeling tools generate code. The value of Rhapsody is its use of a widely accepted, formal modeling language as the basis for design, and in a unique ability to incorporate code written by hand into the model. Software developers actually get to be software designers, while delegating the implementation to an automated process. The model also serves as excellent documentation of the implemented system.

Computer science educators (a job I once did) perennially espouse the virtues of designing software over coding, yet in many cases in real life designing takes a back seat to getting the application out the door. Modeling tools such as I-Logix Rhapsody force developers to do just what they should be doing. And in so doing, it removes the potential for errors in translating designs into actual code.

I-Logix markets Rhapsody in J to embedded systems developers, who have embraced both Java and UML more completely that general-purpose application developers. However, developers who are interested in spending most of their time designing software rather than writing code will benefit from the Rhapsody approach.

分享到:
评论

相关推荐

    java modeling in color with uml chapter3.PDF

    Java Modeling in Color with UML--printed in color--provides four UML "archetypes" for common entities in business modeling. These have rather abstract names like the moment-interval. Each archetype is...

    Java Modeling in Color with UML

    《Java Modeling in Color with UML》是一本深入探讨在Java开发中如何利用统一建模语言(UML)进行系统设计的书籍。UML作为一种强大的可视化建模工具,它能够帮助开发者清晰地表达软件系统的结构、行为和关系。本书...

    UML for Java Programmers中文版

    根据提供的文件信息,本文将围绕“UML for Java Programmers中文版”这一主题展开,深入探讨UML在Java编程中的应用及其重要性。 ### UML简介 统一建模语言(Unified Modeling Language,简称UML)是一种图形化表示...

    Java modeling in color with UML

    标题《Java modeling in color with UML》和描述表明了本书是一本关于使用颜色和统一建模语言(UML)进行Java建模的专业书籍。它强调了颜色在建模过程中的重要性,并由权威人士Peter Coad撰写。书中的核心概念是...

    UML Modeling with Visio

    UML Modeling with Visio is a zip file which cantained two parts of a series article introducing how to use Visio, it is one of best document to learn UML with Visio for newer.

    UML for Java Programmers

    ### UML for Java Programmers — 关键知识点解析 #### 一、UML概述 - **UML (Unified Modeling Language)** 是一种标准化的图形语言,用于软件系统的可视化建模。它帮助开发者理解系统的需求、设计、实现和测试...

    UML for Web Modeling

    Modeling Web Application Architectures with UML

    UML for Business Modeling

    Business Modeling with the UML and Rational Suite AnalystStudio ------------------------------------------------------ A Rational Software White Paper

    modeling_with_uml

    面向对象分析和设计以及统一过程是软件工程领域的重要概念,而UML(统一建模语言)作为其可视化建模的重要工具,已经在业界广泛应用。本篇文档介绍了如何使用Enterprise Architect这一UML建模工具进行面向对象的软件...

    UML FOR JAVA

    《UML for Java》这本书由Robert Cecil Martin撰写,是针对Java程序员学习统一建模语言(Unified Modeling Language,简称UML)的一本指南。UML是一种用于软件工程的标准建模语言,它提供了一套图形化的符号系统,...

    UML for Java Programmers中文版.pdf

    ### UML for Java Programmers知识点总结 #### 一、UML概述 - **UML** (Unified Modeling Language) 是一种标准化的图形表示方法,用于软件系统的建模。 - **类图**(Class Diagram): 描述系统中的类以及它们之间的...

    UML 2 for Dummies

    •Uses friendly, easy-to-understand For Dummies style to help readers learn to model systems with the latest version of UML, the modeling language used by companies throughout the world to develop ...

    Modeling with UML

    Slides on Modeling systems with UML.

Global site tag (gtag.js) - Google Analytics