Saturday, 31 August 2013

Class, Interface, Prototype, and else

Class, Interface, Prototype, and else

I'm creating a JavaScript Framework for making applications in the classic
Object-Oriented Programming (so with classes/interfaces instead of only
prototypes). However I still have a problem with giving names to those.
For instance :
var Bidule = function() { /*...*/ } ;
Bidule.prototype = { /*...*/ } ;
Is Bidule a OOP Class as a class is a constructor ? Or is it only a
constructor ? As classes don't have prototypes, I don't think it could be
called a true class.
So it means I should call them both 'Constructors'. However, what about an
interface or an abstract class ? What is the correct word if they aren't
constructors ? And is an interface a kind of class ?
I've designed constructor functions, classes and interfaces in my
Framework. However I need a name to regroup all of theme so we may build
one of those like this :
var Bidule = new _NAME_.Class(/*...*/) ; // Where _NAME_ is the name of
the container of class/function/interface.
I was thinking of "Concept" but I'm not sure and would like to know your
opinions.



I also named "visibility" the common word for describing public/private
class, "type" for static/abstract/interface/singleton/final class. Are
those correct ?



And one last question : Is there a difference between the verb 'extend'
and 'inherit' ?
Thanks in advance for your answers.

No comments:

Post a Comment