8
votes
Where, sequentially, do Interfaces sit in an introduction to Objects?
Ideally, interfaces come first. Before Classes. Interfaces define concepts. Classes implement those concepts. Don't think of them as an add-on to OO programming. Think of them as the essence.
In ...
8
votes
Explaining how an Interface is a contract
This answer draws on Java examples.
I start the interface discussion with a mechanical SATA hard drive in my hand. I discuss the interface called SATA and its universality across devices. I expand ...
8
votes
Accepted
Explaining how an Interface is a contract
A few things jump out from the official Java documentation:
As far as an example goes, the idea of a Remote as an interface works really well based on this explanation.
Methods form the object's ...
6
votes
Explaining how an Interface is a contract
I believe that using the term "contract" is hurting more than helping. Most students in that age-range have no personal experience with contracts, so the term is too abstract or remote. Secondly, ...
3
votes
Explaining how an Interface is a contract
I have a bit of a quibble here. The only thing enforced by Java when implementing an interface is the structure of the class implementing it. The intent of the interface programmer isn't enforceable. ...
2
votes
Explaining how an Interface is a contract
An interface "isn't" a contract. But it embodies a contract. Implicitly if not explicitly.
A simple example is when you go to Kinko's (FedEx), and you click on the end of the opening interface that ...
2
votes
Explaining how an Interface is a contract
I really enjoy the answer to this question provided on StackOverflow and use it as a basic introduction/discussion point in my CS2 course:
Consider the following situation:
You are in the ...
2
votes
Where, sequentially, do Interfaces sit in an introduction to Objects?
I'd say that it can fit very well between the Inheritance and the Polymorphism.
Interfaces are a way of promising that any implementing class supports the interface's functionality. for example, ...
2
votes
Interfaces and Greenfoot
One huge advantage to using Greenfoot is the visualization and interactive nature of the application. Using and demonstrating interfaces will take some work though.
Anything that gets added to the ...
2
votes
Interfaces and Greenfoot
Yes, Greenfoot certainly has interfaces. I doubt that they would take them out. The people who built greenfoot are likely as appalled as I am about the College Board action on interfaces. But there is ...
1
vote
Where, sequentially, do Interfaces sit in an introduction to Objects?
My laundry list:
We write sample programs using components from a library (say JavaFx, or SFML)
We don't care (much) about the internals of objects, as long as they work, but about their programming ...
1
vote
Where, sequentially, do Interfaces sit in an introduction to Objects?
Interfaces should be taught right after, or during the section on APIs, because they are simply a promise to implement a certain Application Programming Interface. It's why they are called interfaces ...
1
vote
Explaining how an Interface is a contract
If I were asked to describe how a pin-and-tumbler lock works - the kind of lock most of the developed world have on their front doors - I cannot imagine that the word "contract" would find ...
1
vote
Explaining how an Interface is a contract
An interface is an artifact that exists between two or more abstractions. It states what capabilities a given abstraction has to offer its users. It does not say how. The what part is an interface, ...
1
vote
Explaining how an Interface is a contract
Java (and most other languages) interfaces are not contracts.
The contract on Eat is:
I take no data
I return no data
you can call me under any situation
I will not crash/throw (most languages don't ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
interface × 3object-oriented-paradigm × 2
curriculum-design × 1
java × 1
teaching-analogy × 1
ap-computer-science-a × 1
lesson-order × 1
secondary-education × 1