Quick Index
Overview
A video to go along with this page.
In this section will look at how to code a class.
Coding Phases
We'll break coding a class into two phases:
- Object Structure
- Instance Methods
We want to start with phase 1, as the object structure will provide the foundation for coding the instance methods.
Coding Object Structure
Concepts
When coding the object structure, we focus on these three facets of the class:
- Shell - class header and empty class body
- Instance variables - sub-components
- Constructor Methods - the methods used to construct objects from the class
Examples
Coding Public Instance Methods
Concepts
With the object structure in place, we're now ready for the fun part, which is coding the object behaviors (i.e., methods).
From the requirements we have a listing of required instance method headers and descriptions. These may be provided in the form of an ADT.
"NOTE WELL" -- unit tests should also be coded in parallel with the model (problem solution) code.
Examples
Navigation
Coding Fundamentals
(Chapter 107 - Coding Classes)