Classes, Objects, …
In Simple Objects we learned how to create our own types in Java classes. We skipped a few details in our introduction to objects and classes. In this section, we re-visit classes and objects to complete out study. We learn some of the omitted details, which are summarized as follows.
- Instance and
- Stack and Heap
- Passing Parameters
- Enumeration Types
Classes, Objects, … and the Wirth Pattern
The Wirth pattern from Primitive Types defines a prgram to be algorithms and data structures.
This module on Classes, Objects, and More focuses more on the Data Structures component than the Algorithms component. Passing Parameters is part of the Algorithms component.
Object-oriented Programming (Eck 5.3.4)
CPSC 220 introduces you to creating classes and objects. Object-oriented programming is more than creating classes and objects. Object-oriented programming is studying your problem space to discover objects and the relationships between those objects. CPSC 240 is devoted to teaching these concepts. The following is a brief synopsis. We cover some more details for this set of steps, but we do not fully develop them.
- Think about objects that you will need, and abstract the basic properties needed for a class.
- Define the public interface. This is the set of methods that you want a user to use when they create and manipulate objects of your class.
- Create the class. Implement the public interface and any needed instance variables.
- Create a tester for you class. This will construct objects and use the methods to make sure they work how you think they should.
- Use your class in the solution of a problem.
- If you have a nice class that others can use, provide your class to others so they can solve problems with it.
Classes, Objects Lab
The overview lab for classes and objects is Classes, Objects, ….