Slashdot Mirror


User: chickenpathways

chickenpathways's activity in the archive.

Stories
0
Comments
1
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 1

  1. Re: How about Python or something? on 'CodeSpells' Video Game Teaches Children Java Programming · · Score: 1

    I suppose I'm a knuckle-dragger. After reading about interfaces and seeing a few examples where I work I still don't understand how they are beneficial.

    It's Java's version of a fairly common abstraction idea, that is, fixing a set of methods/functions (and what types they consume and produce) so that one person can write code that *uses* the set and another can *implement* them, *separately* [e.g. the ubiquitous "API" of something]. Sometimes, you can get this effect (in Java) from inheritance (all Animals have a size, and a way to tell if they are hungry, etc. even if the details of fish, puppies, and snakes are different) but **because Java does not allow multiple inheritance**, the interface concept can step in to help out (so maybe we want a Pet Store, that sells both Animals and pet supplies, so we create a Sellable interface with methods like price, purchase date, etc., and we can now write an inventory system without somehow shoehorning our existing inheritance hierarchies for Animals and Supplies together into some single master hierarchy....