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

  •  3 3.1  2007 by Prentice Hall  3:             Porter

    3 3.1 2007 by Prentice Hall 3: Porter

    Στρατηγικές Πληροφοριακών Συστημάτων για Αντιμετώπιση Ανταγωνιστικών Δυνάμεων Εστίαση σε κόγχη αγοράς Χρησιμοποιήστε πληροφοριακά συστήματα για βοηθήσετε την εστίαση σε ορισμένο τμήμα ...
  • www.npseuronet.eu

    www.npseuronet.eu

    WS3 /1. Synthesis standards and metabolites (UJI, FFULISBOA, MN) List of standards available (inter laboratory exch.) Purchasing from the market (also INMLCF) Synthesis of unavail
  • Bio-Social Methods for a Vitalist Social Science

    Bio-Social Methods for a Vitalist Social Science

    "[Affect] theorists are gripped by the notion that most philosophers and critics in the past … have overvalued the role of reason and rationality in politics, ethics, and aesthetics, with the result that they have given too flat or "unlayered"...
  • Anthropology, Eleventh Edition - Cengage

    Anthropology, Eleventh Edition - Cengage

    The Nature of Fossils Taphonomy Natural and Cultural Burial of the Dead Entirely preserved fossil skeletons dating before the cultural practice of burial about 100,000 years ago are quite rare. The human fossil record from before this period consists primarily...
  • Gender, Control, and Domestic Violence

    Gender, Control, and Domestic Violence

    The three major types (plus one or two) Gender differences and sampling biases. Dramatic Differences Among the Types. Violence severity, frequency, mutuality, and escalation. Health consequences. Relationship consequences. Miscellaneous other major differences. Preview of Policy Implications
  • Database Clustering and Summary Generation

    Database Clustering and Summary Generation

    Heuristic Search . General Search . Algorithms. Domain-specific . Knowledge. augment. The last technology I like to introduce in today's presentation are shared ontologies. Shared ontologies are important to standardize communication, and for gathering information from different information ...
  • Identifying Solid Figures and Finding Their Area

    Identifying Solid Figures and Finding Their Area

    Prism vs Pyramid . Prism: A solid geometric figure whose two end faces are similar, equal, and parallel rectilinear figures, and whose sides are parallelograms.. Pyramid: A polyhedron of which one face is a polygon of any number of sides,...
  • Columbian Exchange - Richmond County School System

    Columbian Exchange - Richmond County School System

    Columbian Exchange AP World History Period 4 1450-1750 ... Animals Plants Microbes Animals The only domesticated animal in Latin America before Europeans arrived, was the Llama. ... Smallpox Deadliest disease that the Europeans brought to the Americas. Central Mexico's population...