Friday, March 27, 2015

sorta stating the obvious, but sad that we tangle them up so.

http://webcache.googleusercontent.com/search?q=cache:lZganwsmysEJ:tal.forum2.org/static/cv/Shakeins.pdf+&cd=1&hl=en&ct=clnk&gl=us

2.1 The Five Facets of a Class

As early as 1971, Parnas made the classical distinction between the interface and the materialization perspectives of a software component. It is only natural to apply this distinction to class definitions in JAVA and other mainstream object oriented languages. In this section we do so, while taking into notice that, unlike the software components of the seventies, classes are instantiable.

Accordingly, the interface of a class presents two facets: the forge of the class, be- ing the set of non-private constructor signatures; and its type, the set of externally- accessible fields and methods as well as available cast operations. The materialization of a class has three facets: the implementation, i.e., the method bodies; the mill, being the implementation of the forge; and the mold, which is the memory layout used for creating objects.

The forge
public Point(int x, int y);
public Point();
public Point(Point other);
 
The class’s mold
int x
32 bits
int y
32 bits
Fields inherited from Object
Hidden fields added by the JVM 
 
The resulting type
int x, y;
public int getX(); public int getY();
public void setX(int);
public void setY(int);
// From Shape:
public void moveBy(int, int);
// From java.lang.Object:
public boolean equals(Object);
public int hashCode();
// ... etc.
// Upcast operations:
public (Shape)(); public (Object)();
 

No comments:

Post a Comment