Thursday, February 8, 2007

2/1 - Review of OOP & Intro to UML + extra credit opp.

Review of the key concepts of object-oriented programming

1) Abstraction - refine away unnecessary details

2) Encapsulation - data and representations are combined in a single entity, an object (user-defined type)

3) Inheritance - create specialized objects from simpler objects (inherit dat and operations from parent and add specific data and operations)

4) Polymorphism - ability to dynamically interchange modules without affecting clients




UML

UML (Unified Modeling Language) is a set of simple graphical notations for describing object-oriented models

+ it's actual uses can from a conceptual tool to a rigorous blueprint
+ goal if UML is independent of the implementation language


9 types of UML diagrams

> use-case diagrams
> class
> object
> sequence
> collaboration
> state chart
> activity
> component
> deployment


Use Cases

A use case is a textual description of major activities that take place in a system.

+ usually 1-2 paragraph description of what a user does
+ unlikely to have thousands
+ example: a 3 year, $30 mill. project for United Airways had 29 use cases

Example use case: "A patient calls the client to schedule an appointment for a yearly checkup. The receptionist finds the earliest available slot in the schedules the appointment for that time slot."

a use case should consider:

main flows - what happens if everything is ok
alternate flows - what happens in special circumstances


Use Case Diagrams



A use case diagram describes what the system does, not how.

+ In the above example, the patient is an actor, a line represents communcation
+ Note that a use case may involve multiple actors or nonhuman actors.
+ Note that an actor represents a role, NOT a specific user or individual.


Image: An example use case diagram








Class Diagrams



Martin Fowler describes three levels of class diagrams:

1) conceptual
+ a way to represent entities in the system
+ very helpful in the conceptual phase of development
+ there may be very little connection between these high level entities and the classes you'll end up writing

2) specification
+ defines what software must do, the information it must hold and the behavior it must exhibit

3) implementation
+ every single painful detail of classes (e.g. access control, return types, etc.)
+ these are a little bit too much for Fowler and Professor Bistriceanu


Fowler's Maxim: "don't be dogmatic" (use whatever level of detail you find useful to the particular project).

modeling relationships

association - If one class must know about an instance of another class to perform its function, then there is an association between the two classes.

aggregation - An association in which one class belongs to a collection

generalization - An inheritance link indicating one class is the parent (i.e. superclass) of the other.

navigability
- Indicates the direction in which an association can be traversed or queried.

multiplicity - Number of possible occurences.


Image: An example class diagram












Extra Credit Opportunities




1) class notes
+ readable
+ commitment to attend all classes
+ make copies for instructor every week

2) special assignment
+ bring w/ for final and attach to your work
+ up to 10-20% boost of final grade

3) class participation
+ helps settle borderline situations

4) submit a problem or more to be included on the midterm or final
+ criteria: non-trival & original

No comments: