The Object-Oriented Thought Process Chapter 05

Slides:



Advertisements
Similar presentations
Understand and appreciate Object Oriented Programming (OOP) Objects are self-contained modules or subroutines that contain data as well as the functions.
Advertisements

Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
Object-Oriented Application Development Using VB.NET 1 Chapter 5 Object-Oriented Analysis and Design.
Chapter 10 THINKING IN OBJECTS 1 Object Oriented programming Instructor: Dr. Essam H. Houssein.
CSE 1302 Lecture 8 Inheritance Richard Gesick Figures from Deitel, “Visual C#”, Pearson.
OOAD Using the UML - Use-Case Analysis, v 4.2 Copyright  Rational Software, all rights reserved 1/18 Use Case Analysis – continued Control Classes.
Testing HCI Usability Testing. Chronological order of testing Individual program units are built and tested (white-box testing / unit testing) Units are.
Software Issues Derived from Dr. Fawcett’s Slides Phil Pratt-Szeliga Fall 2009.
The chapter will address the following questions:
Starting Chapter 4 Starting. 1 Course Outline* Covered in first half until Dr. Li takes over. JAVA and OO: Review what is Object Oriented Programming.
1 Object-Oriented Testing CIS 375 Bruce R. Maxim UM-Dearborn.
Software Testing. Introduction Testing is often left to the end of the project which is generally not a good idea. Testing should be conducted throughout.
Introduction to Object-oriented programming and software development Lecture 1.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 12 Object-Oriented.
Lecture 8 Inheritance Richard Gesick. 2 OBJECTIVES How inheritance promotes software reusability. The concepts of base classes and derived classes. To.
Object Oriented Programming Key Features of OO Approach Data encapsulation –data and methods are contained in a single unit, object –promotes internal.
CSE 303 – Software Design and Architecture
Recap (önemli noktaları yinelemek) from last week Paradigm Kay’s Description Intro to Objects Messages / Interconnections Information Hiding Classes Inheritance.
SAMANVITHA RAMAYANAM 18 TH FEBRUARY 2010 CPE 691 LAYERED APPLICATION.
SE: CHAPTER 7 Writing The Program
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Systems Analysis and Design in a Changing World, 3rd Edition
I Power Higher Computing Software Development The Software Development Process.
Chapter 7 Software Engineering Introduction to CS 1 st Semester, 2015 Sanghyun Park.
Software Engineering Chapter 3 CPSC Pascal Brent M. Dingle Texas A&M University.
CSCI 1100/1202 April 1-3, Program Development The creation of software involves four basic activities: –establishing the requirements –creating.
Session 3 How to Approach the UML Written by Thomas A. Pender Published by Wiley Publishing, Inc. October 5, 2011 Presented by Kang-Pyo Lee.
Recap Introduction to Inheritance Inheritance in C++ IS-A Relationship Polymorphism in Inheritance Classes in Inheritance Visibility Rules Constructor.
Chapter 10 Software quality. This chapter discusses n Some important properties we want our system to have, specifically correctness and maintainability.
CSCE 240 – Intro to Software Engineering Lecture 3.
CLASSIFICATION OF DESIGN PATTERNS Hladchuk Maksym.
Applied Software Project Management SOFTWARE TESTING Applied Software Project Management 1.
Computer System Structures
Advanced Higher Computing Science
The Object-Oriented Thought Process Chapter 03
Object-Oriented Design
Integration Testing.
Object-oriented software testing
Levels of testing.
Chapter 11 Object-Oriented Design
Java Beans Sagun Dhakhwa.
Chapter 8 – Software Testing
Week 10: Object Modeling (1)Use Case Model
Object oriented system development life cycle
The Object-Oriented Thought Process Chapter 08
The Object-Oriented Thought Process Chapter 06
Lecture 23 Polymorphism Richard Gesick.
The Object-Oriented Thought Process Chapter 12
Unit# 9: Computer Program Development
Chapter 24 Testing Object-Oriented Applications
Lecture 09:Software Testing
Lecture 22 Inheritance Richard Gesick.
Advanced Java Programming
Chapter 19 Testing Object-Oriented Applications
The Object-Oriented Thought Process Chapter 02
Static Class Members March 29, 2006 ComS 207: Programming I (in Java)
An Introduction to Software Architecture
SAMANVITHA RAMAYANAM 18TH FEBRUARY 2010 CPE 691
Chapter 13: Construction
Chapter 19 Testing Object-Oriented Applications
Applying Use Cases (Chapters 25,26)
Integration Reading: McConnell, Code Complete, Ch. 29
Applying Use Cases (Chapters 25,26)
Chapter 2. Problem Solving and Software Engineering
Object-Oriented PHP (1)
Use Case Analysis – continued
Information Hidding Dr. Veton Kepuska.
Agenda Software development (SD) & Software development methodologies (SDM) Orthogonal views of the software OOSD Methodology Why an Object Orientation?
From Use Cases to Implementation
The OOTP is intended to get you thinking about how OO concepts are used in designing object-oriented systems. Note: not talking about OO technologies that.
Presentation transcript:

