Inevitably, software systems' ever-increasing size and complexity and advances in hardware will require a new software development paradigm. But for now, with some specialized exceptions, the object-oriented approach is the best overall software development model. CS 1410 examines three phases of object-oriented software development: analysis (OOA), design (OOD), and programming (OOP).
Software developers identify objects in the problem domain (i.e., the "real world") and abstract them into classes during the analysis phase. During the design phase, developers refine the class by adding, removing, or updating the class's attributes and operations. They also add implementation classes, classes that don't exist in the problem domain but are necessary for a computer program, during the design phase. Finally, the developers implement the classes and create programs in the implementation or programming phase. The classes form a consistent and cohesive "vocabulary" used throughout the development process.
Most of our effort in CS 1410 centers on object-oriented programming (OOP).
Object-Oriented Concepts
The object-oriented paradigm requires three characteristics or concepts:
Encapsulation (chapter 9)
Inheritance (chapters 10)
Polymorphism (chapter 12)
Key Examples
Students often struggle with using objects. Three key examples target different conceptual challenges:
Time: the basic syntax of a class, simple constructors, and member functions, including functions that operate on multiple objects
Fraction 1: complex constructors and member functions, converting a problem into objects, and mapping elements found in the problem to class features
The pouring puzzle: solving a problem and implementing multiple solutions (OOA, OOD, and OOP). Demonstrates the role that an object plays (how the program uses it) can depend on the location of an object in a member function call. The puzzle involves a player pouring water from one glass to another with a member function named pour. Let g0 and g1 be two instances of a class named glass. In the function call g0.pour(g1), water is poured from g1 into g0, but in the call g1.pour(g0), water is poured from g0 into g1
Know
The syntax for specifying a class
What are attributes and operations, and how they relate to class members
Visibility control with the public and private keywords (protected is introduced in the next chapter)
What are static member variables and functions
How to convert a UML class diagram into a C++ class
The concept of a "public interface"
The five kinds of constructors and how to create and recognize them
How to use initializer lists (and where they go)
How to use default arguments with constructors
How to use new and delete to create and destroy objects
How to return an object efficiently from a function
What are access functions (getters and setters) and how to create them
What the this pointer is and how and how it binds an object to a member function
How to use const with objects, including with member functions