If you want to use Visio for Enterprise Architects to quickly design and create enterprise software, this is the book for you.
The integration of Visual Studio .NET Enterprise Architect and Visio for Enterprise Architects is a formidable combination. Visio offers powerful diagramming capabilities, including such things as creating UML models mapping out and generating databases, and aiding the development of distributed systems. Visio's integration with Visual Studio .NET Enterpris, Architect means that C# or Visual Basic .NET code can be generated from UML diagrams, thus giving your projects a significant kick-start, and Visual Studio .NET projects can also be reverse engineered to UML models.
It is this book that will finally help you to realize Visio's time- and labor-saving features, and unleash Visio's power for your enterprise development.
To use this book you must be comfortable with the basic concepts of IJML.
What you will learn from this book:
Diagramming business components in Visio
Generating code from UML models
Reverse engineering Visual Studio .NET projects into UML models,
with or without source code
Documenting projects with UML and Visio
Designing distributed applications with Visio diagrams
Object Role Modeling, and round-trip engineering for database
design
Introduction
What Does This Book Cover?
Who Is This Book For?
What You Need to Use This Book
Conventions
Customer Support
How to Download the Sample Code for the Book
Errata
E-Mail Support
p2p.wrox.com
Chapter 1: Review of UML
What is the Unified Modeling Language?
Why use UML?
A Brief History of UML
End-to-End UML Modeling
UML Essential Notation and Core Concepts
Activity Diagram
Use Case Diagram
Sequence and Collaboration Diagram
Statechart Diagram
Static Structure Diagram
Component Diagram
Deployment Diagram
Fitting the Pieces into the UML Jigsaw
UML Modeling Tools
Process Essentials
(Rational) Unified Process
PUP .NET Developer's Configuration
PUP .NET Plug-in
Microsoft Solutions Framework
A Framework not a Process
Summary
Modeling Summary
Process Summary
Chapter 2: A Tour of Visio
Visio Background
Beginning Visio - A Simple Diagram
The Visio Environment
Shapes
Connectors
~ Common Visio Software Diagrams
Creating COM and OLE Diagrams
Creating Data Flow Diagrams
Creating Enterprise Applications
Windows Interface Diagrams
Windows Form Shape
Creating Database Model Diagrams
Creating a Simple Data Model
Summary
Chapter 3: Diagramming Business Objects
What is a Business Object?
Object Modeling Compared to Data Modeling
Modeling Attributes and Behavior
Building Monolithic Applications
Building Component-Based Applications
Benefits of using Business Objects
Flexibility - Write Once, Reuse Everywhere
Data-Access Flexibility - Write Once, Change Once
Normalizing Application Logic - Write Once, Period!
Where's the Code? - Write It and Find It
Designing Complex Software
Designing a Component-based Application
Business and Data-Access Base Classes
Creating Namespace Packages
Creating an Abstract Data-Access Class
Creating a Class (Static Structure) Diagram
Adding Operations to the Class
The UML Class Properties Dialog
The UML Operation Properties Dialog
Specifying Operation Parameters
Marking an Operation as Abstract
Adding .NET Base Classes to the Model
Adding the SaveDataSet Operation
Creating Concrete Subclasses
Creating a Business Object Base Class
Choosing a .NET Type for Your Business Object Class
Creating the BusinessObject Class
Specifying a Composition Relationship
Adding Overloaded BusinessObject Operations
Adding the GetDataSet Operations
Adding the SaveDataSet Operations
Adding Attributes to the BusinessObject Class
Use Cases for a Simple Library System
Modeling the Check Out Media Use Case
Deriving Classes from Use Cases
Thinking about Data
Creating a Sequence Diagram
Changing the Drawing Page Orientation
Adding Use Case Text to the Sequence Diagram
Adding the Actor and UI Placeholder
Adding Messages Between Objects
Creating Business Object Classes
Adding the Borrower Object to the Sequence Diagram
Adding a Message Call to the Borrower Object
Resizing the Activation Shapes
Retrieving Checked-Out Media
Calculating Fines
Displaying the Borrower Information
Checking Out Media
Tweaking the Sequence Diagram
Summary
Chapter 4: Generating Code from the Visio Model
Overview of Code Generation
Code Generation in Visio
The Employee Class
Adding Fields
Previewing Code
Adding Properties
Adding a Method
Implementing an Interface
Generating Code
Regenerating Code
Checking Errors
Code Generation in Different Languages
Code Templates
Using Templates
Working with Templates
Templates for Specific Entities
Creating New Templates
XML Comments and Code Templates
Enhancing the Model
Mapping Associations
Creating a Collection
Creating an indexer
Creating Events and Delegates
Overriding Methods
Summary
Chapter 5: Reverse Engineering
Why Reverse Engineer?
Reverse Engineering from Source Code
Reverse Engineering QuickStart
Key Features and Limitations of Reverse Engineering
Reverse Engineering Granularity
Semantic Errors
Static Structure Diagrams
Round-trip Engineering
Projects that Don't Compile
Source Code Required
Reverse Engineering Example
Reverse Engineering the ParceITracker Application
Reverse-Engineered Model Structure
Code-to-UML Mapping Examples
Generalization (or Inheritance)
Associations and Attributes
Operations and Properties
Method Bodies
Primitive and Value Types
Reverse Engineering, No Source Code Required
Running the RE.NET Lite Reverse Engineer
Creating a .NET Framework Base Model
RE.NET Lite internals
RE.NET Lite Limitations
Summary
Chapter 6: Documenting the Project
The Typical Software Development Lifecycle
Requirements Development
Architecture or High-Level Design
Detailed Design
Coding/Implementation
Testing/Quality Assurance
Rollout
Support/maintenance
Role of UML and Visio in the Project
UML as Documentation
Requirements Development Documentation
Use Cases
Using Use Cases for Documentation
Architecture Documentation
Using Class Diagrams
Using Activity Diagrams
Using Component Diagrams
Detailed Design Documentation
Using Detailed Class Diagrams
Using Sequence Diagrams
Coding and Implementation Documentation
Requirements Documentation for Coding
Architecture Documents for Coding
Testing and Quality Assurance Documentation
Using Visio Reports throughout the Project
Static Structure Diagram Report
Deployment Diagram Report
Component Report
Summary
Chapter 7: Distributed System Design
Object-Based Distributed Systems in .NET
Distributed Systems and Local Systems
.NET Infrastructure for Distributed Systems
.NET Remoting
ASP.NET Versus .NET Remoting
Preparation Work in Visio
Custom UML Stereotypes for .NET Distributed Systems
Package and Deploy the Bank Application
System Requirements
.NET Remoting Type and Activation Mode
Identify the Elements that Should Go into One Component.
Adding a Detailed Component Diagram
Adding a Bird's-Eye-View Component Diagram
Component Packaging
Map Components to Physical Deployment Nodes
Summary
Chapter 8: Database Modeling with Visio for Enterprise Architects
Design Process Overview
Database Modeling
Object Role Modeling (ORM)
What is ORM?
Elementary Facts
ORM Notation
The Conceptual Schema Design Procedure
Visio Data Projects
Creating the Data Project
Step 2 - Drawing the Fact Types
The Business Rules Window
The Fact Editor
Visio Reporting
Step 3 of the CSDP
Constraints
Steps 4 to 7 of the CSDP
Traveler, TicketPrice, and FrequentFlierMiles
Add Constraint Form
The Add Constraint Editor
Creating the Conceptual, Logical, and Physical Database
Creating the Object Types
Creating the Predicate Types
Building the Logical Model
Generating the Database
Organization of the Data Projects
Refreshing the Model from the Database
Reverse Engineering the Database
Reverse Engineering an ER diagram
The Reverse Engineer Wizard
The Database Properties Window for ER diagrams
Reverse Engineering an ORM Diagram
The Database Properties Window for ORM Diagrams
Summary
Index
A Guide to the Index
To many, Visio for Enterprise Architects appears to be a mysterious diagramming tool. In conjunction with Visual Studio .NET Enterprise Architect it potential seems clear - going from design to code, and back from code to design offers the developer tremendous benefits for rapidly developing applications. Why do we say mysterious'? This is because Visio's range of features can daunt the user, but most importantly, many aspects of its use directly relevant to software developers are frustratingly lacking in explanation.
This book aims to address this problem - here we focus exclusively on Visio's features for developing .NET applications, encompassing:
UML diagrams
Generating code from UML diagrams
Reverse engineering source code into UML diagrams
Database modeling
Along the way, we'll see some more general applications of Visio to the software development lifecycle, and also learn about Visio's idiosyncrasies, which almost every user of Visio will have encountered, and wondered "Is it just me?"
In other words, this book will allow you to finally unmask Visio for Enterprise Architects.
What Does This Book Cover?
Chapter 1 starts us off by reviewing the key UML concepts, the main diagram types, and the role of those diagrams within the software development process. If you're quite new to UML this will serve as a practical introduction that will help you make sense of the rest of the book.
In Chapter 2 we have our first dip into Visio, and have a look around the general Visio environment. Before we hit the main feature of the book, the UML diagrams, we look at other aspects of Visio that aid software development, and make an attempt to familiarize ourselves with Visio, its pages, shapes, and connectors.
In Chapter 3 we cover using Visio for object modeling - defining data access base classes for your .NET applications, defining a business object base class, deriving business classes from use cases, working with abstract and concrete classes, and using sequence diagrams to model the flow of messages between objects. Along the way we'll meet many of Visio's UML diagramming features, setting us up for the next chapter. Visio for Enterprise Architects can generate skeleton source code from an existing UML diagram in CS, Visual Basic .NET, or C++. Moreover, Visio provides further options that give the developer greater control over the implementation of this source code. In Chapter 4 we look at how to generate code from a UML model in Visio, the various options available for generating code, including the use of code templates to specify the structure of the source code generated by Visio. We look at a variety of UML to code mappings, typical of the situations you will encounter in more complex models.
The Visual Studio .NET Enterprise Architect and Visio for Enterprise Architects combination provides a facility for reverse engineering existing CS, VB.NET, or C++.NET source code into a Visio UML static structure model. In Chapter 5 we'll look at this reverse engineering feature and cover why reverse engineering is useful how to reverse engineer .NET source code from within the Visual Studio .NET IDE, explore the structure of a typical reverse-engineered Visio UML model, and look at the code to UML mappings for important constructs such as generalization (inheritance) and association. We finish the chapter by using reflection to reverse engineer .NET assemblies to provide .NET Framework base class models for our UML diagrams.
In Chapter 6, we take a step back from the world of diagramming, generating code, and generating more diagrams from code, and look at the role of Visio and UML in the entire software development lifecycle. In effect, we'll be discussing how we document our work at different stages of a typical development project using Visio and UML - at the end of this chapter you'll take away some deeper insight into using Visio and UML in the course of working on your own projects.
Chapter 7 sees us move on to another area of using Visio to assist with general design issues. Designing a distributed system is an iterative process from requirements analysis to modular breakdown and to packaging and deployment strategies. However, designing a distributed system is different from designing a non-distributed one. In this chapter we look at a .NET Remoting example, a Bank application. We begin with an overview of .NET Remoting, and we see how to decide which classes in our application should be .NET Remoting types, how to decide the activation mode of each .NET remoting type, and how this can be diagrammed in Visio, what code elements should be grouped in a component, how to prepare a component diagram, and how to prepare a deployment diagram.
Chapter 8 moves us on to yet another aspect of Visio directly relevant to the enterprise developer – data modeling. We take a detailed walk through database modeling and Object Role Modeling (ORM), looking at Visio's ORM Source Diagrams and Entity Relationship Source Diagrams. We then see how to generate a database schema from these models, and further tweak the design with reverse engineering of the database into ORM and ER models, and updating the database with our modifications to yield round-trip database engineering.
Who Is This Book For?
This book is for the .NET developer who:
Is comfortable with the basic concepts of UML
Wants to learn how to use Visio for Enterprise Architects effectively
Wants to see how UML and Visio can benefit their projects in general
What You Need to Use This Book
This book is based around the following combination:
Visual Studio .NET Enterprise Architect Edition
Visio for Enterprise Architects
Thus, having access to each is a prerequisite for using this book.
Conventions
We've used a number of different styles of text and layout in this book to help differentiate between different kinds of information. Here are examples of the styles we used and an explanation of what they mean.
Code has several fonts. If it's a word that we're talking about in the text - for example, when discussing a for (...) loop, it's in this font. If it's a block of code that can be typed as a program and run, then it's also in a gray box:
public Employee this[int index]
Sometimes we'll see code in a mixture of styles, like this:
public Employee this[int index]
{
get
{
foreach (Employee em in employees)
{
if (em. ID == index)
return em;
}
return null;
}
}
In cases like this, the code with a white background is code we are already familiar with; the line highlighted in gray is a new addition to the code since we last looked at it.
Advice, hints, and background ins~brmation come in this type of font.
Important pieces of information come in boxes like this.
Bullets appear indented, with each new bullet marked as follows:
Important Words are in a bold type font.
Words that appear on the screen, or in menus like the Open or GIose, are in a similar font to the one you would see on a Windows desktop.
Keys that you press on the keyboard, like Ctrl and Enter, are in italics.
Customer Support
We always value hearing from our readers, and we want to know what you think about this book: what you liked, what you didn't like, and what you think we can do better next time. You can send us your comments, either by returning the reply card in the back of the book, or by e-mail to feedback @ wrox.com. Please be sure to mention the book title in your message.
How to Download the Sample Code for the Book
When you visit the Wrox web site, www.wrox.com, locate the title through our Find a Book facility or by using one of the title lists. Click Download Code on the book's detail page, or on the Download item in the Code column for title lists.
The files that are available for download from our site have been archived using WinZip. When you've saved the archive to a folder on your hard drive, you need to extract the files using a decompression program such as WinZip or PKUnzip. When you extract the files, the code will be extracted into separate folders for each chapter of this book, so ensure your extraction utility is set to use folder names.
Errata
We've made every effort to make sure that there are no errors in the text or in the code. However, no one is perfect and mistakes do occur. If you find an error in one of our books, such as a spelling mistake or a faulty piece of code, we would be very grateful to hear about it. By sending in errata you may save another reader hours of frustration, and, of course, you will be helping us to provide even higher quality information. Simply e-mail the information to support@wrox.com - your information will be checked and, if correct, posted to the errata page for that title, and used in reprints of the book. To find errata on the web site, go to www.wrox.com, and simply locate the title through our Advanced Search or title list. Click the Book Errata link below the cover graphic on the book's detail page.
E-Mail Support
If you wish to query a problem in the book with an expert who knows the book in detail, then e-mail support@wrox.com with the title of the book and the last four numbers of the ISBN in the subject field of the e-mail. A typical e-mail should include the following things:
The title of the book, the last four digits of the ISBN (7957), and the page number of the problem.
Your name, contact information, and the problem in the body of the message.
We need the above details to save your time and ours - we never send unsolicited junk mail. When youbv send an e-mail message, it will go through the following chain of support:
Customer Support - Your message is delivered to our customer support staff, who are the first people to read it. They have files on most frequently asked questions and will answer anything general about the book or the web site immediately.
Editorial - Deeper queries are forwarded to the technical editor responsible for that book. They have experience with the programming language or particular product, and are able to answer detailed technical questions on the subject.
The Authors - Finally, in the unlikely event that the editor cannot answer your problem, they will forward the request to the author. Wrox authors are glad to help support their books. They will e- mail the customer and the editor with their response, and again all readers should benefit.
The Wrox support process can only offer support for issues that are directly pertinent to the content of our published title. Support for questions that fall outside the scope of normal book support is provided via the community lists of our http://p2p.wrox.com/forum.
p2p.wrox.com
For author and peer discussion, join the P2P mailing lists. Our unique system provides programmer to programmerTM contact on mailing lists, forums, and newsgroups, all in addition to our one-to-one e-mail support system. If you post a query to P2P, you can be confident that the many Wrox authors and other industry experts who are present on our mailing lists are examining it. At p2p.wrox.com, you will find a number of different lists that will help you not only while you read this book, but also as you develop your own applications. Particularly appropriate to this book are the vs_dotnet and uml lists.
To subscribe to a mailing list, just follow these steps:
1. Go to http://p2p.wrox.com/.
2, Choose the appropriate category from the left menu bar.
3. Click on the mailing list you wish to join.
4. Follow the instructions to subscribe, and fill in your e-mail address and password.
5. Reply to the confirmation e-mail you receive.
6. Use the subscription manager to join more lists and set your e-mail preferences.
Why This System Offers the Best Support
You can choose to join the mailing lists, or you can receive them as a weekly digest. If you don't have the time (or the facility) to receive the mailing lists, then you can search our online archives. Junk and spam mails are deleted, and your own e-mail address is protected by the Lyris system. Queries about joining or leaving lists, and any other general queries about lists, should be sent to l istsupport @ p2p.wrox.com.