Lists Review and Performance : 03/31/2023
Linked Lists : 03/30/2023
Algorithms and Lists : 03/29/2023
Lambda Expressions : 03/24/2023
Anonymous Classes : 03/23/2023
Practice with Interfaces : 03/22/2023
Implementing Interfaces : 03/21/2023
Using Interfaces : 03/20/2023
Working with Exceptions : 03/10/2023
Throwing Exceptions : 03/09/2023
Catching Exceptions : 03/08/2023
References and Polymorphism : 03/07/2023
References : 03/06/2023
Data Modeling 2 : 03/03/2023
Equality and Object Copying : 03/02/2023
Polymorphism : 03/01/2023
Inheritance : 02/28/2023
Data Modeling 1 : 02/27/2023
Companion Objects : 02/24/2023
Encapsulation : 02/23/2023
Constructors : 02/22/2023
Objects, Continued : 02/21/2023
Introduction to Objects : 02/20/2023
Compilation and Immutability : 02/17/2023
Practice with Collections : 02/16/2023
Maps and Sets : 02/15/2023
Lists and Type Parameters : 02/14/2023
Imports and Libraries : 02/13/2023
Multidimensional Arrays : 02/10/2023
Practice with Strings : 02/09/2023
null : 02/08/2023
Algorithms and Strings : 02/07/2023
Strings : 02/06/2023
Functions and Algorithms : 02/03/2023
Practice with Functions : 02/02/2023
More About Functions : 02/01/2023
Errors and Debugging : 01/31/2023
Functions : 01/30/2023
Practice with Loops and Algorithms : 01/27/2023
Algorithms : 01/26/2023
Loops : 01/25/2023
Arrays : 01/24/2023
Compound Conditionals : 01/23/2023
Conditional Expressions and Statements : 01/20/2023
Operations on Variables : 01/19/2023
Variables and Types : 01/18/2023
Welcome to CS 124 : 01/17/2023
Data Modeling 2
In this lesson we stop and put all that we’ve learned this week into action.
We’ll complete another object modeling exercise together.
But this time, we’ll make use of inheritance, polymorphism, and other new ideas that we recently learned.
But, as we frequently do, let’s warm up with another graded debugging challenge!
Last time we did a game, and I said: I’m sorry we’re doing a game.
This time we’re going to do something that may seem a bit like navel-gazing.
And I’ll say: I’m sorry we’re doing something course-related.
This is what I think about!
So let’s model office hours.
One way to begin object modeling is to think about what kind of entities we need to model and what kind of relationships they should have with each other.
Let’s start there:
Next, let’s consider the kind of actions and methods that our objects need to support.
That will help guide us as we add required instance variables.
Next, we’ll pick a pair of the methods on our
Room class to implement.
Finally, we’ll finish at least a preliminary implementation of our office hours model.
And then discuss how you could extend and improve it!
Need more practice? Head over to the practice page.