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 ...
Buffy's user avatar
  • 36k
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 ...
ThisClark's user avatar
  • 293
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 ...
Peter's user avatar
  • 9,082
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, ...
Gypsy Spellweaver's user avatar
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. ...
Buffy's user avatar
  • 36k
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 ...
Tom Au's user avatar
  • 475
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 ...
cryptic_star's user avatar
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, ...
ItamarG3's user avatar
  • 6,287
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 ...
Mr Bradley's user avatar
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 ...
Buffy's user avatar
  • 36k
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 ...
Michel Billaud's user avatar
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 ...
Soupy's user avatar
  • 321
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 ...
Steve's user avatar
  • 356
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, ...
Maciek Czarnik's user avatar
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 ...
ctrl-alt-delor's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible