Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 The Design of Class Mechanism for MOBY. 2 Earlier Software designers have to choose between the following schemes for the development Earlier Software.

Similar presentations


Presentation on theme: "1 The Design of Class Mechanism for MOBY. 2 Earlier Software designers have to choose between the following schemes for the development Earlier Software."— Presentation transcript:

1 1 The Design of Class Mechanism for MOBY

2 2 Earlier Software designers have to choose between the following schemes for the development Earlier Software designers have to choose between the following schemes for the development – Class rich languages like C++ or JAVA. –Module rich languages like Standard ML.

3 3 Paper describes the design of the class mechanism with a richer module system –C++ and JAVA has the rich class mechanisms but week module system –Standard ML has rich Module System but lack Class Mechanism –Moby provides both rich Class and Module Mechanism

4 4 Class in the class mechanism has two roles : Implementing Objects Supporting inheritance Based on the above roles class have two type of Clients: Object Client Class Client

5 5 MOBY : It is a ML-like language that supports Class bases mechanisms. MOBY has three mechanism to cover the features of class based languages. –Objects and Object Types. –Classes and Class Interfaces. –Modules and Module Signature.

6 6 Objects Object in MOBY are collection of fields and methods. Member of Objects: fields + Methods Operations on Objects: »Select a field »Update a field »Invoke a method

7 7 Object Type specifies which object members client may use. Object Types are nothing but are interfaces of JAVA. Object Type

8 8 Objtype Point{ meth getX : Uint->Int meth move:Int ->Point } Objtype CPoint extends Point with { meth getC : Uint->Color meth shade:Color ->CPoint }

9 9 Typing Typing in the MOBY is structural rather than Name Subtyping as in JAVA. Structural Subtyping has several variants: –Width Subtyping –Depth Subtyping –Full Subtyping

10 10 Modules n Modules in Moby are like ML-Style languages. n Signature Controls the Visibility of the definitions outside the Modules. n Modules may be nested. n Partial type revelation can be defined in signatures. type type-name <: type

11 11 Module PointTypes:{ objtype Point{ meth getX : Uint->Int meth getX : Uint->Int meth move : Int ->Point meth move : Int ->Point} Type CPoint <: Point }{ ………body of the PointTypes }

12 12 MOBY Class n Defines the implementation of object n It contains the declaration of: –fields –Method –Makers (which are constructors in C++ or JAVA)

13 13

14 14 Class interface n It is a signature of the class n It is not interfaces as in JAVA. n It defines both object and class view.

15 15

16 16 Visibility n Internal Class View n External Class View n Internal Object View n External Object View

17 17

18 18

19 19 Class based features are realized in MOBY: n Static Class Members MOBY relies on Module system to support global definition. n C++ private inheritance : In MOBY Object Type implemented by subclass is independent of the Object Type implemented by its super class.

20 20 n JAVA’s interfaces and C++’s multiple inheritance with abstract base classes: MOBY has the Structural sub typing relationship. n Final Classes: We can have this by hiding the class in a module and We can have this by hiding the class in a module and controlling the visibility of its methods. n C++ friends and JAVA’s package scope: MOBY uses the combination of modules and partial type revelation


Download ppt "1 The Design of Class Mechanism for MOBY. 2 Earlier Software designers have to choose between the following schemes for the development Earlier Software."

Similar presentations


Ads by Google