Lecture for Chapter 2, Modeling with UML

Lecture for Chapter 2, Modeling with UML

UML First Pass: Class Diagrams Class Multiplicity 1 2 PushButton state push() release() Association SimpleWatch 1 LCDDisplay blinkIdx blinkSeconds( ) blinkMinutes( ) blinkHours() stopBlinking( ) referesh() 1 1

1 2 1 Battery load() Time now() Attributes Operations Class diagrams represent the structure of the system Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 1 Class Diagrams TariffSchedule Enumeration getZones() Price getPrice(Zone)

* * Trip zone:Zone price:Price Class diagrams represent the structure of the system. Class diagrams are used during requirements analysis to model problem domain concepts during system design to model subsystems and interfaces during object design to model classes. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 2 Classes Name TariffSchedule zone2price getZones() getPrice()

Attributes Operations TariffSchedule Table zone2price Enumeration getZones() Price getPrice(Zone) Signature TariffSchedule A class represent a concept. A class encapsulates state (attributes) and behavior (operations). Each attribute has a type. Each operation has a signature. The class name is the only mandatory information. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 3 Instances tariff_1974:TarifSchedule

zone2price = { {1, .20}, {2, .40}, {3, .60}} An instance represents a phenomenon. The name of an instance is underlined and can contain the class of the instance. The attributes are represented with their values. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 4 Actor vs. Instances What is the difference between an actor and a class and an instance? Actor: An entity outside the system to be modeled, interacting with the system (Pilot)

Class: An abstraction modeling an entity in the problem domain, inside the system to be modeled (Cockpit) Object: A specific instance of a class (Joe, the inspector). Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 5 Associations TarifSchedule Enumeration getZones() Price getPrice(Zone) TripLeg *

* price zone Associations denote relationships between classes. The multiplicity of an association end denotes how many objects the source object can legitimately reference. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 6 1-to-1 and 1-to-Many Associations Country name:String Has-capital 1 1 City name:String 1-to-1 association Polygon

1 * Point x:Integer y:Integer draw() 1-to-many association Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 7 Aggregation An aggregation is a special case of association denoting a consists of hierarchy. The aggregate is the parent class, the components are the children class. Exhaust System 1

Muffler Bernd Bruegge & Allen Dutoit 0..2 Tailpipe Object-Oriented Software Engineering: Conquering Complex and Changing Systems 8 Composition A solid diamond denote composition, a strong form of aggregation where components cannot exist without the aggregate. TicketMachine 3 ZoneButton Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 9 Generalization

Button CancelButton ZoneButton Generalization relationships denote inheritance between classes. The children classes inherit the attributes and operations of the parent class. Generalization simplifies the model by eliminating redundancy. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 10 From Problem Statement to Code Problem Statement A stock exchange lists many companies. Each company is identified by a ticker symbol Class Diagram StockExchange lists *

* Company tickerSymbol Java Code public class StockExchange { public Vector m_Company = new Vector(); }; public class Company { public int m_tickerSymbol; public Vector m_StockExchange = new Vector(); }; Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 11

Recently Viewed Presentations

  • Partner Logo Its About Time  ScheduleMe Outlook AddIn

    Partner Logo Its About Time ScheduleMe Outlook AddIn

    It's About Time - ScheduleMe Outlook Add-In for Office 365 Enables Users to Schedule Meetings Easily with People Outside of Your Organization. OFFICE 365 APP BUILDER PROFILE: ScheduleMe. ScheduleMe is a cloud-based solution that solves the problem of setting up...
  • Features of depositional environments

    Features of depositional environments

    Features of depositional environments ... ripples are symmetrical in shape The inclined surface of the shoreface leaves behind inclined layers of sand The backshore dune field Beaches are often separated from land by a lagoon or bay behind them. This...
  • Pneumatic Power - Weebly

    Pneumatic Power - Weebly

    gas. flowing under pressure to transmit power from one location to another. Gas in a pneumatic system behaves like a spring since it is compressible. Air is most commonly used in pneumatic systems, although some systems use nitrogen. Pure nitrogen...
  • Momentum Conservation

    Momentum Conservation

    This example is from Fox and McDonald The differential equation is first order with initial condition t=0, V=0 and is easy to solve. The hyperbolic tangent approaches unity, as time increases and hence the solution approaches the Toricelli's equation.
  • Nail Gun Safety Bureau of Workers Comp PA

    Nail Gun Safety Bureau of Workers Comp PA

    PPT-085-01. 33. Six Steps to Nail Gun Safety. Encourage reporting and discussion of. injuries and close calls. Reporting helps ensure that employees . get medical attention. It also helps to identify unrecognized job site risks. Injuries and close calls provide...
  • Domain Analysis - West Chester University

    Domain Analysis - West Chester University

    Consider all the object relations Find object relation (place, time, and etc) Identify each object relation via identity value If a single value and its variation (with the value change) are not enough to cover all different object relations between...
  • The Moon is Earths natural satellite. Before, you

    The Moon is Earths natural satellite. Before, you

    The names of the larger surface features on the Moon are in the Latin language, because centuries ago scientists from many different countries used Latin to communicate with one another. Early astronomers thought that the dark areas might be bodies...
  • Legion Runtime System Elliott Slaughter, Sean Treichler, Wonchan

    Legion Runtime System Elliott Slaughter, Sean Treichler, Wonchan

    Cheap, power-efficient. 6GB dedicated memory ~1GB "zero-copy" memory (carved out of system memory) ... Trinity / Cori. Summit. Programming System Goals. High Performance. We must be fast. Performance Portability. Across many kinds of machines and over many generations. Programmability ...