1 / 8

Object-Oriented Design

Object-Oriented Design. Fred Kuhns fredk@cse.wustl.edu Applied Research Laboratory, Department of Computer Science and Engineering, Washington University in St. Louis. The Object Model.

lyndon
Download Presentation

Object-Oriented Design

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Object-Oriented Design Fred Kuhns fredk@cse.wustl.edu Applied Research Laboratory, Department of Computer Science and Engineering, Washington University in St. Louis

  2. The Object Model • Software system are inherently complex: problem domain, development process, maintenance or just clearly articulating the system’s requirements (there eare endless possibilities) • Manage complexity by Decomposing system into smaller, independent components. • Components, in turn, are composed of one or more objects • Abstraction and hierarchy play fundamental roles CS422 – Operating Systems Concepts

  3. Fundamentals: Booch, “OOA&D” • Object-oriented Analysis (OOA) • “Object-oriented analysis is a method of analysis that examines requirements from the perspective of the classes and objects found in the vocabulary” • Object-oriented Design (OOD) • “Object-oriented design is a method of design encompassing the process of object-oriented decomposition and a notation for depicting both logical and physical as well as static and dynamic models of the system under design” • Object-oriented Programming (OOP) • “Object-oriented programming is a method of implementation in which programs are organized as cooperative collections of objects, each of which represents an instance of some class, and whose classes are all members of a hierarchy of classes united via inheritance relationships” CS422 – Operating Systems Concepts

  4. Major elements of the Object Model • Abstraction: essential characteristics of an object, that is its behavior or semantics. Separate behavior from implementation. • Kinds of abstractions: Entity, Action, Virtual machine and Coincidental. • Contract model: interface defines contract between (server) and user (client): it defines the objects responsibilities. • Invariants; for each operation associated with an object may have a set of preconditions (required invariants before invocation) and postconditions (invariants satisfied by operation). Exceptions indicate an invariant is not satisfied. • static and dynamicproperties • may be active or passive. Active objects may use callback mechanism to notify client of an event. CS422 – Operating Systems Concepts

  5. Major elements of the Object Model • Encapsulation • implementation of abstraction • object abstraction should precede implementation decisions. Implementation is not visible external to object and so implementation may change of time with no impact to clients. • separation of concerns: one level of abstraction should not be concerned with another's implementation. • keep implementation a secret • Attempt to localize aspects of an object that may change • Modularity • design partitioned into a set of components with well defined interfaces. • group logically related classes • “Modularity is the property of a system that has been decomposed into a set of cohesive and loosely coupled modules”, G. Booch CS422 – Operating Systems Concepts

  6. Major elements of the Object Model • Hierarchy • “Hierarchy is a ranking or ordering of abstractions”, G. Booch • Class hierarchy define “is-a” relationships (inheritance) • Important to guard against violating encapsulation (Liskov). Control in C++ using public, protected and private • single versus multiple inheritance – see class notes • Containment defines “has-a” relationships. A classes behavior is defined by an other objects. CS422 – Operating Systems Concepts

  7. 3 Stages of Developing Software • Analysis: identify problem to be solved and define scope. • This is a critical step, vague or contradictory requirements are defined then the result in software which will likely not satisfy clients. • Vague requirements must be refined • Assumptions must be stated • Design • decompose system into a set of reasonably independent modules (loosely coupled). Use abstraction, encapsulation and hierarchy to manage complexity • Implementation • clarify class roles and relationships • implementation strategy for selected language • test, verify, simplify • revisit all 3 steps • Each step will likely require experimentation, testing, analysis, documentation and refinements. CS422 – Operating Systems Concepts

  8. Goals and Quality Metrics • Assume a selfish model: • your time is valuable: minimize required coding, coordination, documentation and justifications. Code reuse, simple implementations, modular. • quality of product reflects on you: meet requirements, bugs, undocumented “features”, performance, efficiency. Test, verify and Characterize. • Avoid late nights at the keyboard: clear, simple and efficient interfaces are unlikely to be abused, misused or broken by yourself or others. Write code once – if you find your self repeating the same code then isolate it in a class or method. Write flexible, portable code. • Minimize frustration when changes are required: ensure classes/components are extensible with minimal effort. When changes are required try to keep it localized. CS422 – Operating Systems Concepts

More Related