P4L3 Object Design

pdf

School

Georgia Institute Of Technology *

*We aren’t endorsed by this school

Course

6310

Subject

Computer Science

Date

Oct 30, 2023

Type

pdf

Pages

11

Report

Uploaded by SuperElkMaster712

OOD Object Design 1. Intermodel consistency 2. From analysis to design 3. System design 4. Abstraction mechanisms 5. Collaboration-based design 1. Intermodel Consistency e Mgy have produced multiple diagrams Must be checked for inter-model consistency Use cases <-> communication or sequence diagrams Statecharts for classes Static model methods <-> statechart events, actions and activities e Statechart data conditions <-> class model attributes What UML elements, used in OOA models do not have direct equivdlents in object-oriented programming languages? Write your answer in the text box: Associations Aggregations Invariants StateCharts
2. From Analysis To Design e Treat the entire system as an object * Implementing associations and invariants is key e Andlysis classes > design classes++ 3. System Design e Architecture Concurrency Physical design Data stores Control \ e Error handing 4. Abstraction Mechanisms: The Vocabulary of Design Mechanism Example Cliches / idioms while (*t) {*s++=*t++;} *s="'\0"; Classes hashtable |Patterns visitor IAspects logging IFrameworks model-view-controller IArchitectural styles client-server
5. Collaboration-Based Design e Also caled role-based design Alternative to strict OOD e User stories Collaboration and role identification » Documentation via sequence or collaboration diagrams e Role abstraction e Synthesis of classes from roles Ob Ject Design Elements of Analysis Model: 1. Methods 2. New classes 3. Generalization 4. Associations 5. Dependencies 6. Implementing control #. Abstract classes, interfaces, types
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
1. Sources for Methods e Methods from Operations: Methods and signals from the analysis class model Methods from dynamic models Actions, activities and events Assign Operations to classes e Other commonly occurring methods - Constructors and destructors; attribute getters and setters; copy constructors; print; selectors, qualification and iterators for collection classes 2. New Classes e Object-oriented development has the property of traceability. e Andlysis classes morph into design classes and then implementation classes e There are other classes that are NOT part of the analysis model
2. New Classes e implement relationships e intermediate results e invent new 3abstract classes 3. Generalization e Inheritance via subclassing e Generalization between two classes means that al instances of the derived class are also instances of the parent class e Inheritance is an implementation technique whereby messages sent to 8 chid may be delegated to 3 parent
Generalization Example e Use sort method o Addressbook class e Organizing monthly \ expense ledger Generalization Advice e Can use subclassing features of OO language in OOD e Add features in subclasses rather than overriding e Make sure that the child \ method obeys two rules H you were implementing generaization between squares and rectangles, would you make Square 3 subclass of Rectangle in which both sides are equal? Or woud you make Rectangle 3 subclass of Square with an additional attribute? Square 3 subclass of Rectangle (both sides equal) (with an additional attribute) O O Rectangle 3 subclass of Square X Either or; it depends
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Implementation Approaches: 1. Inheritance that folows specific rules 2. A single class with flags 3. Hide child data in parent 4. Java interfaces or enums 5. Use State pattern for dynamic inheritance 6. Use Multiple inheritance 4. Implementing Associations e OO programming languages do not directly support associations e Factors to take into account: - Directionality - Cardinality - Access (CRUD) e Invariant maintenance
One-Way Associations e For 1-1 associations, use 8 simple pointer e For 1-n use 3 k vector of pointers Pointers Bar Instance 1 e One directional Object of class Bar Instance 2 » Example: Foo associated with Bar e One-to-one or =) one-to-many, one way navigation Var 1 Var 2; Association 1 7 - N\ \, Methods N Two-Way Associations e Pointers in both directions e Use if accesses outnumber updates e Pointer in one direction e Use if one direction is much more prevalent than e Backward search e Associations as the other objects [ Bar Instance 3 Bar Instance U4 Y
Associations As Objects » A problem arises when you want to loop through all of the links in 8 two-way association e Can be cumbersome and costly Tables For Associations FooObject6 BarObject? FooObject2 BarObject3 Use a collection class FooObject10 BarObject6 (hash table, set, array) : : to hold al pairs of FooObject6 BarObjectl associated objects FooObject6 BarObject3 FooObject? BarObject6 FooObject3 BarObject2 FooObject? BarObject1 Consider the problem of implementing the Takes association between Students and Courses. For each of the folowing 4 options, match it with its major disadvantage. B [ n each Stucent, creste 8 reference that refers A. extra step involved in each query to the Course that student is taking D | I each Couse, creste 8 Vector of references B. 8 student can only take one course to Students A'| Creste 3 Takes association class that contains C. referential integrity maintenance an attribute for Student and Course C | Use symmetric Vectors in Student and Course D. hgsd '(Ot find the Courses taken by ents
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
5. Implementing Dependencies e Most common and most varied relationship e Use an attribute or global object having the type of the target class e Receive arguments of the target class e Make 8 method or constructor cal to the target e Import the target 6. Implementing Control e A class's attribute values comprise its state o Ad hoc: Code specificaly manages event handing and state update on a case-by-case basis * Implement some form of state machine ¥. Abstract Classes Various Mechanisms Available: e Abstract method e Abstract class e Interface
Match each OOA modeling concept with 8 Java concept that might be used for its implementation. D A Generalization Aggregation Invariant State OOD Summary Object-Oriented Analysis goes 3 long way Address how best to deal with UML elements Think through the tradeoffs involved before choosing 3 solution A. Collection Classes B. Methods and Constructors C. Enumerations D. Subclassing

Browse Popular Homework Q&A

Q: A molecule that has absorbed a photon of light in the visible region could move from the lowest…
Q: Salaries of 33 college graduates who took a statistics course in college have a mean, x, of $64,700.…
Q: Hi, could someone help me draw the conjugate acid and conjugate base for this structure? I’m trying…
Q: A mixture of propane and butane is fed into a furnace where it is mixed with air. The furnace…
Q: Black and Shannon have decided to form a partnership. They have agreed that Black is to invest…
Q: Question 14 Consider a Geometric Distribution G(0.0177) What is the expected number of trials before…
Q: Express the confidence interval (0.039,0.123) in the form of p-E<p<p+E. <p< (Type integers or…
Q: Identify each of the following elementary reactions as unimolecular, bimolecular, or termolecular,…
Q: Ammonia vapor is compressed to 50 bar and 110°C. Use the SRK equation of state to determine the…
Q: Use regression to find an exponential equation that best fits the data above. The equation has form…
Q: CH₂CH₂BrH₂C=CHC(Br) CH 3 H₂C=CHBr CH3CH (Br) Q13
Q: and write probabilities using 4 decimal places where possible. If the event has no outcomes type…
Q: Isabella is filing as the head of a household. Her taxable income is $69,014. Use the Tax Table,…
Q: Researchers collected data on the numbers of hospital admissions resulting from motor vehicle…
Q: What would happen to your dissolved penny solution if you add some solid Na2CO3? What would you…
Q: 3) Find all the solutions to 3(1 − cos 0) = 1- cos² 0.
Q: If a pH electrode is experiencing the sodium (alkaline) error... A. the apparent pH will be lower…
Q: 3. Naïve Bayes Models Describe a classification task from your experience and represent it as a…
Q: 14. Use the binary AND operation to determine the network address that the following IP addresses…
Q: Match these values of r with the accompanying scatterplots: -0.994, -1, 0.736, 1, and -0.38. Match…
Q: Actual high temperature 83 71 77 78 73 76 70 78 High temperature forecast one day before 84 73 77 78…
Q: b a C = 60° b C Note: Triangle may not be drawn to scale. Suppose a = 8 Find b and c. 30°