Method for implementing computer applications in an object oriented manner using a traditional non-object oriented programming language
Abstract
An object oriented application comprising an hierarchy of application classes, each having a plurality of class methods, is created from a toolkit having a static class hierarchy including a number of standard classes, a number of public interface methods with interfacing attributes and a list for chaining class private methods to the public interface methods, a plurality of class definition source and header files defining the extended application classes, a plurality of class method source and header files implementing the class methods of the extended classes, and a plurality of object user source and header files implementing the object users, using a traditional programming language that provides no support for object oriented programming. Together, the various files cooperate to achieve data abstraction and inheritance of object oriented programming, when the various files are compiled, linked, executed.
Claims
exact text as granted — not AI-modifiedI claim:
1. In a computer system comprising a C programming language compiler and its runtime libraries, wherein said compiler and its runtime libraries are used to create applications having a number of object creators and users which create and use objects, a method for creating and using an object by an object creator and at least one object user in a manner that relieves the object creator from actually having to implement the object, and shielding the object's implementation from the object creator and the at least one object user, said method comprising the steps of: a) providing an object oriented toolkit comprising a static class hierarchy having a least one root class, said root class having a plurality of public interface methods for interfacing between a plurality of program calls and a plurality of private class methods, said program calls being made by object creators and users for creating objects using said class hierarchy and manipulating the created objects, said private class methods being methods of classes subclass to said root class for creating and manipulating class instances of said classes and having a corresponding relationship to said public interface methods, said root class further having at least one list for correspondingly chaining said private class methods to said public interface methods by their class orders, said at least one list being automatically updated whenever one of said classes subclass is defined and added to said static class hierarchy, each of said public interface methods invoking at least its correspondingly chained private class methods in a predetermined one of two orders whenever itself is invoked by one of said program calls; b) creating a first class subclass to said root class by compiling at least a first source file having a first and a second header file into at least a first object file, and linking at least said first object file into a first executable file, said first and additional source files, if any, comprising a first data structure and a first plurality of functions, said first data structure defining class data common to all class instances of said first class including a first class identifier identifying said first class, and first parent identifier identifying said root class as said first class's superclass, said first plurality of functions implementing the private class methods of said first class, each of said first plurality of functions being executed when the private class method of said first class it implements is invoked, said first header file comprising a second data structure defining class instance data for a class instance of said first class including an opaque handler for locating and shielding the class instance of said first class, each of said opaque handlers of class instances of said first class being instantiated and returned by a first of said first plurality of functions for creating a class instance of said first class when said first function of said first class is executed, said second header file comprising a third data structure defining a first plurality of interfacing attributes of said first class and a first plurality of function declarations defining said first plurality of functions, said first plurality of interfacing attributes being correspond to and shielding said class instances' data of said first class; c) creating the object creator by compiling at least a second source file having at least said second header file into at least a second object file, and linking at least said second object file into a second executable file, said second source file comprising a first of said program calls to a first of said public interface methods to create the object as a first class instance of said first class using said first parent identifier, said first class identifier, and selectively said first plurality of interfacing attributes, and to obtain a first opaque handler for said created first class instance; d) executing the object creator by executing said second executable file, causing said first program call to be made, which in turns leads to said first public interface method and its correspondingly chained private interface method of said first class to be invoked said first executable file and said first function of said first class to be executed, said first class instance to be created, said first opaque handler to be instantiated and returned, thereby creating the object without requiring the object creator to actually implement the object and shielding the implementation of the object from the object creator.
2. The method as set forth in claim 1, wherein, the object creator is also one of said at least one object user of the object created; said second source file in said step c) further comprises a second of said program calls to a second of said public interface methods to manipulate the object using said first opaque handler and selectively said first plurality of interfacing attributes; and said execution of said second executable file in said step d) also causes said second program call to be made, which in turns leads to said second public interface method and its correspondingly chained private interface method of said first class to be invoked, said first executable file and the implementing function of the invoked private interface method to be executed, said first class instance to be manipulated, thereby using the object but shielding the implementation of the object from the object creator/user.
3. The method as set forth in claim 1, wherein, said method further comprises the steps of: e) creating a first of said at least one object user by compiling at least a third source file having at least said second header file into at least a third object file, and linking at least said third object file into a third executable file, said third source file comprising a second and a third of said program calls to a second and a third of said public interface methods respectively, said second program call being made to locate the object using said first parent identifier, said first class identifier, and selectively said first plurality of interfacing attributes, and to obtain said first opaque handler, said third program call being made subsequently to a third of said public interface methods to manipulate the object using said first opaque handler and selectively said first plurality of interfacing attributes; f) executing said first object user by executing said third executable file, causing said second program call to be made, which in turns leads to said second public interface method and its correspondingly chained private interface method of said first class to be invoked, said first executable file and the implementing function of the invoked private interface method to be executed, said first opaque handler to be returned, then, said third program call to be made, which in turns leads to said third public interface method and its correspondingly chained private interface method of said first class to be invoked, said first executable file and the implementing function of the invoked private interface method to be executed, said first class instance to be manipulated, thereby using the object but shielding the implementation of the object from said first object user.
4. The method as set forth in claim 1, wherein, said second header file further comprises a fourth data structure defining a plurality of pointers for linking a class subclass to said first class to said first class.
5. The method as set forth in claim 4, wherein, said step b) further comprises creating a second class subclass to said first class by compiling at least a third source file having a third and a fourth header file into at least a third object file, and linking at least said third object file into a third executable file, said third and additional source files, if any, comprising a fifth data structure and a second plurality of functions, said fifth data structure defining class data common to all class instances of said second class including a second class identifier identifying said second class, a second parent identifier identifying said first class as said second class's superclass, said second plurality of functions implementing the private class methods of said second class, each of said second plurality of functions being executed when the private class method of said second class it implements is invoked, said third header file including said second header file, and comprising a sixth data structure defining class instance data for a class instance of said second class including an opaque handler for locating and shielding the class instance of said second class, each of said opaque handlers of said class instances of said second class being instantiated and returned by a first of said second plurality of functions for creating a class instance of said second class when said first function of said second class is executed, said fourth header file including said second header file, and comprising a sixth data structure defining a second plurality of interfacing attributes of said second class and a second plurality of function declarations defining said second plurality of functions, said second plurality of interfacing attributes being correspond to and shielding said class instances' data of said second class; said first of said program calls to said first of said public interface methods in said second source file in said step c) is made to create the object as a second class instance of said second class using selectively said second class identifier, said second parent identifier, and selectively said second plurality of interfacing attributes, and to obtain a second opaque handler for said created second class instance; said execution of the object creator by executing said second executable file in said step d) causes said first program call to be made, which in turns leads to said first public interface method and at least its correspondingly chained private interface method of said second class to be invoked, said second executable file and said first of said second plurality of functions to be executed, said second class instance to be created, said second opaque handler to be instantiated and returned, thereby creating the object without requiring the object creator to actually implement the object and shielding the implementation of the object from the object creator.
6. The method as set forth in claim 5, wherein, said fifth data structure of said third and additional source files, if any, in said step b) further comprises an inheritance indicator indicating one of said first plurality of functions of said first class is to be inherited as the implementation function for one of the private methods of said second class.
7. The method as set forth in claim 1, wherein, said computer system further comprises an event notifier/distributor subsystem; said application is an event driven application; said first plurality of interface attributes comprise a functional interface attribute for associating an event handling procedure with a class instance of said first class.Cited by (0)
No later patents cite this yet.
References (0)
No backward citations on record.