Chapter 8 Learning About Classes and Objects
In this chapter, you will learn how to:
• Define and describe benefits of designing programs using object orientated design techniques.
• Analyze the differences between structured programming techniques and object oriented programming techniques.
• Define and apply the components of class objects to a business problem.
• Demonstrate the design of logic and programming using Object Orientated Programming techniques.
• Recognize OOP design and structures in an OOP program and define their role in a working program.
Introduction to Object Orientated Programming
With this chapter, we are starting a new section of the eBookand learning another approach to developing logic and programming. Structured programming techniques have stood as the staple of programming for more than thirty years. However, structured programming techniques have not changed much and there have been a number of advances in program development. The most significant advance has been approaches that have improved program source code reuse. One technology that has paved the way for code reuse is object oriented programming, Object Oriented Programming (OOP) was first implemented in a version of the C++ programming language called Smalltalk and then was made central to the Java programming language. Most recently it has been implemented across the Microsoft Visual Studio programming language. Most all of the programming languages used in business programming have implemented parts of OOP so that even languages that were originally designed for structured programming can also support code reuse.
Our goal in this chapter is to concentrate on topics and concepts first rather than expecting you to create the code for class objects this soon in your instruction. This will allow us to focus on the fundamentals first. It is critically important that you understand the fundamentals. Object orientated programming is always a challenging topic and you will at first probably find it much more difficult than structured programming. With the concepts taught in this chapter, we will then move to chapter 9 where we will concentrate on learning how to build our own classes. In short, we learn about objects and how to use them in chapter 8 and how to create them in chapter 9.
Object Oriented Programming - Object Oriented Programming (OOP) is a style of programming that identifies and groups variables and modules into class objects. The class object represents a “thing” like a customer, a purchase, a payment and expresses each in terms of their data (state) and modules (behavior). The class object is stored in a file where it can then be accessed by the programs logic and more important be reused by other programs.
The why of OOP?
Before we learn the techniques necessary to program with objects, it is important to understand why OOP has become such an important part of application programming. The use of class objects has become a very important tool in the programmer’s toolbox and understanding OOP may make the difference in securing that first programming position or promotion.
Let us look at OOP from a very practical standpoint using a business example. Historically, computer software has always been a labor intensive activity. It takes many hours for programmers to develop high-quality and efficient software. Rush the development process and you can be assured that logic mistakes will prevail thus creating an unreliable program. Most companies have had problems dealing with a software development backlog. What this means is that the requests for new software outstretch the ability of the programming staff to create new programs and maintain existing software. Using existing structured