Object-Oriented Modeling
With Class
"Using a Scripting CASE Tool for Rapid
C++ Prototypes"
by
Richard C. Felsinger
RCF Associates,
960 Scottland Dr, Mt Pleasant, SC 29464
Telephone 803-881-3648 (Voice & Fax)
E-mail - Internet 71162.755@compuserve.com
or CompuServe 71162,755
With Class Scripting CASE Tool Developed by
Michael S. Gold
With Class is a scripting CASE (Computer Aided
Software Engineering) tools from MicroGold Software, 311 East 81st Street,
1RE, New York, NY 10028 Telephone 908-722-6438 (voice and fax) CompuServe
71543,1172. On CompuServe find With Class using the IBM Filefinder with
GO IBMFF and entering the filename wclass.zip. With Class is on the Internet
at www.microgold.com and oak.oakland.edu in the SimTel/win3/pgmtools subdirectory
with the file name WCLASS.ZIP. It may be downloaded with an anonymous login
with FTP (File Transfer Protocol).
Custom training courses, rapid O-O models, and
rapid prototypes are available from RCF Associates, a small software consulting
company in Mt Pleasant, SC. It specializes in training and developing object-oriented
and client server systems using object-oriented methodologies (Rumbaugh
OMT, Coad-Yourdon, Booch, Fusion), CASE tools, object-oriented languages
(C++, Delphi, Visual FoxPro, Eiffel, Ada), and Microsoft Windows applications
(Access, Office).
To improve this tutorial your e--mail comments and suggestions on this tutorial are requested to 71162.755@compuserve.com. 10/11/95
(c) Copyright Richard Felsinger 1995 Reproduction authorized for technical review or non-commercial education purposes.
Object-Oriented Modeling With Class
Tutorial Contents
Part I - O-O Modeling with CASE
1 - Introduction to O-O Modeling, Scripting, and C++
2 - Basic O-O Entities and Models in O-O Modeling
4 - Creating Scripts with a Scripting CASE Tool
Part II - Modeling and Programming O-O Entities - Car Simulation System
5 - Modeling the System and Classes in the Object Model
6 - Modeling Operations in the Object Model
7 - Modeling Attributes in the Object Model
8 - Modeling the Association Relationship in the Object Model
9 - Modeling the Aggregation Relationship in the Object Model
10 - Modeling Generalization Specialization in the Object Model
11 - Modeling System Events and Object Interactions in the Dynamic Model
12 - Modeling System and Object States and Transitions in the Dynamic Model
13 - Modeling Operations (Transformations)
in the Functional Model
Part III - Modeling Complex Systems - TV Control System Example
14 - Creating System Level Models - TV Control System
15 - Creating Class Level Models - TV Control System
16 - Creating the Executable Prototype in C++
- TV Control System
Part IV - Creating C++ Code Generation Scripts
17 - Creating Scripts for the Object, Dynamic, and Functional Models
18 - Creating C++ Code Generation Scripts
19 - Creating C++ Scripts to Generate Finite
State Machine Code
Part V - Conclusion and Case Studies
20 - Conclusion with References, Vendor List, and Glossary
Automobile Cruise Control System
Preface for "Object-Oriented Modeling With Class"
Using a Scripting CASE Tool for Rapid C++ Prototypes
by Richard C. Felsinger
"Object-Oriented Modeling With Class" is a tutorial
on how to rapidly create O-O models and C++ prototypes using a scripting
CASE tool like the With Class CASE tool. This tutorial brings together
four important technologies: O-O modeling (diagrams, specifications, reports);
CASE tools to create diagrams, specifications, code; script language consisting
of script variables and script operators to generate custom reports and
C++ code; and the C++ language. We feel that using an O-O methodology like
the Rumbaugh Object Management Technique (OMT) with a scripting CASE tool
is the fastest, most effective way to rapidly model and prototype a system
in C++. After reading and studying this tutorial you should be able to
follow the "O-O Modeling and Prototyping Roadmap" in Chapter
2 to rapidly create a complete O-O model and C++ prototype for a system.
Several complete O-O models and C++ prototypes are provided as case studies.
This tutorial uses the With Class CASE tool from MicroGold
Software which may be downloaded from www.microgold.com and ftp.oak.oakland.edu/SimTel/win3/pgmtools/wclass25.zip.
The download version may be used to create simple diagrams and scripts
presented in this tutorial. Any scripting CASE tools that supports the
Rumbaugh OMT may be used to create simple diagrams and reports presented
in this tutorial. Other scripting CASE tools are listed in the Vendor List
at the end of this tutorial. After completion of this tutorial we strongly
urge you to obtain demo versions of several scripting CASE tools and evaluate
them "side-by-side" for your application.
This tutorial works with four basic things:
- O-O diagrams to visually display model information from various points of view. The primary O-O diagrams are the system diagram, class diagram, state diagram, and object interaction diagram. We created the sample O-O diagrams using the With Class CASE tool. We created drawings and block diagrams using Visio from Shapeware Corp.
- O-O specifications to collect detailed information on each O-O entity and relationships. The primary O-O specifications are for the following: system, class, attribute, operation, object, interaction, state, and transition. We entered the specification information using the With Class CASE tool. Some information, e.g. use cases and detailed relationship information we collected in a Microsoft Word document. We imported all tables into Microsoft Word for formatting.
- O-O scripts to generate custom reports and C++ code. There are table generation scripts, e.g. TABCLASS.SCT to generate tables to imported into a word processor. There are report scripts, e.g. RPTCLASS.SCT that lists specification information for an entity or group of entities, e.g. class specification information. There are C++ code generation scripts to generate C++ class declarations (.h files) and function definitions (.cpp files). All scripts have a solid black line next to them so you can quickly identity the script. We used the With Class CASE tool to create and execute scripts.
- C++ code listings that were generated from the
scripts and compiled. We used Windows compilers Borland C++ 4.5, Microsoft
Visual C++ 2.2, and Symantec C++ 7.2 to compile the C++. All the C++ is
ANSI C++ including exception handling.
This tutorial is aimed at four distinct readers: technical
managers, O-O analyst/designers, C++ programmers, and O-O script writers.
For each of you, there are benefits to reading and studying this tutorial.
We give you the following suggestions on using this tutorial.
Technical Managers - The initial part of the tutorial
(Part 1) provides you an overview of O-O entities, O-O modeling, CASE tools,
and O-O scripts. We encourage you to examine the "O-O Modeling and
Prototyping Roadmap" in Chapter 2 and the complete O-O models and
C++ prototypes in the case studies. We encourage you to update the roadmap
and a case study for your specific project. The questions are "How
do we want to update this roadmap for our project?", "What must
be added or removed from this roadmap for our project?", "Which
case study can we update to provide to new team members as an example of
a complete O-O model and prototype?", "What scripting CASE tool
best serves our needs to create O-O models?" We encourage you to create
O-O models at the system level and the class level. We encourage you to
take the three points of view to create object models, dynamic models,
and functional models. These three points of view are valuable to see various
aspects of the system to create complete O-O models.
O-O Analyst/Designers - The second and third parts
of this tutorial (Part 2 and 3) provide "step by step" instructions
on how to create the various O-O models and specifications. We follow the
"O-O Modeling and Prototyping Roadmap" in Chapter 2. We create
system level and class level models. We create the O-O diagrams and specifications
for the system object model, system dynamic model, system functional model,
object model, dynamic model, and functional model. For every diagram and
specification, there are one or more scripts to generate tables or reports.
You may update these scripts to generate the exact table or report - "doing
it your way". We encourage you to ask the same questions above so
that you may tailor your analysis and design process for your particular
project. We encourage you to follow the roadmap and create complete O-O
models such as shown in the case studies. An important question to you
is "What specific diagrams and specifications and what is the level
of detail do we need for our project?" We tell you how and why to
create the diagrams and specifications. We encourage you to create diagrams
and specifications only to the level of detail required to document
and code your particular application. For C++ projects we encourage you
to enter specification information in C++ form, e.g. int for integer to
fully support C++ code generation. The benefit of following the roadmap
and using a scripting CASE tool is that you can create complete, consistent,
and modifiable diagrams, tables, and reports for your project.
C++ Programmers - The second, third, and fourth
parts of this tutorial (Parts 2, 3, and 4) provide a large number of C++
code generation scripts and C++ code listings. The steps are: a) create
the diagram and specification, b) select and modify the C++ code generation
script to generate the desired C++ data members and function members, c)
generate the C++, d) compile, update, and execute the C++ in your C++ development
environment, e) reverse engineer the compiled C++ back into a class diagram.
Generally a minimum and a maximum C++ code generation script are provided.
You may start with the minimum script and "cut and paste" script
statements from the maximum C++ code generation script. For example, you
may "cut and paste" the equality operator== script statements
into the minimum script if you need an equality operator==. The questions
for you to answer are: "What C++ features do I want to generate?",
"What C++ collection class do I want to use for one to many relationships
- array, CList, COblist, ListImp, etc?" What changes should I make
to the minimum C++ code generation script to generate exactly what I want?".
There is benefit to you to use C++ code generation scripts. You generate
code very quickly. You have great consistency in your code. You can regenerate
code quickly when the O-O model changes. You can reverse engineer your
modified C++ code to visually show your classes.
O-O Script Writers - The second, third, and fourth
parts of this tutorial (Parts 2, 3, and 4) provide a large number of scripts
to generate tables, reports, and C++ code generation. We are using a text
replacement script language. A script consists of literals, script variables
(CLASS_NAME), and operators ([] for begin loop and end loop). The steps
to create a script are a) create the input diagram and specification, b)
manually create the output table, report, or C++ code, c) identify literals
and script variables in the output table, report, or C++ code, d) create
the script consisting of literals, script variables, and script operators.
Chapter 17 contains the meta-model showing the script variables in the
object model, dynamic model, and functional model. It is very useful to
create your own scripts because you can then generate the exact table,
report, and C++ that you desire - "your own way".
We are hopeful that you use the roadmap, a scripting CASE
tool, and custom scripts with your C++ environment to rapidly model and
prototype your systems. Good luck.
Richard C. Felsinger and Staff at RCF Associates,
960 Scottland Dr, Mt Pleasant, SC 29464 Telephone 803-881-3648 (Voice & Fax)
E-mail - Internet 71162.755@compuserve.com or CompuServe 71162,755