The Object-Oriented Thought Process Chapter 05 Class Design Guidelines

Modeling Real World Systems One of the primary goals of object-oriented (OO) programming is to model real-world systems in ways similar to the ways in which people actually think. Rather than using a structured, or top-down, approach, where data and behavior are logically separate entities. The OO approach encapsulates the data and behavior into objects that interact with each other.

Indentifying Public Interfaces Perhaps the most important issue when designing a class is to keep the public interface to a minimum. The entire purpose of building a class is to provide something useful and concise “the interface of a well-designed object describes the services that the client wants accomplished.”

The Minimum Public Interface If the public interface is not properly restricted, problems can result in the need for debugging, and even trouble with system integrity and security can surface. Creating a class is a business proposition, and it is very important that the users are involved with the design right from the start and throughout the testing phase.

Hiding the Implementation The implementation should not involve the users at all. The implementation must provide the services that the user needs. But how these services are actually performed should not be made apparent to the user.

Robust Constructors A constructor should put an object into an initial, safe state. This includes issues such as attribute initialization and memory management. You also need to make sure the object is constructed properly in the default condition. It is normally a good idea to provide a constructor to handle this default situation.

Error Handling Design The general rule is that the application should never crash. It is not a good idea to ignore potential errors. When an error is encountered, the system should either fix itself and continue, or exit gracefully without losing any data that’s important to the user.

Documenting a Class One of the most crucial aspects of a good design, whether it’s a design for a class or something else, is to carefully document the process. Too much documentation and/or commenting can become background noise and may defeat the purpose of the documentation in the first place. Make the documentation and comments straightforward and to the point.

Cooperating Objects A class will service other classes; it will request the services of other classes, or both. When designing a class, make sure you are aware of how other objects will interact with it.

Designing with Reuse in Mind Objects can be reused in different systems, and code should be written with reuse in mind. This is where much of the thought is required in the design process. Attempting to predict all the possible scenarios in which an object must operate is not a trivial task. In fact, it is virtually impossible.

Designing with Extensibility Adding new features to a class might be as simple as extending an existing class, adding a few new methods, and modifying the behavior of others. It is not necessary to rewrite everything. Consider the future use of a class when designing it.

Descriptive Names Make sure that a naming convention makes sense. People often go overboard and create conventions that are incomprehensible to others. Take care when forcing others to conform to a convention. Make sure that conventions are sensible.

Isolating Nonportable Code If you are designing a system that must use nonportable (native) code (that is, the code will run only on a specific hardware platform), you should abstract this code out of the class. By abstracting out, we mean isolating the non-portable code in its own class or at least its own method (a method that can be overridden).

Copying and Comparing Objects It is important to understand how objects are copied and compared. You must make sure that your class behaves as expected, and this means you have to spend some time designing how objects are copied and compared.

Minimizing Scope Keeping the scope as small as possible goes hand-in-hand with abstraction and hiding the implementation. The idea is to localize attributes and behaviors as much as possible. In this way, maintaining, testing, and extending a class are much easier.

Class Responsibility Classes should be responsible for their own behavior whenever possible. For example, if you have several objects of various shapes, each individual shape should be responsible for drawing itself. This design practice localizes functionality and make it easier to add new shapes.

Maintainability Designing useful and concise classes promotes a high level of maintainability. Just as you design a class with extensibility in mind, you should also design with future maintenance in mind. One of the best ways to promote maintainability is to reduce interdependent code. that is, changes in one class have no impact or minimal impact on other classes.

Using Iteration Create the code in small increments and then build and test it at each step. A good testing plan quickly uncovers any areas where insufficient interfaces are provided. In this way, the process can iterate until the class has the appropriate interfaces. Iterate through all phases of the software life cycle.

Testing the Interface The minimal implementations of the interface are often called stubs. By using stubs, you can test the interfaces without writing any real code. Stubs also allow testing without having the entire system in place.

Object Persistence Object persistence is the concept of maintaining the state of an object. When you run a program, if you don’t save the object in some manner, the object dies, never to be recovered. In most business systems, the state of the object must be saved for later use.

Marshalling Objects To send an object over a wire (for example, to a file, over a network), the system must deconstruct the object (flatten it out), send it over the wire, and then reconstruct it on the other end of the wire. This process is called serializing an object. The act of sending the object across a wire is called marshaling an object.