Algorithms and OOD (CSC 207 2014S) : EBoards
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Rubric] - [Calendar]
Current: [Assignment] [EBoard] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Partners] [Readings]
Reference: [Java 7 API] [Java Code Conventions] [GNU Code Conventions]
Related Courses: [CSC 152 2006S (Rebelsky)] [CSC 207 2013F (Rebelsky)] [CSC 207 2013S (Walker)] [CSC 207 2011S (Weinman)]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker (Course)] [Issue Tracker (Textbook)]
Overview
Can our skip list iterator call underlying methods of the skip list?
Certainly.
Should we fail fast for the skip list iterator?
It would be nice. It's also fine if you just crash and burn if someone else mutates the list.
Should we fail fast for the filtered list iterator?
It would be nice. It's also fine if you just crash and burn if someone else mutates the list.
Why does my filtered iterator crash and burn when I try to remove an element from a filtered range using delegation?
Because ranges do not implement remove.
That's acceptable behavior. You can't do any better than the underlying iterator.
Code
public class Utils
{
public int square(int x)
{
return x*x;
} // square
public double expt(double x, int n)
{
...;
} // expt
} // class Utils
public class BetterUtils
extends Utils
{
int callsToSquare = 0;
@Override
public int square(int x)
{
++this.callsToSquare;
// And do the old behavior
return super.square(x);
} // square(int)
Problem! What if we want to add/extend anything that meets an interface?
A typical solution appears in the ReportingLinearStructure.java class.
What is the additional utility that we might want?
A more general approach to one of the benefits of inheritance
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Rubric] - [Calendar]
Current: [Assignment] [EBoard] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Partners] [Readings]
Reference: [Java 7 API] [Java Code Conventions] [GNU Code Conventions]
Related Courses: [CSC 152 2006S (Rebelsky)] [CSC 207 2013F (Rebelsky)] [CSC 207 2013S (Walker)] [CSC 207 2011S (Weinman)]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker (Course)] [Issue Tracker (Textbook)]
Copyright (c) 2013-14 Samuel A. Rebelsky.

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this
license, visit http://creativecommons.org/licenses/by/3.0/
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.