Sunteți pe pagina 1din 23

Unified Modeling Language (UML)

A different way to design your applications

Bill Parrott
Web Development & Interface Design
Information Technology | University of Kansas
November 2010 Web Developers Meeting
What is UML?
•  According to Wikipedia:
•  “The Unified Modeling Language (UML) is used to specify,
visualize, modify, construct and document the artifacts of
an object-oriented software-intensive system under
development.”

Say what?
•  UML is a tool for designing the pieces of an application
using a standard set of visual diagrams as well as
mapping the relationships between the various pieces.
A few notes
•  UML is very robust.

•  We will be discussing a small subset of UML’s


functionality.

•  I am *not* an expert on UML.

•  I will be going over my experience with UML and how I


have used it.
How I have used UML
•  Structural (Static) Diagrams
•  Emphasize the underlying structure of an application
•  Consist of classes, objects, relationships, etc.

•  Database schema structure


•  Not technically UML, but similar in nature
•  Describing tables, indexes, foreign keys, etc.
A basic example
A real world example
•  The current state of the class design and relationships for
an application currently in development.
•  This is much more complex than the previous example,
but is generally the same type of information.
A real world example
•  The current state of the class design and relationships for
an application currently in development.
•  This is much more complex than the previous example,
but is generally the same type of information.

That’s a lot of lines and boxes…


•  Each box in the diagram represents a class in the
application.
•  Each line represents a particular type of link between two
classes.
CLASS DESIGN USING UML
Types of links
•  Associations
•  Aggregation: “has-a”
•  Composition: “owns-a”

•  Relationships
•  Generalization: “extends”
•  Realization: “implements”

•  Dependency
Associations
•  Aggregation: “has-a”
•  Denoted by a solid line with a hollow diamond at one end.
•  Composition: “owns-a”
•  Denoted by a solid line with a solid diamond at one end.
Relationships
•  Generalization: “extends”
•  Denoted by a solid line with a hollow arrow point on one end.
•  Realization: “implements”
•  Denoted by a dashed line with a hollow arrow point on one end.
Dependency
•  The most generic form of link between two classes.
•  Represents a relationship in which one class uses or
requires another class at some point.
•  Denoted by a dashed line with a pointer on one end.
DATABASE SCHEMA DESIGN USING
THE SAME PRINCIPLES
Using an ERD is (to me) conceptually similar to using
UML.
Designing your database schema
•  The same concepts as with class design apply.
•  Each table should contain one type of “object” (e.g. Students,
Faculty, Courses, Departments, etc.)
•  Refactoring your table structure is easier in the design phase than
it is during development.

•  Example
•  A version of the database schema design for the new KU Calendar
website (currently in development).
WRAPPING UP
Why may UML be better?
•  Helps reinforce good design practices.
•  You can spot overly complex code in the making, before you have
written it.
•  Forces you to think about your application as a whole, but also
focus on the details of each piece individually.

•  Easier to visualize your application design


•  Enables you to spot poor design choices before you have written
any code, which makes it easier to…
Why may UML be better?
•  Refactor before you write any code
•  The application you saw before has been refactored twice since the
design process began.
•  Simplifying the components of your application makes it easier to…

•  Write better unit tests.


•  It is easier to simplify classes in your UML than after you have
written the code. Simpler classes are easier to test.
Tools for designing with UML
•  ArgoUML
•  Platform independent (runs on Java)
•  Open source (free)
•  http://argouml.tigris.org/
•  Gliffy (Free/Premium)
•  Free & premium options
•  http://www.gliffy.com/uml-software/
•  Visual Paradigm
•  Free/Community & paid options
•  http://www.visual-paradigm.com/product/vpuml/
•  Microsoft Visio
•  Not free, but KU gets a discount.
Resources for learning UML
•  Wikipedia
•  Useful information to give a general overview of what makes up the
Unified Modeling Language.

•  Practical UML for Developers


•  A good overview on practical uses for UML.

•  SourceMaking.com
•  Essentially a small online book with lots of info and examples.

•  UML tutorial
•  A bit older (ca. 2001), but still good information.
Questions?
•  Ask here, on the web developers’ forum, or by email.

•  Web Developers’ forum:


•  http://webdevelopers.ku.edu/

•  My email:
•  bparrott@ku.edu
Thank you.

S-ar putea să vă placă și