Presentation is loading. Please wait.

Presentation is loading. Please wait.

Object-oriented design CS 345 September 20,2002. Unavoidable Complexity Many software systems are very complex: –Many developers –Ongoing lifespan –Large.

Similar presentations


Presentation on theme: "Object-oriented design CS 345 September 20,2002. Unavoidable Complexity Many software systems are very complex: –Many developers –Ongoing lifespan –Large."— Presentation transcript:

1 Object-oriented design CS 345 September 20,2002

2 Unavoidable Complexity Many software systems are very complex: –Many developers –Ongoing lifespan –Large numbers of interconnected modules –Complex behaviors Why is this? –Complex domain –Unclear user specifications –Moving Target –Team development –Characterizing discrete systems

3 Software Engineering In modern systems, software development is the bottleneck. As in other design problems, we try to apply well-tested and uniform techniques to software design. –This is software engineering. In particular, we’ll talk about object- oriented design –Distinct from object-oriented languages.

4 Object-oriented programming Uses objects (as opposed to algorithms) as the fundamental building block. –Think noun-oriented, not verb-oriented. Each object is an instance of a class –Objects all have a type Classes are related to one another via inheritance. –Class hierarchy makes relationships between objects explicit.

5 Object-oriented analysis and design Focus on modeling elements of the problem domain –As opposed to input-output relations or flowcharts. OO design: –Emphasis on proper design, rather than programming style. –Logical and physical decomposition of the system, both from a static and a dynamic perspective. OO languages should ease the mapping from design to program.

6 Types of OO Languages Pure –Smalltalk –Self Hybrid –Ada –C++ –Perl –Java –CLOS

7 Language tradeoffs Consistent semantics vs. incremental addition Efficiency vs. ease of use –E.g. garbage collection Complexity and functionality vs. simplicity –E.g. multiple inheritance. Integration with an environment Strong vs. weak typing Scope

8 Abstraction An abstraction denotes the essential properties of an object and hides the rest. What is essential depends upon the level at which you are viewing the object. Abstraction is essential in managing large software systems. An essential feature of OO design is the ability to abstract components.

9 Encapsulation Encapsulation involves separating out the methods used to invoke a behavior from the way that behavior is carried out. –Interface: the public face of an object –Implementation: How methods are carried out.

10 Why is encapsulation useful? Eases abstraction Prevents users from misusing internal structure. Helps avoid side-effects. Implementation can be changed without affecting external programs.

11 Inheritance One of the most popular OO features is inheritance. –Can define new classes in terms of existing classes. –This creates a class hierarchy in which subclasses take on the behavior of their parent classes. A subclass can generate new behaviors by –Defining new methods –Overriding a parent method.

12 Why is inheritance useful? Promotes code reuse. Aids in OO design –Encourages the development of hierarchies Allows for dynamic run-time behavior

13 Polymorphism Polymorphism is the idea that the same method can perform different operations on different data types. –Addition is polymorphic in most languages. Allows a programmer to write code without knowing the types of the data involved. [listOfStuff sort] <- don’t need to know what this is a list of.

14 Why is polymorphism useful? Provides a consistent set of operators –Aids in abstraction Allows for late binding of methods to targets. –We can specify that a particular object will perform a method without knowing its exact type until runtime.

15 Object-oriented design Design is separate from programming –You can write non-OO programs in Smalltalk. Designing software is both an art and a practice. –Iterative –A combination of intuition and sound methods

16 Static representations Class diagram –How are classes related to each other? Kind-of, has-a, creates Object diagram –How are instantiated objects related? How does one object use another? Module diagram –Shows how classes are organized within files. Process diagram –Shows the allocation of components to physical parts of a system. Specialized hardware, sensors, parallel machines.

17 Dynamic representations State transition diagrams –Look like finite state machines –Shows how an object or system can change Timing Diagrams –Shows the execution of methods over time against a timeline.


Download ppt "Object-oriented design CS 345 September 20,2002. Unavoidable Complexity Many software systems are very complex: –Many developers –Ongoing lifespan –Large."

Similar presentations


Ads by Google