dar7yl said:
I've seen this construct before in a VB program which I was forced (due to
economic pressures) to try and decipher.
Evidently, this is B.Gates' method of branding his personal stable of
programmers - totally wiping their brains, and rewriting their
semi-autonomous systems to interface with the Windows Foundation Class API.
regards,
Dar7yl
ps, replies to advocacy only, if you please.
As for subject. You can't say "stupid code" unless you know it purpose.
Simple for(int i=0;i<100000;i++); can be used for loading CPU for load
test for another thread.
The same is here. See the difference:
Foo foo=null;
System.out.println(""+foo);
or
System.out.println(foo);
So, the first one make perfect sense! When second one crashes flow.
As for second example:
Foo foo = (Foo )Foo.class.newInstance();
personally, I think it's just not genoius enough. Especially for M$ and
partners.
It gave me a lot of food for my thoughts.
But didn't help me in my quest.
See, I worked with VB too. In particular with Actuate VB. And it allows
in some way use Java Objects which was big help for me.
But! They created Objects without invoking constructor at all!
It's still mistery for me how it is possible and I tried approach
metioned above to do this. Unfortuanately it doesn't work...
Invokes default () constructor anyway or throws
java.lang.InstantiationException exception for Objects without default
constructor.
So, it's still big mistery for me how this VB creates Objects.
And this "stupid" example was good, but not good enough!
Let's have more "stupid" things and use them a lot.
Fool studies on own errors, smart - on others.
Alex Kizub.