Monday, December 27, 2010

lot of combinations possible

1. sharing properties alone across similar classes (one way , bidirectional):
adobe flex allows One data to be bound to another data in another object(BindingUtils class).
may be something like:
@Shares(B.var2, bidirectional=true)
type var1;
2. sharing function alone across similar classes(one way , bidirectional)
3. pattern programming - - way to go..
4. 'super class' -can be there:
class A super B{ }
5. Varying data type -Data type of class can be changed at compile time by adding infinite number of data to data types:
eg: {type2 , int a} myNewTypeObject; (This is a new anonymous type - just like anonymous classes having all 'type2' class variables + an 'int a' variable.
6. function pointer of c++ has limitation as class members may not be shared. But passing function into function could be there with proper compile time warning if function to function passing is not possible.
7. DSL incorporation into method start and end execution jointpoint (extended AOP)
8 combinatorial execution of functions (may be already present in many other languages):
public void func3()= (func1()+func2())*3;
9. dependency/function injection of data into specific lines of a code. Why restrict DI concept to variables of a class. Inversion of Control could be applied inline of a function by putting some labels/markers
10. Any class to Any class/ 'Inverse OOP'(foolish?). I could say
SubClass a= new ParentClass();
AnyClass b = new AnyOtherClass();
compiler Uses Artificial Intelligence to find out- which combination of method to call.

11. Still to come..........................(note: there is nothing called software patents. Govt of India does not approve software patents.)

Thursday, December 23, 2010

related to prev post - equals classes

java possibly may have added some capabilities of c++ in another way?. eg: friend classes in c++- java could have said:
class A equals B{} 'equals classes' sharing even private variables.

related to prev post

base *b=new base;
sub *s=new sub;
s ->base::foo(); // private instance variable of base has 0 or unknown value while executing foo() method of base class..

can't this be extended so as pass base class variable along with method call?
may be something like
s -> base{i=20,j=11}::foo();// here i and j were private variables of base..

can't this concept be useful in a programming language?

Wednesday, December 22, 2010

method overriding enhancements - strong type cast needed

C++, Java both don't have full power of node oriented programming.
In Java:
Suppose class B extends A.
A a = new B();
((A)a).foo(); // still calls class B's foo() method.
There is a need to call class A's foo method at runtime preserving data maintained in class B object.

Strong Type Cast is needed in java.
May be something like:
((A strong)a).foo(); should call A's foo() method.
This is case where If a subclass overrides superclass 20-30 methods, and when a subclass instance is passed to a utility method that needs to invoke one specific instance of superclass method.

C++ does allow fully qualify specific superclass method call using A::foo().

What could still be lacking in C++?
strong type cast of an entire object so that the object reference passed to utility method will use all specific type casted super class methods while preserving subclass data.

method invocation could be enhanced like following:

callAnyMethod(&MyObjSub2 arg);
should be enhanceable to
callAnyMethod(&MyObjSub2[MyClassSub1] arg); where [MyClassSub1] represent a strong type cast. or could be mutiple orderings could be given: [MyClassSub1,MyClassSub2]

method definition is
void callAnyMethod(MyClass* p){
p->overridMeth(); // will execute MyClassSub1 method in hierarchy as it is mentioned in the strong type cast in pass by reference

Class Hierarchy is:


java hierarchy:
class A{
void foo(){
System.out.println("hello A");
class B extends A{
void foo(){
System.out.println("hello B");

Computing has two things: 1. storage, 2. processing
What humans wanted to do was stored in ROM/punched cards as assembly language statements or java language statements which get converted to fast electric signals used by processing.