|
Building a UML Domain Model - Part 3
In this series we have been following a simple process for building the domain model of our small hotel reservation domain:
We have almost completed Step 1, and we have identified the following "real" classes:
Reservation We need to perform one more sub-step before moving to Steps 2 through 4, which will let us actually build our domain class diagram, presenting our classes and their relationships. Step 1c. Describe Your Class Responsibilities Whenever I discover a "real" class - that is, a class that has passed the four challenge questions (in Part 2 of this series) - I focus immediately on identifying the class's responsibilities. A class's responsibilities are its job description, its mission statement, its reason for existing as a concept within your business domain, and as a class in your system definition. Here is how I layout my classes and their responsibilities:
The second column in this table describes the business concept that the class represents in the business domain. This description is an entry from, or for, your business glossary. The third column states the responsibilities of the class: i.e., what it knows, and what it does. In your modeling your classes should never have overlapping, or identical, responsibilities. Each class's responsibilities should be totally disjoint so you are never confronted with two or more classes that know or do the same things. Now that we have identified our classes and characterized their responsibilities, we can move on to building our class diagram. Step 2: Identify which of these classes have knowledge of, or relationship with, any of the other domain classes Which classes in our domain should know about each other? The first pair that might come to mind are: Customer "places" Reservation. But the Customer class is not the human customer, and the Customer class does not place a reservation. The Customer class represents the information about a human customer. But there is a relationship between Customer and Reservation, and I will express that as: Reservation "is for" Customer. Note that this relationship becomes apparent when you start with the classname Reservation, rather than starting with Customer. Sometimes thinking "backwards" is a very powerful modeling practice. There is certainly a relationship between CreditCardPayment and the Customer class, and we can represent this as: Customer "is responsible for" CreditCardPayment, since this represents the legal status of responsibility between the Customer (representing the human) and the payment which will be obtained for the reservation. Between CreditCardPayment and Reservation we can identify: CreditCardPayment "pays for" Reservation, since the CreditCardPayment has the responsibility of obtaining the payment from the credit card provider. We can also identify that Bedroom has a relationship to Reservation, since Bedroom is responsible for knowing its reservations, and the definition of a reservation is to reserve a bedroom. So, Reservation "reserves" Bedroom Note what I am trying to achieve with my "captions" on these relationships. I am trying to use words that have meaning from the business domain, not the casual phrases that might first occur to us. Also note that I have not pursued relationships between Customer and Bedroom (since this is mediated by the Reservation), or between CreditCardPayment and Bedroom (since their responsibilities do not align directly, but only indirectly through the Reservation class). Step 3: Identify the semantics (e.g., association, aggregation, etc.) of the relationships between those classes that know about each other UML defines four basic relationships that can be used on a class diagram: association, aggregation, composition, and inheritance (generalization). Association is a peer-to-peer relationship between two classes. Aggregation and composition are both whole-part relationships, where the whole owns, or manages, its parts. Composition extends the semantics of aggregation by adding lifetime-linkage between a whole and its parts. Inheritance is the "is-a-kind-of" relationship that involves superclasses and subclasses. More details on these relationships can be found in the very detailed UML Specifications at www.uml.org, or in a book on UML. In the simple hotel reservation domain we have no inheritance, and no whole-part relationships, either. All of the relationships are association, where a class knows about and uses the services of another class in a peer-to-peer manner. In your business domain you will certainly find a majority of associations, and probably one or more of the other three relationships as well. Step 4: For non-inheritance relationships, identify the multiplicity on these relationships In our simple example we do not have any inheritance relationships. Discussing the subtleties of modeling inheritance will be part of another newsletter. But we must place multiplicity on all of the association relationships. UML multiplicity identifies "How many objects of that class are related to one object of this class?" UML defines five multiplicities:
1: which means "one and only one" The fifth form of multiplicity is called numerically specified and allows you to specify formulas (e.g., 2n, n=1,2,...) or discontiguous values (e.g., 1,4..5,12). Now we can put all of these decisions together to build the domain class diagram for our example:
Note that our diagram does not contain attributes (data members) or operations (methods) for the classes. Discovering those requires that we explore UML behavioral diagrams such as the Sequence diagram, or State Machine diagram. That may be a topic in a future newsletter. Concluding I hope this series has given you some ideas about how to build a UML class diagram for your business domain. I have not attempted to be exhaustive, but whether your domain has only four classes, or forty, this same, simple process can help you attain this goal effectively and efficiently. Have a productive month, Gary K. Evans |
Subscribe to our newsletter! Send an email to You will find all prior About Evanetics Evanetics provides on-site consulting, training, and assessments for teams and management in Business Analysis, Object-Oriented Modeling, Project Definition, Iterative process, RUP, Agile principles and practices. Phone: 803-781-7628 IIBA Updates Evanetics is an Endorsed Education Provider (EEP) for the International Institute of Business Analysis (IIBA).
We are proud to announce that two new Evanetics courses have received endorsement from the IIBA for compliance with the new version 2 of the Business Analysis Body Of Knowledge (BABOK). Business System Analysis for Object-Oriented Projects covers how to capture business concepts and specify system requirements using the Unified Modeling Language diagrams most profitable for a Business Analyst or Business System Analyst. Use Cases for the Rational Unified Process provides a concise approach for writing effective, useful use cases for groups following, or planning to use, the Rational Unified Process. This course is based on the latest version of the Unified Process, version 7. Job Preparation As a consultant I am always unemployed. Or, to put that in a more positive light: I am always looking for a job. But it wasn't always this way. I was a corporate employee for 15 years when a 1993 layoff put almost 40 of us on the street. The shock was seismic, and I hope you or your loved ones never have that experience. But I learned through this the value of being prepared for the worst. I recently read two books just off the presses that can be excellent preparation for you. Land the Tech Job You Love, Andy Lester.
Lester's book covers all of the basics of job search. What I especially like about this book is that Lester starts with personal introspection in Chapter 2: What Do You Want in a Job? My own experience is that most people define themselves in terms of their current (or last) job title, not the skillset they bring to a new job. Lester deftly addresses many of these "soft" issues in job selection. He discusses resume writing and the three versions you should produce, and he devotes several chapters to the Job Interview and how to sell yourself face-to-face. You might find one of the most valuable pages of the book is his Meaningless Cliches to Avoid, for example the ubiquitous use of "self-starter" in a resume. This book is not specific to the IT or computer industry, but everything in it applies to our world as well. There is some excellent advise inside this book, and if you have not been on the job market in the past 10 years (or more) you can profit from everything Lester offers. Guerrilla Marketing for Job Hunters 2.0, David E. Perry and Jay Levinson.
This book is for job seekers who are risk-takers, and willing to step outside the typical job-search box. The authors motivate their book with the concept of a campaign, which is a multi-channel, multi-modal approach to delivering your skillset and value to potential employers - even those who are not looking for your skills! Perry and Levinson proudly boast that they are not job-search gurus. They are highly experienced sales and marketing specialists, and this book is all about marketing YOU! They cover resumes (which they approach as Personal Marketing Material) and how to get the interview, and they share a crucial idea I learned after my layoff: never send your resume to Human Resources! IT people will feel right at home in the chapter on Twenty-First Century Digital Weapons. It is surprisingly complete and fresh, from Google to Facebook and MySpace, and your personal website, as weapons that must work in concert to get you your dream job. |
|||||||||||||||
|
Published by: Evanetics, Inc.13 Stonebriar Road Columbia, SC 29212 803-781-7628 Copyright (C) 2009 Evanetics, Inc. All rights reserved. www.evanetics.com |
||||||||||||||||