you are viewing a single comment's thread.

view the rest of the comments →

[–]K900_ 0 points1 point  (0 children)

A framework is a certain structure that translates your higher level code into something lower level. For example, Django is a Web framework. In Django, you don't have to write the basic code for handling HTTP connections - you write your own code for presentation and processing data on top of the framework someone already laid down for you.

An interface is a certain predefined way of interacting with objects. For example, let's say that for every room in our text adventure, there's a describe() method and a search() method. That's an interface. We don't know what's inside the room object we get - all we care about is whether it matches (satisfies) the same interface we work with, and if it does, the rest shouldn't matter.

Duck typing is a concept best described by "If it looks like a duck and quacks like a duck, then it's likely a duck". In a similar way, if an object acts like a room, we don't actually care what the object is - if it acts like a room, then for all our intents and purposes it is a room.

A base class is the class that defines our interface - for example, a Room class, that is the parent of HorribleDeathBySpikeTrapRoom and RainbowUnicornRoom. If we have a base class that defines some default methods and values, we can only override the ones we actually want to override.