Unified Modeling Language (UML)
UML UML provides many different types of diagrams that can be used to document object-oriented designs We will focus on just two diagram types Class Diagrams Sequence Diagrams Class Diagrams show all of the classes in the system and the relationships between them (static) Sequence Diagrams show how objects collaborate in order to implement the functionality of the system (dynamic, runtime)
Class Diagrams - Classes Class Name - attrName1 : type1 + attrName2 : type2 # attrName3 : type3 Attributes - opName1(in param1 : type1, out param2 : type2) : returntype + opName2(inout param3 : type3) # opName3() : returntype Operations - private + public # protected Parameter types: in, out, inout
Class Diagrams - Classes Order - number : string - dateReceived : Date - customer : Customer - lineItems : OrderLine[] + Order(in num : string, in received : Date, in cust : Customer) + ~Order() + GetNumber() : string + GetDateReceived() : Date + GetCustomer() : Customer + AddLineItem(in item : OrderLine) + GetLineItems() : OrderLine[] + GetPrice() : Money + Dispatch() + Close()
Class Diagrams - Associations A line between two classes represents an association or relationship between the classes You can navigate from one class to another only if there is an arrowhead in that direction. The triangle represents inheritance An order belongs to one customer A customer may have any number of orders An order may have any number of order lines An order line belongs to one order An order line has one product A product may be associated with any number of order lines A corporate customer has zero or one employees assigned to them An employee may be assigned to any number of corporate customers
Class Descriptions Class: Order Purpose: Represents an order placed by a customer Attributes - number : string The order's unique number - dateReceived : Date The date on which the order was received Operations + Order(in num : string, in received : Date, in cust : Customer) Constructor for the Order class num: the order's unique number received: the date the order was received cust: the customer that made the order returns: nothing
Sequence Diagrams
Sequence Diagrams
Web Crawler Designs Your web crawler design should include the following UML Class Diagram Class Description for each class UML Sequence Diagram Acceptable Formats RTF HTML PDF Dia Format (Linux drawing program)
Dia Demo