Welcome back. Good to have both Hrishi and you blogging again.
Is this really possible, I really doubt it. For long scientists have been saying that at the quantum level, causality is broken, that is just too dumb! For example, the whole experiment regarding Schroedinger's Cat is ridiculous! The claim of an event happening only when our eyes fall on it is just too goddamned subjective!!
From what I've read, it looks like the laws of phsyics literally break down at the quantum level. I don't see any reason to dismiss it. There is some sort of incompatibility between quantum mechanics and general relativity. And physists are trying to make sense of it all with "string theory". They are trying to unify everything from the very big to the very small. That's why sometimes it is called "the theory of everything".
True we don't know yet exactly what happens at the quantum level, but to infer from that a truly chaotic view of it is absurd. How can something be two different things at the same instant of time?? I'm perplexed, someone explain!
As you say, unlike digital computers today where a bit is either on or off, qu-bits can be 0 and 1 at the same time. It's based on the fundamental ambiguity inherent at the quantum level. They key to quantum computers is that one would present it with a problem and a way to test the answer. Through some disambiguating process (don't ask me to explain how!) the failing answers cancel each others out and only the one that passes the test remains. This is why it's so effective in cryptography.
I've been wondering for sometime if something like quantum computing is possible, it's very base seems shaky! True I'm no physics expert, but still I can't accept a contradiction as the basis to a scientific theory.
And if you think about it quantum computers will definitely be an eventuality. The transistors are getting pretty damn small already. By 2020 they will reach atom size. And at that point we will have no other choice but to deal with quantum mechanics.
I dunno if that appeased you in anyway (I'm guessing probably not!) but that's how I understand it.
Saturday, November 20, 2004
Quantum Computing??
Reading the post on Crypto and the effects quantum computing has on it, I thought I'd write a few things.
The whole concept of quantum computing is based on the rational of what they call a Qubit. A qubit is a bit of memory that is capable of holding of both boolean values 0 and 1 simultaeneously!!
Is this really possible, I really doubt it. For long scientists have been saying that at the quantum level, causality is broken, that is just too dumb! For example, the whole experiment regarding Schroedinger's Cat is ridiculous! The claim of an event happening only when our eyes fall on it is just too goddamned subjective!!
True we don't know yet exactly what happens at the quantum level, but to infer from that a truly chaotic view of it is absurd. How can something be two different things at the same instant of time?? I'm perplexed, someone explain!
I've been wondering for sometime if something like quantum computing is possible, it's very base seems shaky! True I'm no physics expert, but still I can't accept a contradiction as the basis to a scientific theory.
There is one theory though, "The Theory of Elementary Waves" by Lewis Little thats seeks to explain quantum mechanics rationally!
Dinesh.
The whole concept of quantum computing is based on the rational of what they call a Qubit. A qubit is a bit of memory that is capable of holding of both boolean values 0 and 1 simultaeneously!!
Is this really possible, I really doubt it. For long scientists have been saying that at the quantum level, causality is broken, that is just too dumb! For example, the whole experiment regarding Schroedinger's Cat is ridiculous! The claim of an event happening only when our eyes fall on it is just too goddamned subjective!!
True we don't know yet exactly what happens at the quantum level, but to infer from that a truly chaotic view of it is absurd. How can something be two different things at the same instant of time?? I'm perplexed, someone explain!
I've been wondering for sometime if something like quantum computing is possible, it's very base seems shaky! True I'm no physics expert, but still I can't accept a contradiction as the basis to a scientific theory.
There is one theory though, "The Theory of Elementary Waves" by Lewis Little thats seeks to explain quantum mechanics rationally!
Dinesh.
Long-time No Post
Hey guys!!
It's been a long time since I posted. Was not following the blog either, but it's good to see that Revo and Mohn kept it alive and kicking.
Will write more later. Started on a File System Simulation project, it's pretty interesting. I'll talk about it on another post.
Dinesh.
It's been a long time since I posted. Was not following the blog either, but it's good to see that Revo and Mohn kept it alive and kicking.
Will write more later. Started on a File System Simulation project, it's pretty interesting. I'll talk about it on another post.
Dinesh.
Friday, November 19, 2004
General Stuff
Firstly great to have Hrishi back on codeWord. Try and post whenever.
Mohn.. could you post more on the Java Proxy classes you mentioned in your recent AOP like post. I am aware of basic Reflection and stuff but what you mentioned was something new. Does .Net have something similar?
Also I have changed my display name. Simply to get codeword as a link when I search for myself on google. ;). I do get a few hits at ncb.ernet.in and a few linux posts I made, but codeWord would be much better to be linked to.
See this link from James Gosling's blog. Follow links to the Solaris guys blog and then the HP's original post. Surely will lift your spirits. Hey Hrishi, what do you think of Solaris getting open sourced?
Mohn.. could you post more on the Java Proxy classes you mentioned in your recent AOP like post. I am aware of basic Reflection and stuff but what you mentioned was something new. Does .Net have something similar?
Also I have changed my display name. Simply to get codeword as a link when I search for myself on google. ;). I do get a few hits at ncb.ernet.in and a few linux posts I made, but codeWord would be much better to be linked to.
See this link from James Gosling's blog. Follow links to the Solaris guys blog and then the HP's original post. Surely will lift your spirits. Hey Hrishi, what do you think of Solaris getting open sourced?
Tuesday, November 16, 2004
Re: Secret Key Cryptography
I didn't understand this. What dyou mean 25 times in a row?
I'll post the entire unix password encryption process a little later. However, in brief - while storing passwds, unix encodes a block of 64 zeroes using the key got from the passwd entered by the user. The cipher text is again encoded using the key. This process is done 25 times. So when someone is attempting to log on, the system compares the final cipher text got from the passwd entered by the user to the cipher text got from the passwd the user entered when the account was created (or the passwd was last changed). If the cipher text matches, he's in.
This method of encrypting 25 times was done to slow down the passwd cracking process (basically the key search) 25 times. However, with the computing power available today I don't think it's of a whole lot of importance. If you go through the link I'd posted on DES, you'll see that it uses certain tables to encrypt stuff. The unix passwd encryption system tables different from those specified in the standard DES. This is done so that hardware encryption chips for DES can't be used to crack unix passwds.
Yeah Crypto is an interesting topic. I guess lots of maths is involved. I've read that since a lot of it comes down to factoring large numbers, quantum computers would basically shatter all encription. So they need to come up with new methods to secure data.
The security of the cryptosystems basically depends on the computational infeasibility in factoring large *prime* numbers. Their feasibility comes from the fact that it's easy to generate large primes. As computing power increases, larger key sizes are being used. Don't know much about the exact speed of quantum computers but to keep the current systems secure they'll have to use obscenely large key sizes or like you said come up with new encryption algorithms.
I'll post the entire unix password encryption process a little later. However, in brief - while storing passwds, unix encodes a block of 64 zeroes using the key got from the passwd entered by the user. The cipher text is again encoded using the key. This process is done 25 times. So when someone is attempting to log on, the system compares the final cipher text got from the passwd entered by the user to the cipher text got from the passwd the user entered when the account was created (or the passwd was last changed). If the cipher text matches, he's in.
This method of encrypting 25 times was done to slow down the passwd cracking process (basically the key search) 25 times. However, with the computing power available today I don't think it's of a whole lot of importance. If you go through the link I'd posted on DES, you'll see that it uses certain tables to encrypt stuff. The unix passwd encryption system tables different from those specified in the standard DES. This is done so that hardware encryption chips for DES can't be used to crack unix passwds.
Yeah Crypto is an interesting topic. I guess lots of maths is involved. I've read that since a lot of it comes down to factoring large numbers, quantum computers would basically shatter all encription. So they need to come up with new methods to secure data.
The security of the cryptosystems basically depends on the computational infeasibility in factoring large *prime* numbers. Their feasibility comes from the fact that it's easy to generate large primes. As computing power increases, larger key sizes are being used. Don't know much about the exact speed of quantum computers but to keep the current systems secure they'll have to use obscenely large key sizes or like you said come up with new encryption algorithms.
Re: Secret Key Cryptography
BTW, the unix password encryption uses DES... 25 times in a row.
I didn't understand this. What dyou mean 25 times in a row?
Yeah Crypto is an interesting topic. I guess lots of maths is involved. I've read that since a lot of it comes down to factoring large numbers, quantum computers would basically shatter all encription. So they need to come up with new methods to secure data.
I didn't understand this. What dyou mean 25 times in a row?
Yeah Crypto is an interesting topic. I guess lots of maths is involved. I've read that since a lot of it comes down to factoring large numbers, quantum computers would basically shatter all encription. So they need to come up with new methods to secure data.
Secret Key Cryptography
This is typically a 'symmetric' type of cryptosystem. You use the same key for encryption and decryption; which is why the key needs to be kept 'secret'. The most commonly used encryption algorithm is the DES (Data Encryption Standard).
DES is a block cipher. It operates on 64-bit blocks. It has a 56-bit key. The actual encryption algorithm is very complex. I won't go into the details (that's because I don't remember most of it! ;-)). However it uses several permutations; generates 16 keys from the first main key and then does a whole lot of stuff before coming up with the cipher text.
The way to crack DES is to try out all the 2^56 keys! That entails *massive* computing power; however it can be done. May take days and months to crack the key for one message but it can be done. So it's not entirely secure.
So what they do is they use Triple-DES. It uses 3 keys - that gives an effective key size of 168 bits. Now that's almost impossible to crack with the current computing power that we have. Security guru Bruce Schneiner (not sure of the spelling) said - There isn't enough silicon in the galaxy or enough time before the sun burns out to brute-force Triple-DES.
Here's a lot of info about DES.
BTW, the unix password encryption uses DES... 25 times in a row.
DES is a block cipher. It operates on 64-bit blocks. It has a 56-bit key. The actual encryption algorithm is very complex. I won't go into the details (that's because I don't remember most of it! ;-)). However it uses several permutations; generates 16 keys from the first main key and then does a whole lot of stuff before coming up with the cipher text.
The way to crack DES is to try out all the 2^56 keys! That entails *massive* computing power; however it can be done. May take days and months to crack the key for one message but it can be done. So it's not entirely secure.
So what they do is they use Triple-DES. It uses 3 keys - that gives an effective key size of 168 bits. Now that's almost impossible to crack with the current computing power that we have. Security guru Bruce Schneiner (not sure of the spelling) said - There isn't enough silicon in the galaxy or enough time before the sun burns out to brute-force Triple-DES.
Here's a lot of info about DES.
BTW, the unix password encryption uses DES... 25 times in a row.
Virtual functions called from ctors and dtors
Here's an interesting difference between C++ and C#.
Consider these two classes...
// C++
class Base
{
public:
Base()
{
cout >> "Base::ctor()\n";
method();
}
~Base()
{
cout >> "Base::dtor()\n";
method();
}
virtual void method()
{
cout >> "Base::method()\n";
}
};
class Derived : public Base
{
public:
Derived()
{
cout >> "Derived::ctor()\n";
}
~Derived()
{
cout >> "Derived::dtor()\n";
}
virtual void method()
{
cout >> "Derived::method()\n";
}
};
What dyou think this prints?
{
Base b* = new Derived;
b->method();
delete b;
}
The output is:
Base::ctor()
Base::method()
Derived::ctor()
Derived::method()
Derived::dtor()
Base::dtor()
Base::method()
But if you have the same two classes in C#, the output is:
Base::ctor()
Derived::method()
Derived::ctor()
Derived::method()
Derived::dtor()
Base::dtor()
Derived::method()
The derived method is ALWAYS called.
The reason is that in C++, the type of an object changes. When you create a new Derived object, it's constructor calls Base's constructor automatically. In Base's constructor, the type of the object is "Base". So when you call method() in its constructor, all it knows about is itself. So it calls its own method(). Only after you get to Derived's constructor will the object's type be "Derived". Same thing with destruction. Derived's destructor runs first, destroying itself. It then goes up to Base's destructor. Again at this point Base only knows about itself and calls its own method().
It's different in C#. An object can only ever have one (fixed) type. It doesn't morph like in C++. So when you call Derived's constructor, it calls Base's constructor automatically. But at this point the type of the object has already been set to "Derived" and the system knows that it has overriden method(). So in Base's constructor, method() drops down to Derived's implementation. Same with destruction.
Apparently, the difference in C# has to do with the fact that it has a GC. The GC always needs to know the exact size of the object... it can't change. I dunno if this is the case in Java as well. I would assume so.
Personally, I feel the C++ way makes more sense. It's more logical. What dyou think?
Consider these two classes...
// C++
class Base
{
public:
Base()
{
cout >> "Base::ctor()\n";
method();
}
~Base()
{
cout >> "Base::dtor()\n";
method();
}
virtual void method()
{
cout >> "Base::method()\n";
}
};
class Derived : public Base
{
public:
Derived()
{
cout >> "Derived::ctor()\n";
}
~Derived()
{
cout >> "Derived::dtor()\n";
}
virtual void method()
{
cout >> "Derived::method()\n";
}
};
What dyou think this prints?
{
Base b* = new Derived;
b->method();
delete b;
}
The output is:
Base::ctor()
Base::method()
Derived::ctor()
Derived::method()
Derived::dtor()
Base::dtor()
Base::method()
But if you have the same two classes in C#, the output is:
Base::ctor()
Derived::method()
Derived::ctor()
Derived::method()
Derived::dtor()
Base::dtor()
Derived::method()
The derived method is ALWAYS called.
The reason is that in C++, the type of an object changes. When you create a new Derived object, it's constructor calls Base's constructor automatically. In Base's constructor, the type of the object is "Base". So when you call method() in its constructor, all it knows about is itself. So it calls its own method(). Only after you get to Derived's constructor will the object's type be "Derived". Same thing with destruction. Derived's destructor runs first, destroying itself. It then goes up to Base's destructor. Again at this point Base only knows about itself and calls its own method().
It's different in C#. An object can only ever have one (fixed) type. It doesn't morph like in C++. So when you call Derived's constructor, it calls Base's constructor automatically. But at this point the type of the object has already been set to "Derived" and the system knows that it has overriden method(). So in Base's constructor, method() drops down to Derived's implementation. Same with destruction.
Apparently, the difference in C# has to do with the fact that it has a GC. The GC always needs to know the exact size of the object... it can't change. I dunno if this is the case in Java as well. I would assume so.
Personally, I feel the C++ way makes more sense. It's more logical. What dyou think?
Re: Happy Birthday CODEWORD
Good catch Rahul. I didn't remember myself. And I saw the post on the 14th but took my lazy ass till today to reply.
Overall I've been very happy. Pretty much exactly what I had hoped it would be about. Got a lot out of it and some discussions have been very insightful. Dyou ever go back and read previous posts? Sometimes I'm quite surprised and sometimes laugh at dumb stuff (mostly Rahul's posts ;-).
Here's to another good year... Cheers!
Overall I've been very happy. Pretty much exactly what I had hoped it would be about. Got a lot out of it and some discussions have been very insightful. Dyou ever go back and read previous posts? Sometimes I'm quite surprised and sometimes laugh at dumb stuff (mostly Rahul's posts ;-).
Here's to another good year... Cheers!
hey!
Hey guys,
I'm back. Not much techie stuff to write right now but I'm back on the blog... good to be back!
Recently I've gotten interested in stuff like crytography, security etc. Uses a lot of number theory and it's fascinating. I'll try and post some related stuff soon.
I'm back. Not much techie stuff to write right now but I'm back on the blog... good to be back!
Recently I've gotten interested in stuff like crytography, security etc. Uses a lot of number theory and it's fascinating. I'll try and post some related stuff soon.
Sunday, November 14, 2004
Happy Birthday CODEWORD
Well its been one year since Codeword began. Hopefully we'll go on much longer and discuss more tech stuff. And lots of years from now, look back and laugh at some really lame posts, like those from Me!!
Friday, November 12, 2004
AOP
So all this talk of Aspect Oriented Programming going on right now. Still don't have a crystal clear picture of what it involves but I'm beginning to understand what it's about and its benefits.
We had a project in my CS class which helped me understand the potential of AOP. My prof had no clue about AOP so that was not his intent - just something I realized on my own after our discussions on the subject.
We had to create a proxy object. The client would provide a list of interfaces and implementations for the proxy object. Essentially the way it would work is that instead of having a concrete class that implements certain interfaces and has an implementation, you would only have a proxy object and tell it to dynamically create objects that implement the interfaces and have access to classes that provide an implementation for the interfaces.
Proxy
|-----------|
|If1 | Imp1 |
|If2 | Imp2 |
|If3 | Imp3 |
|-----------|
So if you have a handle to the proxy object, you can call any of the methods on the interfaces it implements, but first you would need to cast it...
Class[] interfaces = new Class[] { Class.forName( "If1" ), Class.forName( "If2" ), Class.forName( "If3" ) };
Class[] implementations = new Class[] { Class.forName( "Imp1" ), Class.forName( "Imp2" ), Class.forName( "Imp3" ) };
Object proxy = ProxyFactory.getNewInstance( interfaces, implementations );
If1 interface1 = (If1) proxy;
interface1.someMethod1(); // 1
If2 interface2 = (If2) proxy;
interface2.someMethod2(); // 2
So the way this works is that the proxy object internally has an InvocationHandler. The InvocationHandler intercepts any calls on the proxy object. So when 1 is executed, you get to the InvocationHandler and the system tells it which method is being called (someMethod1) and on what interface (If1). So at this point, InvocationHandler will create an object of type Imp1 and actually call the method on that object. Same thing when 2 is executed. In this case, an instance of type Imp2 is created and the someMethod2 is called on it.
interface1.someMethod1() --> Proxy --> InvocationHandler --> ( new Imp1() ).someMethod1() --> Return
interface2.someMethod1() --> Proxy --> InvocationHandler --> ( new Imp2() ).someMethod2() --> Return
Basically what this provides is a level of indirection. This is possible in large part because of reflection. The most important part is that your InvocationHandler is the one calling the actual method implementation. Normally we would manually create an object of Imp1 or Imp2 and called the respective methods, but here we don't interact with them directly. So you could executed some additional code before and after the method is called. The most common example for AOP given is Logging. So we could log information before or after the method call is made.
interface1.someMethod1() --> Proxy --> InvocationHandler --> Log --> ( new Imp1() ).someMethod1() --> Log --> Return
interface2.someMethod1() --> Proxy --> InvocationHandler --> Log --> ( new Imp2() ).someMethod2() --> Log --> Return
This ability to inject your own functionality between someone else's method calls is quite interesting.
We had a project in my CS class which helped me understand the potential of AOP. My prof had no clue about AOP so that was not his intent - just something I realized on my own after our discussions on the subject.
We had to create a proxy object. The client would provide a list of interfaces and implementations for the proxy object. Essentially the way it would work is that instead of having a concrete class that implements certain interfaces and has an implementation, you would only have a proxy object and tell it to dynamically create objects that implement the interfaces and have access to classes that provide an implementation for the interfaces.
Proxy
|-----------|
|If1 | Imp1 |
|If2 | Imp2 |
|If3 | Imp3 |
|-----------|
So if you have a handle to the proxy object, you can call any of the methods on the interfaces it implements, but first you would need to cast it...
Class[] interfaces = new Class[] { Class.forName( "If1" ), Class.forName( "If2" ), Class.forName( "If3" ) };
Class[] implementations = new Class[] { Class.forName( "Imp1" ), Class.forName( "Imp2" ), Class.forName( "Imp3" ) };
Object proxy = ProxyFactory.getNewInstance( interfaces, implementations );
If1 interface1 = (If1) proxy;
interface1.someMethod1(); // 1
If2 interface2 = (If2) proxy;
interface2.someMethod2(); // 2
So the way this works is that the proxy object internally has an InvocationHandler. The InvocationHandler intercepts any calls on the proxy object. So when 1 is executed, you get to the InvocationHandler and the system tells it which method is being called (someMethod1) and on what interface (If1). So at this point, InvocationHandler will create an object of type Imp1 and actually call the method on that object. Same thing when 2 is executed. In this case, an instance of type Imp2 is created and the someMethod2 is called on it.
interface1.someMethod1() --> Proxy --> InvocationHandler --> ( new Imp1() ).someMethod1() --> Return
interface2.someMethod1() --> Proxy --> InvocationHandler --> ( new Imp2() ).someMethod2() --> Return
Basically what this provides is a level of indirection. This is possible in large part because of reflection. The most important part is that your InvocationHandler is the one calling the actual method implementation. Normally we would manually create an object of Imp1 or Imp2 and called the respective methods, but here we don't interact with them directly. So you could executed some additional code before and after the method is called. The most common example for AOP given is Logging. So we could log information before or after the method call is made.
interface1.someMethod1() --> Proxy --> InvocationHandler --> Log --> ( new Imp1() ).someMethod1() --> Log --> Return
interface2.someMethod1() --> Proxy --> InvocationHandler --> Log --> ( new Imp2() ).someMethod2() --> Log --> Return
This ability to inject your own functionality between someone else's method calls is quite interesting.
Saturday, October 30, 2004
BigInt Division
Mohn suggested sharing some of the BigInt code. The most interesting method I wrote was for division. And it is highly in-efficient, but I feel interesting. The general long division learnt in Algebra class if implemented is more efficient.
Assume that the other BigInt operations like <, *, - etc have already been implemented. I'll try to add descriptive comments within the code. (something which I should make a practice!!)
We were asked to implement a BigInt containing upto 100 digits. So I used a vector for that and a bool for sign of the number.
Here goes...
BigInt BigInt::
operator/(const BigInt& rhs) {
//hard code for RHS == zero
BigInt* zeroBigInt = new BigInt(0);
if ( (*this) == (*zeroBigInt) ) {
return *zeroBigInt;
}
//create copies of both lhs and rhs without sign
//set the sign of the answer later
//from now, lhs and rhs are the positive values of the numbers
BigInt* tempThis = new BigInt(*this);
tempThis->sign = true;
BigInt* tempRhs = new BigInt(rhs);
tempRhs->sign = true;
//if lhs < rhs value return 0
if ( (*tempThis)<(*tempRhs) ) {
delete tempThis;
delete tempRhs;
return *zeroBigInt;
}
//int quotient = 0;
//int factor = 0;
BigInt* quotient = new BigInt(0);
//get number of digits of lhs and rhs
int tempThisSize = tempThis->bigInt->size();
int tempRhsSize = tempRhs->bigInt->size();
//the difference between the two sizes should be atleast 2 digits
//tempThisSize will be decremented in the loop
while ( (tempThisSize) > (tempRhsSize+1) ){
//get the greatest factor of ten which is 2 digits smaller than lhs
BigInt* factor = new BigInt(1);
BigInt* tenBigInt = new BigInt(10);
for (int i=0; i<(tempThisSize-tempRhsSize-1); i++){
(*factor) = (*factor) * (*tenBigInt);
}
//cout << "factor " << (*factor) << endl;
(*quotient) = (*quotient) + (*factor);
//factorTemp is a copy of factor
BigInt* factorTemp = new BigInt(*factor);
//now increment the quotient by factor
//assume that we obtained a factor of 100 earlier
//in this step quotient is incremented by values of 100
//as 200, 300, .. till the muliplication tempThis is just exceeded
while( (*tempThis) >= (*zeroBigInt) ) {
(*tempThis) = (*tempThis) - ( (*factorTemp) * (*tempRhs) );
(*quotient) = (*quotient) + (*factor);
//cout << quotient << " " << (*tempThis) << " " << (*factorTemp) << endl;
}
//as a factor just higher than required has been taken
//perform a rollback
(*tempThis) = (*tempThis) + ( (*factorTemp) * (*tempRhs) );
(*quotient) = (*quotient) - (*factor) - (*factor);
delete tenBigInt;
delete factor;
delete factorTemp;
//cout << (*quotient) << " " << (*tempThis) << " " << endl;
//keep reducing tempThisSize
//if the earlier factor was 1000, now 100 can be generated
//so approaching the correct value
tempThisSize--;
}
//cout << "finished factor part!!" << endl;
//now to division by simple subtraction
//in the worst case, we'll have perform subtraction 99 times
BigInt* oneBigInt = new BigInt(1);
while ( (*tempThis) >= (*zeroBigInt) ) {
(*tempThis) = (*tempThis) - (*tempRhs);
(*quotient) = (*quotient) + (*oneBigInt);
//cout << (*quotient) << endl;
}
(*quotient) = (*quotient) - (*oneBigInt);
delete oneBigInt;
//set the sign of the output number
if ( (this->sign)==(rhs.sign) ) {
quotient->sign = true;
} else {
quotient->sign = false;
}
//some housekeeping and return
delete zeroBigInt;
delete tempThis;
delete tempRhs;
return *quotient;
}
Could have obtained a better perf if I created all the temporary BigInt's on the stack. Any more pointers? Any different algo's?
Assume that the other BigInt operations like <, *, - etc have already been implemented. I'll try to add descriptive comments within the code. (something which I should make a practice!!)
We were asked to implement a BigInt containing upto 100 digits. So I used a vector
Here goes...
BigInt BigInt::
operator/(const BigInt& rhs) {
//hard code for RHS == zero
BigInt* zeroBigInt = new BigInt(0);
if ( (*this) == (*zeroBigInt) ) {
return *zeroBigInt;
}
//create copies of both lhs and rhs without sign
//set the sign of the answer later
//from now, lhs and rhs are the positive values of the numbers
BigInt* tempThis = new BigInt(*this);
tempThis->sign = true;
BigInt* tempRhs = new BigInt(rhs);
tempRhs->sign = true;
//if lhs < rhs value return 0
if ( (*tempThis)<(*tempRhs) ) {
delete tempThis;
delete tempRhs;
return *zeroBigInt;
}
//int quotient = 0;
//int factor = 0;
BigInt* quotient = new BigInt(0);
//get number of digits of lhs and rhs
int tempThisSize = tempThis->bigInt->size();
int tempRhsSize = tempRhs->bigInt->size();
//the difference between the two sizes should be atleast 2 digits
//tempThisSize will be decremented in the loop
while ( (tempThisSize) > (tempRhsSize+1) ){
//get the greatest factor of ten which is 2 digits smaller than lhs
BigInt* factor = new BigInt(1);
BigInt* tenBigInt = new BigInt(10);
for (int i=0; i<(tempThisSize-tempRhsSize-1); i++){
(*factor) = (*factor) * (*tenBigInt);
}
//cout << "factor " << (*factor) << endl;
(*quotient) = (*quotient) + (*factor);
//factorTemp is a copy of factor
BigInt* factorTemp = new BigInt(*factor);
//now increment the quotient by factor
//assume that we obtained a factor of 100 earlier
//in this step quotient is incremented by values of 100
//as 200, 300, .. till the muliplication tempThis is just exceeded
while( (*tempThis) >= (*zeroBigInt) ) {
(*tempThis) = (*tempThis) - ( (*factorTemp) * (*tempRhs) );
(*quotient) = (*quotient) + (*factor);
//cout << quotient << " " << (*tempThis) << " " << (*factorTemp) << endl;
}
//as a factor just higher than required has been taken
//perform a rollback
(*tempThis) = (*tempThis) + ( (*factorTemp) * (*tempRhs) );
(*quotient) = (*quotient) - (*factor) - (*factor);
delete tenBigInt;
delete factor;
delete factorTemp;
//cout << (*quotient) << " " << (*tempThis) << " " << endl;
//keep reducing tempThisSize
//if the earlier factor was 1000, now 100 can be generated
//so approaching the correct value
tempThisSize--;
}
//cout << "finished factor part!!" << endl;
//now to division by simple subtraction
//in the worst case, we'll have perform subtraction 99 times
BigInt* oneBigInt = new BigInt(1);
while ( (*tempThis) >= (*zeroBigInt) ) {
(*tempThis) = (*tempThis) - (*tempRhs);
(*quotient) = (*quotient) + (*oneBigInt);
//cout << (*quotient) << endl;
}
(*quotient) = (*quotient) - (*oneBigInt);
delete oneBigInt;
//set the sign of the output number
if ( (this->sign)==(rhs.sign) ) {
quotient->sign = true;
} else {
quotient->sign = false;
}
//some housekeeping and return
delete zeroBigInt;
delete tempThis;
delete tempRhs;
return *quotient;
}
Could have obtained a better perf if I created all the temporary BigInt's on the stack. Any more pointers? Any different algo's?
Monday, October 25, 2004
Re: C#
In the current module we are being taught programming in C/C++. C was just 2 sessions. C++ has more sessions but still really fast. And we are covering the new std C++. One of the C++ assignments is to create a Big Integer (BigInt) data type. The BigInt can have upto 100 digits and we are supposed to overload operators for < , > , == , +, - , / , % and few others. Just completed this one and division (/) has been amazing to code!!
I had to create a BigInteger in my "Generic Programming and the STL" class too. I'd be quite interested in seeing your code. I'll send you mine if you want.
I've always wanted to learn more programming languages. I think we agree that to be a complete dev have to know more than a particular lang. Good to appreciate design of each lang. Its just that I've been too lazy. Once you've entered the comfort zone with a lang, its hard to get out.
C++ has been a good experience. Lots to learn still but seen some really cool stuff. I dunno if I'll ever do stuff like python etc..
Yup, I think it's important not only to learn different languages, but also different paradigms like procedural, object oriented, generic etc... Also different types like functional languages (Haskell) and dynamically typed langauges (Python). Maybe you won't use it day to day, but it's always good to have that perspective.
I guess it's a question of time and priority. Learning different languages is fine, but you need to specialize in one or two which will be your bread and butter. And something like C++ it's no easy task. Rest are the "good to know" type.
There's a limit to how much you can understand by reading.
Couldn't have said it any better myself. In reading vs actual coding, there is a world of difference.
I had to create a BigInteger in my "Generic Programming and the STL" class too. I'd be quite interested in seeing your code. I'll send you mine if you want.
I've always wanted to learn more programming languages. I think we agree that to be a complete dev have to know more than a particular lang. Good to appreciate design of each lang. Its just that I've been too lazy. Once you've entered the comfort zone with a lang, its hard to get out.
C++ has been a good experience. Lots to learn still but seen some really cool stuff. I dunno if I'll ever do stuff like python etc..
Yup, I think it's important not only to learn different languages, but also different paradigms like procedural, object oriented, generic etc... Also different types like functional languages (Haskell) and dynamically typed langauges (Python). Maybe you won't use it day to day, but it's always good to have that perspective.
I guess it's a question of time and priority. Learning different languages is fine, but you need to specialize in one or two which will be your bread and butter. And something like C++ it's no easy task. Rest are the "good to know" type.
There's a limit to how much you can understand by reading.
Couldn't have said it any better myself. In reading vs actual coding, there is a world of difference.
Google's browser plans
http://mozillanews.org/?article_date=2004-10-19+01-52-31
All speculation of course. But if they do eventually release something like that it would be the ultimate Windows/Web hybrid application. Seems like they are will be just tieing all their web properties into a client app.
All speculation of course. But if they do eventually release something like that it would be the ultimate Windows/Web hybrid application. Seems like they are will be just tieing all their web properties into a client app.
Sunday, October 10, 2004
Re: C# ?
what's Mgpt? So are they going to teach you C/C++ in this next module or just use it for your programming?
Mgpt is one of the assessment methods here at Ncb. You'll get lots of info here . To put it simply, is a sort of a topcoder puzzle solving contest. Complexity of problems varies from "very difficult" to "writing a compiler is easier" levels. We have to clear Mgpt's for two modules, Java programming and Data Structures using Java. Generally only 3-4 students clear both in the entire year.
In the current module we are being taught programming in C/C++. C was just 2 sessions. C++ has more sessions but still really fast. And we are covering the new std C++. One of the C++ assignments is to create a Big Integer (BigInt) data type. The BigInt can have upto 100 digits and we are supposed to overload operators for < , > , == , +, - , / , % and few others. Just completed this one and division (/) has been amazing to code!!
In the next modules we have to create projects and no assignment problems as such. In those we can choose any language of implementation, Java or C++. No prizes for guessing what I'll prefer.
Just for an overview - C# programming
I have a super huge grin on me face. You don't know how happy this made me. Change is good :-)
I've always wanted to learn more programming languages. I think we agree that to be a complete dev have to know more than a particular lang. Good to appreciate design of each lang. Its just that I've been too lazy. Once you've entered the comfort zone with a lang, its hard to get out.
C++ has been a good experience. Lots to learn still but seen some really cool stuff. I dunno if I'll ever do stuff like python etc..
So hope that cleared some stuff up. What are your impressions of .NET from the book. I've been blogging a lot about this stuff so you should be familiar with some of it already - atleast I hope.
I had to switch to C++ so didn't do much. Most of the explanations you gave caused me to wonder.. what happens in Java. So I'll probably research on this for some time.
All your blogs on C# have been super helpful. I still have a few doubts, but those will get fixed only when I start coding. There's a limit to how much you can understand by reading.
Mgpt is one of the assessment methods here at Ncb. You'll get lots of info here . To put it simply, is a sort of a topcoder puzzle solving contest. Complexity of problems varies from "very difficult" to "writing a compiler is easier" levels. We have to clear Mgpt's for two modules, Java programming and Data Structures using Java. Generally only 3-4 students clear both in the entire year.
In the current module we are being taught programming in C/C++. C was just 2 sessions. C++ has more sessions but still really fast. And we are covering the new std C++. One of the C++ assignments is to create a Big Integer (BigInt) data type. The BigInt can have upto 100 digits and we are supposed to overload operators for < , > , == , +, - , / , % and few others. Just completed this one and division (/) has been amazing to code!!
In the next modules we have to create projects and no assignment problems as such. In those we can choose any language of implementation, Java or C++. No prizes for guessing what I'll prefer.
Just for an overview - C# programming
I have a super huge grin on me face. You don't know how happy this made me. Change is good :-)
I've always wanted to learn more programming languages. I think we agree that to be a complete dev have to know more than a particular lang. Good to appreciate design of each lang. Its just that I've been too lazy. Once you've entered the comfort zone with a lang, its hard to get out.
C++ has been a good experience. Lots to learn still but seen some really cool stuff. I dunno if I'll ever do stuff like python etc..
So hope that cleared some stuff up. What are your impressions of .NET from the book. I've been blogging a lot about this stuff so you should be familiar with some of it already - atleast I hope.
I had to switch to C++ so didn't do much. Most of the explanations you gave caused me to wonder.. what happens in Java. So I'll probably research on this for some time.
All your blogs on C# have been super helpful. I still have a few doubts, but those will get fixed only when I start coding. There's a limit to how much you can understand by reading.
Wednesday, October 06, 2004
Google's domain registrations
There was an article on slashdot regarding the registration of gbrowser.com. Some dude who was as early investor in google said that they weren't going to be entering the newly emerged browser wars. Check out these comments...
Now it makes you wonder why Google registered gbrowser.com?
>> No it doesn't. They also registered googlesucks.com, but I don't
>> think they feel that way about themselves.
>> They registered Googlesucks.com? This is clear evidence
>> they're entering the vacuum cleaner market!
>> Crap! I was hoping it was an adult content
>> search engine :(
Now it makes you wonder why Google registered gbrowser.com?
>> No it doesn't. They also registered googlesucks.com, but I don't
>> think they feel that way about themselves.
>> They registered Googlesucks.com? This is clear evidence
>> they're entering the vacuum cleaner market!
>> Crap! I was hoping it was an adult content
>> search engine :(
Saturday, October 02, 2004
Tuesday, September 28, 2004
Re: C# ?
The DS module in Cdac is over and I just flunked in the Mgpt. The next module is C and C++ programming and so I should have lots of questions coming up soon.
Sorry if you've told me this before already but what's Mgpt? So are they going to teach you C/C++ in this next module or just use it for your programming?
Just for a change I got a book from the library which I plan to go through very fast just for an overview - C# Progamming (with the public beta) by Wrox. So got another bunch of questions...
I have a super huge grin on me face. You don't know how happy this made me. Change is good :-)
Enums in c# are value types. So firstly are data types stored on the stack? And even class instances can be stored on the stack.. so what's the syntax for that?
In .NET there are two sets of objects... Reference and Value types. Reference types are Classes, Interfaces, Delegates, Arrays. Value types are Structs and Enums. Basically, all objects in the system have System.Object as the root object. But value types, also derive from System.ValueType. So you CANNOT create class instances on the stack. You can only create struct instances on the stack, which implicitly derive from System.ValueType. And btw, all primitive types in C# like int, double etc... are structs in the BCL (Base Class Library).
On enums i wanted to compare them with java enums. In java 5.0, enums were added which are actually classes. So when you say enum {something} you are actually extending a class. So enums in java are pretty advanced. I'll have to read more to give more info. What about c#? You can get more info on Enums from this Oreilly sample chapter
I guess again the motivation for making enums classes was for backward/forward compatibility. I scanned the article link you sent briefly and you're right... java enums have much more ability since they are full blown classes. Personally, I don't see the point of this. Enums play a very specific role in C++ and C#. They are just defining type-safe constants as a group. Why complicate matters by allowing it to do everything a class can do? Why would you want to define methods on an enum? Dyou see a benefit?
Another thing was the huge number of keywords. I read on const and readonly. Are they really required over final?
I dunno the exact number, but I guess C# must have maybe +20 keywords over java.
Regarding const and readonly - they serve two different purposes. const is evaluated at compile time and is implicitly static. So every instance of the class gets only one copy. readonly is evaluated at runtime and are not static. So every instance gets its own copy.
If you make any fields const in your app, when you compile it, the compiler will replace all the fields with the actual value. For ex.
class Math
{
public const double PI = 3.14;
}
class Circle
{
private double circumference( double radius )
{
return 2 * Math.PI * radius;
}
}
Here, it will turn into 2 * 3.14 * radius. The compiler can make this optimization. You can't do it for readonly fields since they are evaluated at runtime.
But readonly fields have a different benefit. What if you shipped this code and then later on realized that PI is wrong or you want to make it more accurate. If you had made it a readonly field, you can just make the change and ship the updated Math class. Your Circle class's Circumference method will automatically use the new updated PI value without re-compiling. Since PI is evaluated at runtime it will automatically use the updated value. But since it's const here, you will have to recompile.
Does final do both?
The main question that propmted this blog was inheritance.virtual override new sealed and abstract... wow so many keywords and complex relationshipsDo you make use of all these keywords?? Isn't the Java style much more simple? Trying to appease c++ programmers, but added awhole extra bunch of words!!
Again, all those keywords serve a purpose just as const vs readonly. They didn't just get keyword happy. I had written a blog regarding polymorphism in C++, Java and C# long back - http://codeword.blogspot.com/2003/12/polymorphism-c-vs-java-vs-c.html. It talks about virtual, override and new. So check it out and see if you think they serve some meaningful purpose.
Java uses one keyword which can be used on classes, methods and fields. They have the same essential meaning for all - preventing things from being changed. C# has taken a different route. They make all methods non-changeable by default and then make you explicitly say if you want to change something. They requires more keywords.
On boxing and unboxing, why the need for a different object class from the default Object class? In Java the wrapper classes for primitives like Integer for int can be cast to Object. Wrt Java 5.0 I think the compiler will be generating casting code which was generally written by hand.
One thing you should understand is that all the types are defined in the .NET BCL. The language itself does NOT define any types. The languages only provide an alias for primitive, string and object types. So in C#, int == System.Int32, long == System.Int64, double == System.Double, string == System.String, object == System.Object etc... Same way VB and Managed C++ provide something similar. So there is no different object class from the default Object class.
So hope that cleared some stuff up. What are your impressions of .NET from the book. I've been blogging a lot about this stuff so you should be familiar with some of it already - atleast I hope.
Btw, check this link out - C# from a Java Developers Perspective. It's a bit old but quite comprehensive and an easy read. He'll have to update it for Tiger. And before you expect some .NET bashing... he's a Microsoft employee.
Sorry if you've told me this before already but what's Mgpt? So are they going to teach you C/C++ in this next module or just use it for your programming?
Just for a change I got a book from the library which I plan to go through very fast just for an overview - C# Progamming (with the public beta) by Wrox. So got another bunch of questions...
I have a super huge grin on me face. You don't know how happy this made me. Change is good :-)
Enums in c# are value types. So firstly are data types stored on the stack? And even class instances can be stored on the stack.. so what's the syntax for that?
In .NET there are two sets of objects... Reference and Value types. Reference types are Classes, Interfaces, Delegates, Arrays. Value types are Structs and Enums. Basically, all objects in the system have System.Object as the root object. But value types, also derive from System.ValueType. So you CANNOT create class instances on the stack. You can only create struct instances on the stack, which implicitly derive from System.ValueType. And btw, all primitive types in C# like int, double etc... are structs in the BCL (Base Class Library).
On enums i wanted to compare them with java enums. In java 5.0, enums were added which are actually classes. So when you say enum {something} you are actually extending a class. So enums in java are pretty advanced. I'll have to read more to give more info. What about c#? You can get more info on Enums from this Oreilly sample chapter
I guess again the motivation for making enums classes was for backward/forward compatibility. I scanned the article link you sent briefly and you're right... java enums have much more ability since they are full blown classes. Personally, I don't see the point of this. Enums play a very specific role in C++ and C#. They are just defining type-safe constants as a group. Why complicate matters by allowing it to do everything a class can do? Why would you want to define methods on an enum? Dyou see a benefit?
Another thing was the huge number of keywords. I read on const and readonly. Are they really required over final?
I dunno the exact number, but I guess C# must have maybe +20 keywords over java.
Regarding const and readonly - they serve two different purposes. const is evaluated at compile time and is implicitly static. So every instance of the class gets only one copy. readonly is evaluated at runtime and are not static. So every instance gets its own copy.
If you make any fields const in your app, when you compile it, the compiler will replace all the fields with the actual value. For ex.
class Math
{
public const double PI = 3.14;
}
class Circle
{
private double circumference( double radius )
{
return 2 * Math.PI * radius;
}
}
Here, it will turn into 2 * 3.14 * radius. The compiler can make this optimization. You can't do it for readonly fields since they are evaluated at runtime.
But readonly fields have a different benefit. What if you shipped this code and then later on realized that PI is wrong or you want to make it more accurate. If you had made it a readonly field, you can just make the change and ship the updated Math class. Your Circle class's Circumference method will automatically use the new updated PI value without re-compiling. Since PI is evaluated at runtime it will automatically use the updated value. But since it's const here, you will have to recompile.
Does final do both?
The main question that propmted this blog was inheritance.virtual override new sealed and abstract... wow so many keywords and complex relationshipsDo you make use of all these keywords?? Isn't the Java style much more simple? Trying to appease c++ programmers, but added awhole extra bunch of words!!
Again, all those keywords serve a purpose just as const vs readonly. They didn't just get keyword happy. I had written a blog regarding polymorphism in C++, Java and C# long back - http://codeword.blogspot.com/2003/12/polymorphism-c-vs-java-vs-c.html. It talks about virtual, override and new. So check it out and see if you think they serve some meaningful purpose.
Java uses one keyword which can be used on classes, methods and fields. They have the same essential meaning for all - preventing things from being changed. C# has taken a different route. They make all methods non-changeable by default and then make you explicitly say if you want to change something. They requires more keywords.
On boxing and unboxing, why the need for a different object class from the default Object class? In Java the wrapper classes for primitives like Integer for int can be cast to Object. Wrt Java 5.0 I think the compiler will be generating casting code which was generally written by hand.
One thing you should understand is that all the types are defined in the .NET BCL. The language itself does NOT define any types. The languages only provide an alias for primitive, string and object types. So in C#, int == System.Int32, long == System.Int64, double == System.Double, string == System.String, object == System.Object etc... Same way VB and Managed C++ provide something similar. So there is no different object class from the default Object class.
So hope that cleared some stuff up. What are your impressions of .NET from the book. I've been blogging a lot about this stuff so you should be familiar with some of it already - atleast I hope.
Btw, check this link out - C# from a Java Developers Perspective. It's a bit old but quite comprehensive and an easy read. He'll have to update it for Tiger. And before you expect some .NET bashing... he's a Microsoft employee.
Re: A9 ??
If I would get a good net connection I think I would. It has a better UI with more features.
The site looks good. They are providing a more "dynamic" user interface and some potentially useful additional features like keeping a history and bookmarking your searches. No doubt about this.
The point I was trying to make is, it is not a huge leap from what google is offering. Essentially, when I search, I want results - that's it. I don't even go to google's website anymore... just use it from the toolbar on Opera, Firefox and IE. So the UI that a9 is offering makes no difference to me since they are just returning google results. If it was using a different technology entirely, then yeah, maybe I'd use it to see how it compares to google (which has set the standard for everybody).
What's your opinion? Dyou agree on the point about functionality?
Do you use rich-UI sites? I know you don't like sites with flash overkill but does this qualify as the same?
Yup, generally I don't like Flash sites. The keyword is "generally". My experience has been that they go totally overboard and are too flashy (pun intended). But that's not to say I don't like rich-UI sites. The best example is GMail. It qualifies as a rich-UI site. And it's superbly designed... extremely simple, but functional and useable.
I know you have an opposite view regarding flash sites.
The site looks good. They are providing a more "dynamic" user interface and some potentially useful additional features like keeping a history and bookmarking your searches. No doubt about this.
The point I was trying to make is, it is not a huge leap from what google is offering. Essentially, when I search, I want results - that's it. I don't even go to google's website anymore... just use it from the toolbar on Opera, Firefox and IE. So the UI that a9 is offering makes no difference to me since they are just returning google results. If it was using a different technology entirely, then yeah, maybe I'd use it to see how it compares to google (which has set the standard for everybody).
What's your opinion? Dyou agree on the point about functionality?
Do you use rich-UI sites? I know you don't like sites with flash overkill but does this qualify as the same?
Yup, generally I don't like Flash sites. The keyword is "generally". My experience has been that they go totally overboard and are too flashy (pun intended). But that's not to say I don't like rich-UI sites. The best example is GMail. It qualifies as a rich-UI site. And it's superbly designed... extremely simple, but functional and useable.
I know you have an opposite view regarding flash sites.
C# ?
The DS module in Cdac is over and I just flunked in the Mgpt. The next module is C and C++ programming and so I should have lots of questions coming up soon.
Just for a change I got a book from the library which I plan to go through very fast just for an overview - C# Progamming (with the public beta) by Wrox. So got another bunch of questions...
Enums in c# are value types. So firstly are data types stored on the stack? And even class instances can be stored on the stack.. so what's the syntax for that? On enums i wanted to compare them with java enums. In java 5.0, enums were added which are actually classes. So when you say enum {something} you are actually extending a class. So enums in java are pretty advanced. I'll have to read more to give more info. What about c#? You can get more info on Enums from this Oreilly sample chapter
Another thing was the huge number of keywords. I read on const and readonly. Are they really required over final?
The main question that propmted this blog was inheritance.virtual override new sealed and abstract... wow so many keywords and complex relationshipsDo you make use of all these keywords?? Isn't the Java style much more simple? Trying to appease c++ programmers, but added awhole extra bunch of words!!
On boxing and unboxing, why the need for a different object class from the default Object class? In Java the wrapper classes for primitives like Integer for int can be cast to Object. Wrt Java 5.0 I think the compiler will be generating casting code which was generally written by hand.
Just for a change I got a book from the library which I plan to go through very fast just for an overview - C# Progamming (with the public beta) by Wrox. So got another bunch of questions...
Enums in c# are value types. So firstly are data types stored on the stack? And even class instances can be stored on the stack.. so what's the syntax for that? On enums i wanted to compare them with java enums. In java 5.0, enums were added which are actually classes. So when you say enum {something} you are actually extending a class. So enums in java are pretty advanced. I'll have to read more to give more info. What about c#? You can get more info on Enums from this Oreilly sample chapter
Another thing was the huge number of keywords. I read on const and readonly. Are they really required over final?
The main question that propmted this blog was inheritance.virtual override new sealed and abstract... wow so many keywords and complex relationshipsDo you make use of all these keywords?? Isn't the Java style much more simple? Trying to appease c++ programmers, but added awhole extra bunch of words!!
On boxing and unboxing, why the need for a different object class from the default Object class? In Java the wrapper classes for primitives like Integer for int can be cast to Object. Wrt Java 5.0 I think the compiler will be generating casting code which was generally written by hand.
Re: A9 ??
Haven't used it much, but don't see it as being anything great. One major thing is the site info and history. Other than that, a bit advanced user interface.
This is my view. How dyou find it? Would you use it over google?
If I would get a good net connection I think I would. It has a better UI with more features. Do you use rich-UI sites? I know you don't like sites with flash overkill but does this qualify as the same?
This is my view. How dyou find it? Would you use it over google?
If I would get a good net connection I think I would. It has a better UI with more features. Do you use rich-UI sites? I know you don't like sites with flash overkill but does this qualify as the same?
Saturday, September 25, 2004
Re: Generics and different interpretations of backwards compatibility
When backward compatibility is mentioned about Java releases, it means that the bytecode is similar to old releases. So new compilers will not generate bytecode which is new. Just the conversion of code like generics to bytecode will be done by the compiler. Other features also need the compiler to generate code. So the VM as such does not need to recognise any new keywords. So the JVM's do not need to change the core.
So what you're saying is that the bytecode that was designed back when Java first came out is set and won't be changed for stuff like generics? And the class file that is generated won't have anything that can't be recognized by previous VMs?
In .NET on the other hand newer bytecode keywords might have been added. So running that code will require different changes in the VM.
This is what I understand. I guess there will have to be changes to the IL and assembly metadata when compiling new features like generics. So you can't load it on previous CLR versions.
Which do you think is better??
I've always understood "backwards compatibility" to mean "be able to run older code on newer platforms without making any changes". This gives you the freedom to make any improvements you want to new stuff as long as older stuff works. And this is what .NET is doing.
Somehow Java is trying to do both things... backwards and forwards. Run old code on newer JVM without problem, and also run newer code on older JVM. But this second part has a catch - you can only use the old APIs. If you want to use new features like API improvements and generics, you will need the newer VM and APIs. I don't see the point. One argument is, there will be a larger installed base, but I mean, you can't use new features so just work with previous APIs and VM.
I'm still confused about something... can you clarify. Is VM and Java API completely separate? So can you use VM 1.5 with API 1.4? I believe this can be done with .NET. If you have the newest version of the CLR, you can use all previous API versions. They plan to have only one CLR in Longhorn.
So what you're saying is that the bytecode that was designed back when Java first came out is set and won't be changed for stuff like generics? And the class file that is generated won't have anything that can't be recognized by previous VMs?
In .NET on the other hand newer bytecode keywords might have been added. So running that code will require different changes in the VM.
This is what I understand. I guess there will have to be changes to the IL and assembly metadata when compiling new features like generics. So you can't load it on previous CLR versions.
Which do you think is better??
I've always understood "backwards compatibility" to mean "be able to run older code on newer platforms without making any changes". This gives you the freedom to make any improvements you want to new stuff as long as older stuff works. And this is what .NET is doing.
Somehow Java is trying to do both things... backwards and forwards. Run old code on newer JVM without problem, and also run newer code on older JVM. But this second part has a catch - you can only use the old APIs. If you want to use new features like API improvements and generics, you will need the newer VM and APIs. I don't see the point. One argument is, there will be a larger installed base, but I mean, you can't use new features so just work with previous APIs and VM.
I'm still confused about something... can you clarify. Is VM and Java API completely separate? So can you use VM 1.5 with API 1.4? I believe this can be done with .NET. If you have the newest version of the CLR, you can use all previous API versions. They plan to have only one CLR in Longhorn.
Re: SUN in the news again!!
Somehow I always get the feeling Sun has a bit of an identity crisis. For ex. with IBM, you know they've put their full force behind Open Source. But with Sun, they support it, don't support it, now Open Sourcing Solaris, attacking Linux. It's hard to see where they will go.
I guess pretty much all closed sourced companies are under pressure now to open their source code to the world because of Linux. Microsoft already opened up Windows to major governments and recently did the same for Office. Sun felt the heat too and so decided to open source Solaris. Dyou see a great benefit from doing this? I guess they are mostly doing this to appease people than get anything out of it. I doubt there will be much community involvment in it as it will always be seen as controlled by Sun. Somehow it seems like a fad right now - Open Source everything... whether it will be of any use or not.
Sun has already open-sourced a lot of stuff and are very open with Java. Personally I do not think that Java should be open-sourced. They have to get the community on their side. Thats a very hard task.
I agree with you. It's a bad idea to open source Java. What they keep saying is Open Standards rather than Open source and that seems a good way to go. Actually, all the source for the Java API's are available. And Java is already quite open in that a lot of companies are involved in improving it.
I guess pretty much all closed sourced companies are under pressure now to open their source code to the world because of Linux. Microsoft already opened up Windows to major governments and recently did the same for Office. Sun felt the heat too and so decided to open source Solaris. Dyou see a great benefit from doing this? I guess they are mostly doing this to appease people than get anything out of it. I doubt there will be much community involvment in it as it will always be seen as controlled by Sun. Somehow it seems like a fad right now - Open Source everything... whether it will be of any use or not.
Sun has already open-sourced a lot of stuff and are very open with Java. Personally I do not think that Java should be open-sourced. They have to get the community on their side. Thats a very hard task.
I agree with you. It's a bad idea to open source Java. What they keep saying is Open Standards rather than Open source and that seems a good way to go. Actually, all the source for the Java API's are available. And Java is already quite open in that a lot of companies are involved in improving it.
Re: Generics and different interpretations of backwards compatibility
I'm actually a bit confused about this. If your new Java 1.5 code can run on previous VM's then you will only be able to use the Java API from previous versions right? You can't use any new functionality added to the library. So you will need to get the new API's anyway?
I am not sure if my explanation is totally correct.
What Mohn said about needing the Java 5.0 VM to run 5.0 API enhancements is correct. When backward compatibility is mentioned about Java releases, it means that the bytecode is similar to old releases. So new compilers will not generate bytecode which is new. Just the conversion of code like generics to bytecode will be done by the compiler. Other features also need the compiler to generate code. So the VM as such does not need to recognise any new keywords. So the JVM's do not need to change the core. Just add the newer libraries (rt.jar). Only one keyword enum has been added in 5.0. Enums are also classes in Java.
In .NET on the other hand newer bytecode keywords might have been added. So running that code will require different changes in the VM.
Which do you think is better??
(I think I made this blog a bit confusing)
I am not sure if my explanation is totally correct.
What Mohn said about needing the Java 5.0 VM to run 5.0 API enhancements is correct. When backward compatibility is mentioned about Java releases, it means that the bytecode is similar to old releases. So new compilers will not generate bytecode which is new. Just the conversion of code like generics to bytecode will be done by the compiler. Other features also need the compiler to generate code. So the VM as such does not need to recognise any new keywords. So the JVM's do not need to change the core. Just add the newer libraries (rt.jar). Only one keyword enum has been added in 5.0. Enums are also classes in Java.
In .NET on the other hand newer bytecode keywords might have been added. So running that code will require different changes in the VM.
Which do you think is better??
(I think I made this blog a bit confusing)
SUN in the news again!!
Well Sun is in the news again as they might open source Solaris and are also changing their strategy by attacking Red Hat.
So got a few interesting links..
Sun's plans...and how they could go wrong
Reflections on OS addiction
I really suggest reading some follow-up blogs from the second link. Really cool.
Sun has already open-sourced a lot of stuff and are very open with Java. Personally I do not think that Java should be open-sourced. They have to get the community on their side. Thats a very hard task.
Is this bad or good for Linux/SUN/MS..?
So got a few interesting links..
Sun's plans...and how they could go wrong
Reflections on OS addiction
I really suggest reading some follow-up blogs from the second link. Really cool.
Sun has already open-sourced a lot of stuff and are very open with Java. Personally I do not think that Java should be open-sourced. They have to get the community on their side. Thats a very hard task.
Is this bad or good for Linux/SUN/MS..?
Friday, September 24, 2004
Generics and different interpretations of backwards compatibility
From Bruce Eckel's blog - http://mindview.net/WebLog/log-0058
Going back to his disappointment at Java generics and erasure. Erasure erases the type info at runtime, so casting is done under the hood w/o programmer's knowledge. .NET retains type info as metadata and is accessible at runtime.
Interesting to see what he writes about backward compatibility. Whereas Java wants to be able to write code using Java 1.5 and be able to run it on previous VM's, .NET wants to be able to run previously developed code in the new CLR w/o recompilation. You can't run newly developed .NET code (v2) on previous versions of CLR.
I'm actually a bit confused about this. If your new Java 1.5 code can run on previous VM's then you will only be able to use the Java API from previous versions right? You can't use any new functionality added to the library. So you will need to get the new API's anyway?
Going back to his disappointment at Java generics and erasure. Erasure erases the type info at runtime, so casting is done under the hood w/o programmer's knowledge. .NET retains type info as metadata and is accessible at runtime.
Interesting to see what he writes about backward compatibility. Whereas Java wants to be able to write code using Java 1.5 and be able to run it on previous VM's, .NET wants to be able to run previously developed code in the new CLR w/o recompilation. You can't run newly developed .NET code (v2) on previous versions of CLR.
I'm actually a bit confused about this. If your new Java 1.5 code can run on previous VM's then you will only be able to use the Java API from previous versions right? You can't use any new functionality added to the library. So you will need to get the new API's anyway?
Tuesday, September 21, 2004
Re: A9 ??
Haven't used it much, but don't see it as being anything great. One major thing is the site info and history. Other than that, a bit advanced user interface. I'd still use google. I mean they are essentially just doing a google search and presenting it in a different way. I don't think this is meant as a competitor. I guess, amazon just wanted to get into the search game and maybe make some money with sponsored links?
This is my view. How dyou find it? Would you use it over google?
This is my view. How dyou find it? Would you use it over google?
gbrowser
There's been some roumors about google working on a browser. Apparently they've even registered gbrowser.com.
I've read on some blogs about google planning on an instant messenger and also a grand plan of a super OS. This is all speculation... nothing official, but it seems they are dipping their bud in a lot of areas.
Google is an exciting young company with a lot of bright ideas. They've been hiring the greatest brains from companies like Microsoft and Sun. Also doing some radical new stuff. Just as an example, on my bus ride to the Uni, there is a huge billboard for a google ad. The ad doesn't say that it's from google. Instead, it asks to solve a problem, which gives you a URL to a website, which asks another problem. If you get through it, they ask you to send your resume. Just some simple stuff like that which I don't think has ever been done before.
Having said all this great stuff about them, I'm a bit skeptical about the google browser, if it is true. I don't see what they could possibly come out with that will be a radical departure from Opera or Firefox, who are setting the standards for browser innovation. Sure, google has great services - search, mail, groups, but I don't see the rational in coming out with a browser just to "connect" all those properties, as some people have been speculating. Do you? And if they do come out with one, what dyou think the reaction of the open source community will be? They are behind Firefox/Mozilla full force.
I've read on some blogs about google planning on an instant messenger and also a grand plan of a super OS. This is all speculation... nothing official, but it seems they are dipping their bud in a lot of areas.
Google is an exciting young company with a lot of bright ideas. They've been hiring the greatest brains from companies like Microsoft and Sun. Also doing some radical new stuff. Just as an example, on my bus ride to the Uni, there is a huge billboard for a google ad. The ad doesn't say that it's from google. Instead, it asks to solve a problem, which gives you a URL to a website, which asks another problem. If you get through it, they ask you to send your resume. Just some simple stuff like that which I don't think has ever been done before.
Having said all this great stuff about them, I'm a bit skeptical about the google browser, if it is true. I don't see what they could possibly come out with that will be a radical departure from Opera or Firefox, who are setting the standards for browser innovation. Sure, google has great services - search, mail, groups, but I don't see the rational in coming out with a browser just to "connect" all those properties, as some people have been speculating. Do you? And if they do come out with one, what dyou think the reaction of the open source community will be? They are behind Firefox/Mozilla full force.
Monday, September 20, 2004
Re: Longhorn Features?
Firstly thanks for all the amazing info you provided.
Last year at their Professional Developer's Conference (PDC), Microsoft announced that Longhorn would include three technology pillars - "Avalon", "Indigo" and "WinFS".
For sometime they had been talking about releasing the "Indigo" set of API's as an add-on to the .NET framework.
There are pro's and con's to this...
blah blah ( :) )
What do you feel about the announcement? You think it's a major advantage for the Linux dudes?
I see the entire Longhorn issue in a different way. Its more of Win vs Win. What I mean to say is that considering all the MAJOR changes in the OS, will the industry accept. I rather think they'll take a wait and watch approach. Especially on the server-side. Btw is Longhorn going to be for the desktop or server? So adoption of a very new technology will be slightly slow. How fast did industry accept the Win NT platform? Is .NET being readily accepted? as a stable platform? I am asking questions here and not being cynical. Thats a reason why I believe an incremental update to the OS is a much better approach.
Will Linux gain in what I feel might be a sluggish initial period? I am not sure. Linux vs Windows will continue to be decided on different factors. Servers do not need the Longhorn features. Same for most co's running word processing apps. So who knows.
The same argument applies to the new Java 5.0 version. There are many new features so when will the industry adopt? We as dev's get excited with new tech. What is the status of Web Services? How many co's use them? (Again a question). I do not think Web Services have been adopted widely enough.
Whats Yukon and the other future stuff?? I read some article somwhere which basically confused all the relationship between the file-system, the database etc!! Whats supposed to do what? And like Mohn (assuming Mohn and I are not the only ones reading codeword anymore!!) mentioned the base FS is something else. So any idea about all the layers?
Other points Mohn raised was the size of the .NET framework and version problems.
The Java runtime Environment is 10Mb+ and the SDK is 30Mb+. Both platforms are mini-OS'es in a way. After Longhorn, .NET might become super huge!! Un-Downloadable !! Java also has so many extensions now (javax) which are pretty huge in size. So thats going to be a bigger problem for Java as MS will bundle .NET in the OS.
On incompatibility between versions there are differences again. In Java, all versions are backward compatible. Even though a section maybe deprecated (say 1.1), even the never versions have to support it. In other words what is marked as deprecated is never removed. This was one promise by SUN to their customers, that Java will always be backward compatible. This is not what the dev's like too much. Obviously this bloats the API and its not "clean" anymore. Having said hat the .NET scene seems more worse? What versioning system is followed in .NET? Any minor/major system? I always get the feeling that .NET is in a sort of a test phase. Maybe after Longhorn, the API will be fixed to atleast some scheme.
Last year at their Professional Developer's Conference (PDC), Microsoft announced that Longhorn would include three technology pillars - "Avalon", "Indigo" and "WinFS".
For sometime they had been talking about releasing the "Indigo" set of API's as an add-on to the .NET framework.
There are pro's and con's to this...
blah blah ( :) )
What do you feel about the announcement? You think it's a major advantage for the Linux dudes?
I see the entire Longhorn issue in a different way. Its more of Win vs Win. What I mean to say is that considering all the MAJOR changes in the OS, will the industry accept. I rather think they'll take a wait and watch approach. Especially on the server-side. Btw is Longhorn going to be for the desktop or server? So adoption of a very new technology will be slightly slow. How fast did industry accept the Win NT platform? Is .NET being readily accepted? as a stable platform? I am asking questions here and not being cynical. Thats a reason why I believe an incremental update to the OS is a much better approach.
Will Linux gain in what I feel might be a sluggish initial period? I am not sure. Linux vs Windows will continue to be decided on different factors. Servers do not need the Longhorn features. Same for most co's running word processing apps. So who knows.
The same argument applies to the new Java 5.0 version. There are many new features so when will the industry adopt? We as dev's get excited with new tech. What is the status of Web Services? How many co's use them? (Again a question). I do not think Web Services have been adopted widely enough.
Whats Yukon and the other future stuff?? I read some article somwhere which basically confused all the relationship between the file-system, the database etc!! Whats supposed to do what? And like Mohn (assuming Mohn and I are not the only ones reading codeword anymore!!) mentioned the base FS is something else. So any idea about all the layers?
Other points Mohn raised was the size of the .NET framework and version problems.
The Java runtime Environment is 10Mb+ and the SDK is 30Mb+. Both platforms are mini-OS'es in a way. After Longhorn, .NET might become super huge!! Un-Downloadable !! Java also has so many extensions now (javax) which are pretty huge in size. So thats going to be a bigger problem for Java as MS will bundle .NET in the OS.
On incompatibility between versions there are differences again. In Java, all versions are backward compatible. Even though a section maybe deprecated (say 1.1), even the never versions have to support it. In other words what is marked as deprecated is never removed. This was one promise by SUN to their customers, that Java will always be backward compatible. This is not what the dev's like too much. Obviously this bloats the API and its not "clean" anymore. Having said hat the .NET scene seems more worse? What versioning system is followed in .NET? Any minor/major system? I always get the feeling that .NET is in a sort of a test phase. Maybe after Longhorn, the API will be fixed to atleast some scheme.
A9 ??
A9 from Amazon is a new search engine.
They have a pretty neat interface and cool options. Similar to the gmail site in a way. Are these the next generation of web-sites? They seem like semi - Rich Internet Applications. (D'yu know what I mean!). You guys seen any similar stuff? With higher bandwidth becoming more common, RIA and better UI's seem to be the way to go. Just like 3-D desktops. Or will they just be more eye-candy??
Also in the A9 FAQ, it is mentioned that they internally use the google service for searching web pages. So how does A9 become a competitor to google? And wouldn't A9 have had to make an agreement with google to use them as a backend(sort of)!!.
P.s: The coolest thing i noticed so far is the site-info after performing a search. And EconomicTimes,IndiaTimes comes in a whopping 12+ seconds. Try finding something slower!!
They have a pretty neat interface and cool options. Similar to the gmail site in a way. Are these the next generation of web-sites? They seem like semi - Rich Internet Applications. (D'yu know what I mean!). You guys seen any similar stuff? With higher bandwidth becoming more common, RIA and better UI's seem to be the way to go. Just like 3-D desktops. Or will they just be more eye-candy??
Also in the A9 FAQ, it is mentioned that they internally use the google service for searching web pages. So how does A9 become a competitor to google? And wouldn't A9 have had to make an agreement with google to use them as a backend(sort of)!!.
P.s: The coolest thing i noticed so far is the site-info after performing a search. And EconomicTimes,IndiaTimes comes in a whopping 12+ seconds. Try finding something slower!!
Tuesday, September 14, 2004
Quake II .net
mms://wm.microsoft.com/ms/msnse/0408/23360/Scott_currie/Quake_Demo_56K_110K_300K.wmv
Video is a MS dev showing Quake II running under .NET
This is a pretty old story... I think summer of last year (told Rahul about this when I was in India). The guys who made Quake, ported their C code to C++ and then compiled it under the .NET CLR. They then added new functionality using managed code. The entire process is quite nicely detailed in this whitepaper, incase you're interested.
They were able to take legacy code and just compile it under .NET without making significant changes. OK, they had to first get it to C++. But after that it was just a recompile. The C++.NET compiler takes your native code and generates MSIL. This means that your app is a ".NET friendly" citizen. You can now come in and create new features using C# or VB.NET or whatever, getting all the benefits of managed code and using the .NET framework, and easily integrate it into this legacy app. Understand that the old code is NOT being GC'd. It still needs manual memory management. But it's able to play nice with managed components with little effort.
I still don't understand the exact process of what happens under the hood, but I think it's pretty damn amazing.
Video is a MS dev showing Quake II running under .NET
This is a pretty old story... I think summer of last year (told Rahul about this when I was in India). The guys who made Quake, ported their C code to C++ and then compiled it under the .NET CLR. They then added new functionality using managed code. The entire process is quite nicely detailed in this whitepaper, incase you're interested.
They were able to take legacy code and just compile it under .NET without making significant changes. OK, they had to first get it to C++. But after that it was just a recompile. The C++.NET compiler takes your native code and generates MSIL. This means that your app is a ".NET friendly" citizen. You can now come in and create new features using C# or VB.NET or whatever, getting all the benefits of managed code and using the .NET framework, and easily integrate it into this legacy app. Understand that the old code is NOT being GC'd. It still needs manual memory management. But it's able to play nice with managed components with little effort.
I still don't understand the exact process of what happens under the hood, but I think it's pretty damn amazing.
Monday, September 13, 2004
Re: Longhorn Features?
What do you think will be the implications of this. Ms guys are happy that there is a release date and non Ms guys are happy as they take it as a Ms defeat. Also is the Win API going to be completely ported to .NET in Longhorn?
Last year at their Professional Developer's Conference (PDC), Microsoft announced that Longhorn would include three technology "pillars" - a new presentation system, "Avalon", a new communications framework (I think it has to do with making web services super easy), "Indigo" and a new file system, "WinFS". And all these would be made accessible through a superset of the .NET framework, "WinFX". Essentially WinFX would replace the current Win32 API and further improve the current .NET framework to include (more or less) the entire Windows API as managed code.
This seemed quite ambitious. It would be the most complex OS ever created. I think they went a bit overboard with their goals, but it's fine - you need to aim high. But the problem for them was that they couldn't give an exact release date. People kept speculating 2006, then 2007 and some even said 2008! If you take the best case of 06, that would still be 5 years since the release of XP... worst case would be 7 years. They would be pulling the trigger on themselves if such a scenario ever came. That's just an insane amount of time between OS releases.
For sometime they had been talking about releasing the "Indigo" set of API's as an add-on to the .NET framework, which would work on previous OS's like Server 03 and XP. Now they have said that even some part of the presentation system, "Avalon", will be made available for downlevel OS's. They didn't give a specific date for all this to be available, but I guess the general timeline will be 06. They also said WinFS won't be released with Longhorn (which is also to be released around 06-07), but will be available as an add-on later on.
There are pro's and con's to this...
One pro is that there are millions of XP systems out there. Having these new capabilities on this installed base will be beneficial to developers. I'm assuming they will release an interim .NET version which will include these technologies and that can be easily deployed/downloaded just as today's Java or .NET frameworks. In this sense, I don't see any benefit to non-MS guys. If anything, it hurts them, since they were hoping that they would get a fresh start when Longhorn comes out - Longhorn install base will start with 0. Now that won't exactly be the case.
The one main con I see (I'm sure there are many others) is that there won't be a common base platform. Devs will need to keep checking to see if this version of Windows has Indigo or Avalon, what version they are running. If they don't have it, to download it or distribute it with their own apps. This is the same problem with .NET today. Not everyone has the framework today. And version 1.1 is 23 mb. Adding Indigo and Avalon will drastically increase that size.
Many people are also saying that if these are going to be available in XP, why would one upgrade to Longhorn when it comes out. They have a point. But I feel that Longhorn capabilities will be superior to what will be released for XP. They talked about three tiers for the presentation systems... based on graphical capabilities. I guess for Longhorn they can just default to the most advanced as it will be released with new machines, which at that time will include the latest graphics cards.
Finally, a lot of them are saying since WinFS won't be released with Longhorn that all the new search capabilities won't be available in Longhorn. I think that WinFS itself is not the file system. It's something that sits on top of the file system (like NTFS) and enables relational database like capabilities which interacts with the underlying file system. I feel they will improve the underlying file system itself for Longhorn which will enable better searching. WinFS will come later to better interact with it.
Having said that, I think it's a bad idea for MS to release Longhorn without WinFS. This is one of the main things people have been waiting for. And it's not going to be released for previous OS's. This is what will differentiate the Longhorn release. MS has been talking about this "unified file system" for a long time and it's dumb for them to delay it further. It should be in Longhorn even if it pushes back the release date.
What do you feel about the announcement? You think it's a major advantage for the Linux dudes?
Last year at their Professional Developer's Conference (PDC), Microsoft announced that Longhorn would include three technology "pillars" - a new presentation system, "Avalon", a new communications framework (I think it has to do with making web services super easy), "Indigo" and a new file system, "WinFS". And all these would be made accessible through a superset of the .NET framework, "WinFX". Essentially WinFX would replace the current Win32 API and further improve the current .NET framework to include (more or less) the entire Windows API as managed code.
This seemed quite ambitious. It would be the most complex OS ever created. I think they went a bit overboard with their goals, but it's fine - you need to aim high. But the problem for them was that they couldn't give an exact release date. People kept speculating 2006, then 2007 and some even said 2008! If you take the best case of 06, that would still be 5 years since the release of XP... worst case would be 7 years. They would be pulling the trigger on themselves if such a scenario ever came. That's just an insane amount of time between OS releases.
For sometime they had been talking about releasing the "Indigo" set of API's as an add-on to the .NET framework, which would work on previous OS's like Server 03 and XP. Now they have said that even some part of the presentation system, "Avalon", will be made available for downlevel OS's. They didn't give a specific date for all this to be available, but I guess the general timeline will be 06. They also said WinFS won't be released with Longhorn (which is also to be released around 06-07), but will be available as an add-on later on.
There are pro's and con's to this...
One pro is that there are millions of XP systems out there. Having these new capabilities on this installed base will be beneficial to developers. I'm assuming they will release an interim .NET version which will include these technologies and that can be easily deployed/downloaded just as today's Java or .NET frameworks. In this sense, I don't see any benefit to non-MS guys. If anything, it hurts them, since they were hoping that they would get a fresh start when Longhorn comes out - Longhorn install base will start with 0. Now that won't exactly be the case.
The one main con I see (I'm sure there are many others) is that there won't be a common base platform. Devs will need to keep checking to see if this version of Windows has Indigo or Avalon, what version they are running. If they don't have it, to download it or distribute it with their own apps. This is the same problem with .NET today. Not everyone has the framework today. And version 1.1 is 23 mb. Adding Indigo and Avalon will drastically increase that size.
Many people are also saying that if these are going to be available in XP, why would one upgrade to Longhorn when it comes out. They have a point. But I feel that Longhorn capabilities will be superior to what will be released for XP. They talked about three tiers for the presentation systems... based on graphical capabilities. I guess for Longhorn they can just default to the most advanced as it will be released with new machines, which at that time will include the latest graphics cards.
Finally, a lot of them are saying since WinFS won't be released with Longhorn that all the new search capabilities won't be available in Longhorn. I think that WinFS itself is not the file system. It's something that sits on top of the file system (like NTFS) and enables relational database like capabilities which interacts with the underlying file system. I feel they will improve the underlying file system itself for Longhorn which will enable better searching. WinFS will come later to better interact with it.
Having said that, I think it's a bad idea for MS to release Longhorn without WinFS. This is one of the main things people have been waiting for. And it's not going to be released for previous OS's. This is what will differentiate the Longhorn release. MS has been talking about this "unified file system" for a long time and it's dumb for them to delay it further. It should be in Longhorn even if it pushes back the release date.
What do you feel about the announcement? You think it's a major advantage for the Linux dudes?
Saturday, September 11, 2004
Longhorn Features?
Recently Microsoft announced that Longhorn will have a reduced set of features. The highly publicized WinFs feature will be scraped for the early version.
What do you think will be the implications of this. Ms guys are happy that there is a release date and non Ms guys are happy as they take it as a Ms defeat. Also is the Win API going to be completely ported to .NET in Longhorn?
P.s: I am fully aware that I am too small an entity to comment on such a huge topic, but hey that's why we have blogspot!!
What do you think will be the implications of this. Ms guys are happy that there is a release date and non Ms guys are happy as they take it as a Ms defeat. Also is the Win API going to be completely ported to .NET in Longhorn?
P.s: I am fully aware that I am too small an entity to comment on such a huge topic, but hey that's why we have blogspot!!
Friday, September 03, 2004
Re: Java's pass "by reference" demystified
An interesting thing to note is that in Java there is no way to create a "swap" method for primitives. A swap method is where you send in two arguments and have their values interchanged. Now, there are wrapper objects for all primitives - like Integer, Doublt etc... It's possible with that. With plain primitives, it's impossible.
Of course, I got to throw in how C# differs. There is a "ref" keyword which does pass by (true) reference as in C++. So you can infact create a swap in C#...
private void swap( ref int x, ref int y )
{
int temp = x;
x = y;
y = temp;
}
Btw, I'm also doing a course on OOP using Java. We got some introductory material on Java fundamentals.
http://www.cs.utexas.edu/users/rockhold/cs371p/handouts/Java-1.pdf
http://www.cs.utexas.edu/users/rockhold/cs371p/handouts/Java-2.pdf
http://www.cs.utexas.edu/users/rockhold/cs371p/handouts/Java-3.pdf
Of course, I got to throw in how C# differs. There is a "ref" keyword which does pass by (true) reference as in C++. So you can infact create a swap in C#...
private void swap( ref int x, ref int y )
{
int temp = x;
x = y;
y = temp;
}
Btw, I'm also doing a course on OOP using Java. We got some introductory material on Java fundamentals.
http://www.cs.utexas.edu/users/rockhold/cs371p/handouts/Java-1.pdf
http://www.cs.utexas.edu/users/rockhold/cs371p/handouts/Java-2.pdf
http://www.cs.utexas.edu/users/rockhold/cs371p/handouts/Java-3.pdf
Java's pass "by reference" demystified (by Rahul)
So finally posting a blog after ages. The course in NCST has been great and I have learnt a lot. Clearing my fundamentals. Or really learning programming for the first time to put it correctly. The first module has been in Java programming and I read a few parts of "The Java Programming Language" by Ken Arnold and James Gosling.
Got an intersting part on passing parameters via methods. Personally I always thought that primitives were passed by value and instances by reference. But the second part is wrong. I'll simply write an excerpt from the book in full knowledge of the copyright violation!!
"..
You should note that when the parameter is an object reference, the object reference - not the objectreference - not the object itself - is what is passed "by value". Thus, you can change which object a parameter refers to inside the method without affecting the reference that was passed. But if you change any fields of the object or invoke methods that change the object's state, the object is changed for every part of the program that holds a reference to it. Here is an example to show this distinction:
class PassRef {
public static void main(String[] args){
Body sirius = new Body("Sirius",null);
System.out.println("before:" + sirius);
commonName(sirius);
System.out.println("after: " + sirius);
}
public static void commonName(Body bodyRef){
bodyRef.name = "Dog Star";
bodyRef = null;
}
}
This program produces the following output:
before: 0 (Sirius)
after: 0 (Dog Star)
Notice that the contents of the object have been modified with a name change, while the reference bodyRef still refers to the Body object even though the method commonName changed the value of its bodyRef parameter to null.
.."
"..
Some people will say incorrectly that objects in Java are "pass by refernce". The term pass by reference properly means that when an argument is passed to a function, the invoked function gets a refernce to the original value, not a copy of its value. If the function modifies its parameter, the value in the calling code will be changed because the argument and parameter use the same slot in memory. If Java had pass-by-reference parameters, there would be a way to declare halveIt so that the preceding code would modify the value of one, or so that commonName could change the variable sirius to null. This is not possible. Java does not pass objects by reference; it passes object refernces by value. Because two copies of the same reference refer to the same actual object, changes made through one reference are visible through the other. There is exactly one parameter passing mode in Java - pass by value - and that keeps things simple.
.."
Did you guys know this?? Any more tips/hacks?
Got an intersting part on passing parameters via methods. Personally I always thought that primitives were passed by value and instances by reference. But the second part is wrong. I'll simply write an excerpt from the book in full knowledge of the copyright violation!!
"..
You should note that when the parameter is an object reference, the object reference - not the object
class PassRef {
public static void main(String[] args){
Body sirius = new Body("Sirius",null);
System.out.println("before:" + sirius);
commonName(sirius);
System.out.println("after: " + sirius);
}
public static void commonName(Body bodyRef){
bodyRef.name = "Dog Star";
bodyRef = null;
}
}
This program produces the following output:
before: 0 (Sirius)
after: 0 (Dog Star)
Notice that the contents of the object have been modified with a name change, while the reference bodyRef still refers to the Body object even though the method commonName changed the value of its bodyRef parameter to null.
.."
"..
Some people will say incorrectly that objects in Java are "pass by refernce". The term pass by reference properly means that when an argument is passed to a function, the invoked function gets a refernce to the original value, not a copy of its value. If the function modifies its parameter, the value in the calling code will be changed because the argument and parameter use the same slot in memory. If Java had pass-by-reference parameters, there would be a way to declare halveIt so that the preceding code would modify the value of one, or so that commonName could change the variable sirius to null. This is not possible. Java does not pass objects by reference; it passes object refernces by value. Because two copies of the same reference refer to the same actual object, changes made through one reference are visible through the other. There is exactly one parameter passing mode in Java - pass by value - and that keeps things simple.
.."
Did you guys know this?? Any more tips/hacks?
Tuesday, August 24, 2004
Exceptions - another implementation difference
Good article on IBM developerworks regarding exceptions.
Another difference in implementation between Java and C#. Java has the checked vs unchecked exceptions. C# just has unchecked. The article does a good job of explaining the thinking behind each implementation.
The problem with checked exceptions is that you need to specify which exceptions you will catch in the method signature. It's a problem because since it's part of the interface, it is essentially set in stone. If ever you refactor the code in the method and those resulting new methods throw new exceptions, you will need to modify the method signature with the added exceptions, thus breaking compatibility. As you go higher up in the code hierarchy you need to make sure that your methods keep adding exceptions that could be thrown in the lower code.
The problem with the C# way is that since there is no information about what exceptions are thrown, you dunno what to catch. You have to rely on the documentation. It's not baked into the system.
There are pro's and con's to each way as is mentioned in the article. I personally don't have a clear opinion on which is better. One thing I read that made sense was that exceptions are supposed to be exceptional. If one is thrown, something is out of the norm. It shouldn't be silently ignored which might be the temptation with Java since you have to keep track at every level.
Overall, I feel there needs to be better literature out there regarding how exactly to handle exceptions in an application. Atleast, I haven't come across too many good articles. As we had discussed before, it doesn't seem right when there are a whole bunch of try catch blocks in your code. It's not the right way.
Another difference in implementation between Java and C#. Java has the checked vs unchecked exceptions. C# just has unchecked. The article does a good job of explaining the thinking behind each implementation.
The problem with checked exceptions is that you need to specify which exceptions you will catch in the method signature. It's a problem because since it's part of the interface, it is essentially set in stone. If ever you refactor the code in the method and those resulting new methods throw new exceptions, you will need to modify the method signature with the added exceptions, thus breaking compatibility. As you go higher up in the code hierarchy you need to make sure that your methods keep adding exceptions that could be thrown in the lower code.
The problem with the C# way is that since there is no information about what exceptions are thrown, you dunno what to catch. You have to rely on the documentation. It's not baked into the system.
There are pro's and con's to each way as is mentioned in the article. I personally don't have a clear opinion on which is better. One thing I read that made sense was that exceptions are supposed to be exceptional. If one is thrown, something is out of the norm. It shouldn't be silently ignored which might be the temptation with Java since you have to keep track at every level.
Overall, I feel there needs to be better literature out there regarding how exactly to handle exceptions in an application. Atleast, I haven't come across too many good articles. As we had discussed before, it doesn't seem right when there are a whole bunch of try catch blocks in your code. It's not the right way.
Tuesday, August 03, 2004
Missed google name opportunities
Saw this on a blog...
Google got it right with Froogle (the site for searching for the least expensive products), but missed the opportunity with news, creating news.google.com instead of noogle. Here is my list of proposed names for sites Google could run:
Google: the general search site
Froogle: for searching for the lowest cost on items
Whoogle: for searching for people
Noogle: for searching news
Screwgle: for searching porn
Boogle: for searching for scary things
Toolgle: for searching for tools
Poogle: for finding the closest bathroom
Loogle: for searching legal (or finding the closest bathroom in England)
Roogle: for finding small kangaroos
Moogle: for searching money (or finding lost cows)
Vousgle: the French site for finding everything about you
Zoogle: search the local animal park
Google got it right with Froogle (the site for searching for the least expensive products), but missed the opportunity with news, creating news.google.com instead of noogle. Here is my list of proposed names for sites Google could run:
Google: the general search site
Froogle: for searching for the lowest cost on items
Whoogle: for searching for people
Noogle: for searching news
Screwgle: for searching porn
Boogle: for searching for scary things
Toolgle: for searching for tools
Poogle: for finding the closest bathroom
Loogle: for searching legal (or finding the closest bathroom in England)
Roogle: for finding small kangaroos
Moogle: for searching money (or finding lost cows)
Vousgle: the French site for finding everything about you
Zoogle: search the local animal park
Sun buys Novell
Quite a few news items have been posted recently on Sun planning to buy Novell like at eweek.
Most say Jonathan Schwartz feels it will hurt IBM for some reason. Firstly I am not sure how much Sun can hurt IBM.
Another relationship struck me.
Novell has Ximian which has Mono... hmm very interesting.
But again Mono has been released under the GPL and LGPL liscences as mentioned here. At least the GPL part can be forked.
So don't be suprised if you hear "Microsoft buys Sun"
Probably one of my worst jokes and its online now!!
Most say Jonathan Schwartz feels it will hurt IBM for some reason. Firstly I am not sure how much Sun can hurt IBM.
Another relationship struck me.
Novell has Ximian which has Mono... hmm very interesting.
But again Mono has been released under the GPL and LGPL liscences as mentioned here. At least the GPL part can be forked.
So don't be suprised if you hear "Microsoft buys Sun"
Probably one of my worst jokes and its online now!!
Saturday, July 31, 2004
Re: Inventory Editor
Here is what I bleieve to be the final version of my Inventory Editor.
This version is a lot more robust and will recover from a lot of painful mistakes made by the user. Made a few bug fixes too.
Dinesh.
This version is a lot more robust and will recover from a lot of painful mistakes made by the user. Made a few bug fixes too.
Dinesh.
Friday, July 30, 2004
Letter to American masses
I got this from http://fourthedition.blogspot.com/
A very sincere letter to the American masses:
"Dear Sir,
I am a senior citizen. During the Clinton Administration I had an extremely good and well paying job. I took numerous vacations and had several vacations homes.
Since President Bush took office, I have watched my entire life change for the worse: I lost my job. I lost my two sons in that terrible Iraqi War.
I lost my home.
I lost my health insurance.
As a matter of fact, I lost virtually everything and became homeless. Adding insult to injury, when the authorities found me living like an animal, instead of helping me, they arrested me.
I will do anything to insure President Bush's defeat in the next election.
I will do anything that Senator Kerry wants to insure that a Democrat is back in the White House come next year. Bush has to go.
I just thought you and your listeners would like to know how one senior citizen views the Bush Administration.
Thank you for taking the time to read my letter.
Sincerely,
Sadaam Hussein"
A very sincere letter to the American masses:
"Dear Sir,
I am a senior citizen. During the Clinton Administration I had an extremely good and well paying job. I took numerous vacations and had several vacations homes.
Since President Bush took office, I have watched my entire life change for the worse: I lost my job. I lost my two sons in that terrible Iraqi War.
I lost my home.
I lost my health insurance.
As a matter of fact, I lost virtually everything and became homeless. Adding insult to injury, when the authorities found me living like an animal, instead of helping me, they arrested me.
I will do anything to insure President Bush's defeat in the next election.
I will do anything that Senator Kerry wants to insure that a Democrat is back in the White House come next year. Bush has to go.
I just thought you and your listeners would like to know how one senior citizen views the Bush Administration.
Thank you for taking the time to read my letter.
Sincerely,
Sadaam Hussein"
Re: Inventory Editor
Pretty good app.
One suggest was why not club menu items 6, 7 and 8 together. It feels a bit redundant. You can have the normal table with the end like .
Total Shopping Cost is...
Total Packing Cost ...
Total Shopping Count ..
Though I might not use it as much coz shopping is not one of my major concerns. One worry is about all the tutorials and articles etc I have downloaded. Needed something like a super Bookmark app with a good way to categorize and search. Any ideas??
One suggest was why not club menu items 6, 7 and 8 together. It feels a bit redundant. You can have the normal table with the end like .
Total Shopping Cost is...
Total Packing Cost ...
Total Shopping Count ..
Though I might not use it as much coz shopping is not one of my major concerns. One worry is about all the tutorials and articles etc I have downloaded. Needed something like a super Bookmark app with a good way to categorize and search. Any ideas??
Inventory Editor
Having to move to bangalore soon got me planning and generally shopping and packing my stuff. I got irritated created stupid txt files of my inventory, so I coded a small program which turned out pretty neat ;)
The file can be found here Windows: Inventory Editor
It's not great or anything but I think it can be pretty handy. Try it out. Revo, obviously this will be of more use to you. Did one cool thing in it, I used a serialization library called Eternity by Nicola Santi :D It was good fun!!
The program supports Adding, Editing and Deleting Inventory Entries. It also supports printing the Inventory to a txt file in a nice format (view the txt file in maximized window mode). No Linux version, yet!
I'll post this on my blog too later and hence the disclaimer in the zip file. Check it out and tell me how it is. I've not found any obvious errors yet, but tell me if you find any. And the Format Specifiers for output are according to my window dimensions, so it may be distorted for you.
By the way, please enter ints where ints are expected and likewise for the other fields. I haven't done any protection against such things. I thought only I'd be using the program.
Dinesh.
The file can be found here Windows: Inventory Editor
It's not great or anything but I think it can be pretty handy. Try it out. Revo, obviously this will be of more use to you. Did one cool thing in it, I used a serialization library called Eternity by Nicola Santi :D It was good fun!!
The program supports Adding, Editing and Deleting Inventory Entries. It also supports printing the Inventory to a txt file in a nice format (view the txt file in maximized window mode). No Linux version, yet!
I'll post this on my blog too later and hence the disclaimer in the zip file. Check it out and tell me how it is. I've not found any obvious errors yet, but tell me if you find any. And the Format Specifiers for output are according to my window dimensions, so it may be distorted for you.
By the way, please enter ints where ints are expected and likewise for the other fields. I haven't done any protection against such things. I thought only I'd be using the program.
Dinesh.
Saturday, July 24, 2004
Re: OOP's basics - Access
Revo, I'm not really sure what you are asking here. Are you asking how Access Control is implemented in C++ / Java? or what is Access Control?
I'll answer the second question here. Consider the following code :
If you are still unclear, keep posting.
Dinesh.
I'll answer the second question here. Consider the following code :
#include "iostream" //replace the double quotes by < >
using namespace std;
class base
{
public:
int bval;
base(){ bval=0;}
};
class deri : public base //Note : Here it is public
{
public:
int dval;
deri(){ dval=1;}
};
class deri2 : public deri
{
public:
int dval2;
deri2(){ dval2 = 2; }
};
int main()
{
deri d1;
deri2 d2;
/* The following code is Legal when "base" is public to "deri"
d1.bval = 9; //bval is accessible because base is now a public part of deri
d2.bval = 10; // same for deri2, cause deri is public to it, which in turn makes base public
*/
/* Now when "base" is protected to "deri", the above code in red is not possible because
of the semantics of the protected key-word, which can be found in any book.
But note here that members of "base" are accessible to "deri2"'s class definition,
It's just that the objects of deri2 can't directly access it. Again all this
just pertains to the semantics of "protected".
For eg: this is legal in this context
deri2() { bval = 2; dval2 = 3; }
*/
/* And when "base" is private to "deri", "deri2" has no access to "base"'s members,
"base" just cannot be seen by "deri2".
*/
system("pause");
return 0;
}
So basically, you can say that Access Control pertains mostly to how the various classes work in Heirarchy of classes. If it's just one base and one derived class, then access control is not of much importance, because as you can see there is no difference then between "private" and "protected", only difference which can be found is between "public" and the other two.
If you are still unclear, keep posting.
Dinesh.
Thursday, July 22, 2004
OOP's basics - Access
Hrishi asked me a basic question on OOP's which I could not answer. How is access to members controlled wrt access of Classes.
I found Controlling Access to Members of a Class.
Is there a thing such as private class Gamma ? Is it the same as class Gamma ? And how does access to members change wrt to the class access ?
I found Controlling Access to Members of a Class.
Is there a thing such as private class Gamma ? Is it the same as class Gamma ? And how does access to members change wrt to the class access ?
Thursday, July 15, 2004
Mono: More than an open source curiosity
http://news.com.com/More+than+an+open-source+curiosity/2008-7344_3-5271084.html?tag=nefd.lede
Mono has the potential to be more successful on the Linux desktop than Java. Most .NET developers are familiar with writing Windows apps. Taking that knowledge over to Linux will be quite easy now with Mono. The UI classes doesn't map one to one (with Mono using GTK#), but the model is close enough to be able to carry over.
Here's an intro to using Mono: http://arstechnica.com/etc/linux/index.html
Mono has the potential to be more successful on the Linux desktop than Java. Most .NET developers are familiar with writing Windows apps. Taking that knowledge over to Linux will be quite easy now with Mono. The UI classes doesn't map one to one (with Mono using GTK#), but the model is close enough to be able to carry over.
Here's an intro to using Mono: http://arstechnica.com/etc/linux/index.html
Re: Java Issues & Directions
So what is MXML? Some eg? How different is XAML? What will be the features?
Well, MXML is what Macromedia is using for Flex. There was a slide in Eckel's presentation that showed some code. That was what I said looked quite similar to ASP.NET code. XAML is going to be for desktop based apps. MXML, like ASP .NET, is for web apps. An interesting idea is if you want to provide an "enhanced" experience for Longhorn, when you visit a website, instead of sending back HTML code, it will send back XAML code. So instead of viewing a UI within the browser, you now get a full fleged Windows app. It would be great if there is some sort of standard that can be implemented on all platforms.
There are a lot of competing technologies in the Java Community. In a way I feel this is very healthy. Ease of development I feel is a different issue. Java is not as close to the stuff like what i think MXML might be. Though tools are improving very rapidly and also the lang after Java 1.5. Btw this is how the latest SWT looks like. It doesn't look native but would you use it?
Definitely agree that the competing technologies make it healthy. Just wondering if there are any efforts in the Java world to come up with something like XAML. As in, declarative UI. This would straightaway make it really easy to build UI's.
The Eclipse app looks great. What languages does it support?
This article should explain most of the stuff. One part I noticed is that there is no EJB equivalent. Isn't ADO for database connectivity? What is COM+ ? Is it a part of .NET?
The article helped clear up some stuff. But I still couldn't figure out what exactly EJB does.
Yeah, ADO .NET is for database connectiviy... equivalant to JDBC. COM+ is stuff like Message Queueing, Transaction management etc... It was available starting with Window 2000. .NET just provides a managed layer on top of it. For ex, there is a Transaction attribute you can apply to methods, which presumably uses COM+. These are called Enterprise Services in .NET. I dunno much about this stuff. I don't really understand what it means to be an "enterprise" app.
Ya.. The video was very helpful. One part i did not understand was about was the advanced generics stuff, Factory etc.
I didn't understand the Factory stuff either. It felt like he was trying to get around the limitations of Generics. Just confused me more.
Firstly I have to say that I appreciate what Eckel had to say about Java. Those were facts and can't deny anything. Everything he said about Generics, Erasure, ease of use I could take. But Cooncurrency did really hurt. .NET has helped Java as well. I hope that things get better and fast.
I thought it was a good video. I felt it was not biased at all. Some dudes when giving talks are so biased it sickens me. He just gave a critical view of what he thought could be better in the platform.
Well, MXML is what Macromedia is using for Flex. There was a slide in Eckel's presentation that showed some code. That was what I said looked quite similar to ASP.NET code. XAML is going to be for desktop based apps. MXML, like ASP .NET, is for web apps. An interesting idea is if you want to provide an "enhanced" experience for Longhorn, when you visit a website, instead of sending back HTML code, it will send back XAML code. So instead of viewing a UI within the browser, you now get a full fleged Windows app. It would be great if there is some sort of standard that can be implemented on all platforms.
There are a lot of competing technologies in the Java Community. In a way I feel this is very healthy. Ease of development I feel is a different issue. Java is not as close to the stuff like what i think MXML might be. Though tools are improving very rapidly and also the lang after Java 1.5. Btw this is how the latest SWT looks like. It doesn't look native but would you use it?
Definitely agree that the competing technologies make it healthy. Just wondering if there are any efforts in the Java world to come up with something like XAML. As in, declarative UI. This would straightaway make it really easy to build UI's.
The Eclipse app looks great. What languages does it support?
This article should explain most of the stuff. One part I noticed is that there is no EJB equivalent. Isn't ADO for database connectivity? What is COM+ ? Is it a part of .NET?
The article helped clear up some stuff. But I still couldn't figure out what exactly EJB does.
Yeah, ADO .NET is for database connectiviy... equivalant to JDBC. COM+ is stuff like Message Queueing, Transaction management etc... It was available starting with Window 2000. .NET just provides a managed layer on top of it. For ex, there is a Transaction attribute you can apply to methods, which presumably uses COM+. These are called Enterprise Services in .NET. I dunno much about this stuff. I don't really understand what it means to be an "enterprise" app.
Ya.. The video was very helpful. One part i did not understand was about was the advanced generics stuff, Factory etc.
I didn't understand the Factory stuff either. It felt like he was trying to get around the limitations of Generics. Just confused me more.
Firstly I have to say that I appreciate what Eckel had to say about Java. Those were facts and can't deny anything. Everything he said about Generics, Erasure, ease of use I could take. But Cooncurrency did really hurt. .NET has helped Java as well. I hope that things get better and fast.
I thought it was a good video. I felt it was not biased at all. Some dudes when giving talks are so biased it sickens me. He just gave a critical view of what he thought could be better in the platform.
Wednesday, July 14, 2004
Re: Java Issues & Directions
He mentioned Macromedia Flex on one slide and showed some code. I was surprised at how similar the MXML code looked to ASP .NET.I somehow feel like Flex is not going to be mainstream for web applications. It's very rare to see a web app use Flash/Shockwave for its front-end.
So what is MXML? Some eg? How different is XAML? What will be the features?
I agree that as of now we are used to HTML etc. But everyone knows that they are very limited. Personally i feel that Flash is the best alternative out there. Especially for Java as it is cross-platform. There are a lot of examples of Flash overuse, but what I saw in the stream was just amazing. Plus it can very easily put an end to all AWT vs SWT vs Swing. The only reason why Flex will not take off coz Macromedia controls it. If it will be opened further, it could become very widely used.
He said some stuff about Java's lack of acceptance on the client. AWT vs SWT vs Swing. Goes back to the easyness thing I mentioned in a previous post. There should be one standard that makes it easy for devs right out of the box
There are a lot of competing technologies in the Java Community. In a way I feel this is very healthy. Ease of development I feel is a different issue. Java is not as close to the stuff like what i think MXML might be. Though tools are improving very rapidly and also the lang after Java 1.5. Btw this is how the latest SWT looks like. It doesn't look native but would you use it?
could you explain the entire array of Java technologies that are out there. J2EE, J2SE, J2ME and how they differ from Java 1.1, Java 1.2 ... Java 1.5. Now they have Java 5.0 right? Also, what about JSP, EJB's and servelets and how are they connected to the versioning?
This article should explain most of the stuff. One part I noticed is that there is no EJB equivalent. Isn't ADO for database connectivity? What is COM+ ? Is it a part of .NET? EJB is one huge API which a lot of dev's feel is bloated and un-necessary. There are alternatives to that too, though I am not aware how they work. I wanted to know how .NET works in that layer. This might be a major advantage of .NET. Also do .NET dev's feel some std stuff needs to be changed? Any voices of dissent?
When Java 1.x is mentioned it means J2SE 1.x. Java 1.5 is now called Java 5.0 because of the major enhacements in the lang. Remember Java 1.2 was called Java 2. JSP, EJB etc are all part of J2EE. Each component has a separate versioning system and J2EE as a whole also has it's own versions. May sound a bit confusing at first. When there are major revisions to the individual componets, a new J2EE version is declared.
Rahul - Couple of slides on Metadata/Attributes - Might explain better than just reading about it.
Ya.. The video was very helpful. One part i did not understand was about was the advanced generics stuff, Factory etc. So need to lift my lazy ass and start learning soon.
During his Concurency talk, he mentioned a bug that has been in Java since the first version in "volatile".
Firstly I have to say that I appreciate what Eckel had to say about Java. Those were facts and can't deny anything. Everything he said about Generics, Erasure, ease of use I could take. But Cooncurrency did really hurt. .NET has helped Java as well. I hope that things get better and fast.
So what is MXML? Some eg? How different is XAML? What will be the features?
I agree that as of now we are used to HTML etc. But everyone knows that they are very limited. Personally i feel that Flash is the best alternative out there. Especially for Java as it is cross-platform. There are a lot of examples of Flash overuse, but what I saw in the stream was just amazing. Plus it can very easily put an end to all AWT vs SWT vs Swing. The only reason why Flex will not take off coz Macromedia controls it. If it will be opened further, it could become very widely used.
He said some stuff about Java's lack of acceptance on the client. AWT vs SWT vs Swing. Goes back to the easyness thing I mentioned in a previous post. There should be one standard that makes it easy for devs right out of the box
There are a lot of competing technologies in the Java Community. In a way I feel this is very healthy. Ease of development I feel is a different issue. Java is not as close to the stuff like what i think MXML might be. Though tools are improving very rapidly and also the lang after Java 1.5. Btw this is how the latest SWT looks like. It doesn't look native but would you use it?
could you explain the entire array of Java technologies that are out there. J2EE, J2SE, J2ME and how they differ from Java 1.1, Java 1.2 ... Java 1.5. Now they have Java 5.0 right? Also, what about JSP, EJB's and servelets and how are they connected to the versioning?
This article should explain most of the stuff. One part I noticed is that there is no EJB equivalent. Isn't ADO for database connectivity? What is COM+ ? Is it a part of .NET? EJB is one huge API which a lot of dev's feel is bloated and un-necessary. There are alternatives to that too, though I am not aware how they work. I wanted to know how .NET works in that layer. This might be a major advantage of .NET. Also do .NET dev's feel some std stuff needs to be changed? Any voices of dissent?
When Java 1.x is mentioned it means J2SE 1.x. Java 1.5 is now called Java 5.0 because of the major enhacements in the lang. Remember Java 1.2 was called Java 2. JSP, EJB etc are all part of J2EE. Each component has a separate versioning system and J2EE as a whole also has it's own versions. May sound a bit confusing at first. When there are major revisions to the individual componets, a new J2EE version is declared.
Rahul - Couple of slides on Metadata/Attributes - Might explain better than just reading about it.
Ya.. The video was very helpful. One part i did not understand was about was the advanced generics stuff, Factory etc. So need to lift my lazy ass and start learning soon.
During his Concurency talk, he mentioned a bug that has been in Java since the first version in "volatile".
Firstly I have to say that I appreciate what Eckel had to say about Java. Those were facts and can't deny anything. Everything he said about Generics, Erasure, ease of use I could take. But Cooncurrency did really hurt. .NET has helped Java as well. I hope that things get better and fast.
Monday, July 12, 2004
Re: Unified Type System
Sunday, July 11, 2004
Java Issues & Directions
Couple weeks ago our good friend Bruce Eckel gave a talk (real) regarding Java 1.5 at UC Berkley. It's quite long - about 2 hours 15 mins - but it's well worthwhile. Highly recommend it. He begins with a wide range of issues regarding what's wrong with Java and then goes on to new features in 1.5.
Some thoughts on the talk...
He mentioned Macromedia Flex on one slide and showed some code. I was surprised at how similar the MXML code looked to ASP .NET. He also compared it to what XAML is going to accomplish on Longhorn. I somehow feel like Flex is not going to be mainstream for web applications. It's very rare to see a web app use Flash/Shockwave for its front-end. As limiting as HTML, CSS and Javascript are, they will rule for a long time. Don't see anything displacing it anytime soon. We're just too used to it.
He said some stuff about Java's lack of acceptance on the client. AWT vs SWT vs Swing with different companies (ie. IBM vs Sun) supporting different API's. Goes back to the easyness thing I mentioned in a previous post. There should be one standard that makes it easy for devs right out of the box.
Rahul - could you explain the entire array of Java technologies that are out there. J2EE, J2SE, J2ME and how they differ from Java 1.1, Java 1.2 ... Java 1.5. Now they have Java 5.0 right? Also, what about JSP, EJB's and servelets and how are they connected to the versioning?
The Generics section was particularly interesting. He mentions some gripes about "Erasure" which is where Java looses the type information when compiling generic classes vs C++/C# retaining it. C#, although differening in the actual implementation of generics, is similar with Java in having constraints when declaring generic classes/methods.
Rahul - Couple of slides on Metadata/Attributes - Might explain better than just reading about it.
During his Concurency talk, he mentioned a bug that has been in Java since the first version in "volatile". I think that's a keyword. Anyway, when using these sorts of frameworks dyou trust it completely to be solid? I feel like those guys who wrote it are gods and know 2^20 times more that I do. I mean I could never for a sec imagine that if there is a bug I'm struggling with that the problem might actually be in the library.
Dinesh - He talked about the benefits of garbage collection and that the C++ committee might be tempted to include one in the next iteration of the C++ standard. Any news on this?
Some thoughts on the talk...
He mentioned Macromedia Flex on one slide and showed some code. I was surprised at how similar the MXML code looked to ASP .NET. He also compared it to what XAML is going to accomplish on Longhorn. I somehow feel like Flex is not going to be mainstream for web applications. It's very rare to see a web app use Flash/Shockwave for its front-end. As limiting as HTML, CSS and Javascript are, they will rule for a long time. Don't see anything displacing it anytime soon. We're just too used to it.
He said some stuff about Java's lack of acceptance on the client. AWT vs SWT vs Swing with different companies (ie. IBM vs Sun) supporting different API's. Goes back to the easyness thing I mentioned in a previous post. There should be one standard that makes it easy for devs right out of the box.
Rahul - could you explain the entire array of Java technologies that are out there. J2EE, J2SE, J2ME and how they differ from Java 1.1, Java 1.2 ... Java 1.5. Now they have Java 5.0 right? Also, what about JSP, EJB's and servelets and how are they connected to the versioning?
The Generics section was particularly interesting. He mentions some gripes about "Erasure" which is where Java looses the type information when compiling generic classes vs C++/C# retaining it. C#, although differening in the actual implementation of generics, is similar with Java in having constraints when declaring generic classes/methods.
Rahul - Couple of slides on Metadata/Attributes - Might explain better than just reading about it.
During his Concurency talk, he mentioned a bug that has been in Java since the first version in "volatile". I think that's a keyword. Anyway, when using these sorts of frameworks dyou trust it completely to be solid? I feel like those guys who wrote it are gods and know 2^20 times more that I do. I mean I could never for a sec imagine that if there is a bug I'm struggling with that the problem might actually be in the library.
Dinesh - He talked about the benefits of garbage collection and that the C++ committee might be tempted to include one in the next iteration of the C++ standard. Any news on this?
Re: Unified Type System
I was thinking of garbage collection myself and I do think a common base is required that keeps say two things, a count and a vector of pointers (or references) to the objects created, at the very minimum.
That very well could be one implementation. The pointers to objects created on the heap are on the stack. So, dyou think it would be economical for the garbage collector to also have pointers to those objects?
In .NET, when a collection is invoked, it walks through the roots (ie. global, static and stack pointers) recursively and creates a graph. This signifies all reachable objects. The non-reachable objects (ie. garbage) are marked. Those marked objects are deleted after the graph has been created. The others are compacted.
That mark phase... The Object base class could play a role. As I said last time, there could be some flag in Object thats set signifying that it's garbage and should be deleted. The other way could be that the collector creates a table of pointers to just the garbage objects to delete. In that case, we wouldn't need that base class with the flag.
The other reason why I feel having Object as the base class is not directly connected to garbage collection is cause MFC also has a root CObject class. I'm not very knowlegable about MFC, but if you want to "play well" with the framework and use your objects in the collections, you need to derive from CObject.
I guess Rahul might be on the right track regarding having those common methods in all objects. But I'm still not totally convinced.
Generics in C++ essentially auto-generate the classes based on type?
Yup. Templates - It's all done at compile-time. If the compiler comes across a declaration of the template with a type, it will auto-generate the class based on the type. And then that class is compiled. Dinesh can you confirm this?
What do you think happens in Java/.NET Generics? I suppose they 'fortified' the current Collections by forcing Type. This reduces Casting troubles at run-time and also provides better perf. So I think Generics are as dependent on Object.
As I understand it, in .NET, when the compiler comes across a declaration of a generic class with a value type (primitives, structs), it creates a new class definition. But it will only create one class definition for all reference types. This is because it holds references, which are the same regardless of what type it's pointing to.
So for example, if you have
ArrayList<int> intList = new ArrayList<int>();
ArrayList<double> doubleList = new ArrayList<double>();
ArrayList<string> stringList = ArrayList<string>();
ArrayList<MyClass> myClassList = ArrayList<MyClass>();
This code will create only three class definitions - One for int, one for double and one for references. The references definition will be used for both string and MyClass.
I believe Java will spit out four definitions.
You seem to have agreed with the importance of the other methods. toString( ), clone( ) and equals( ) are not the most important, but are pretty useful in many cases. Placing them in Object must have been thought over.
Actually, I just gave those methods as examples. I was talking about all of them. I realize they were thought over a lot. The guys who designed these systems are geniuses. I'm just trying to understand if that really was the reason for having a Unified Type System.
That very well could be one implementation. The pointers to objects created on the heap are on the stack. So, dyou think it would be economical for the garbage collector to also have pointers to those objects?
In .NET, when a collection is invoked, it walks through the roots (ie. global, static and stack pointers) recursively and creates a graph. This signifies all reachable objects. The non-reachable objects (ie. garbage) are marked. Those marked objects are deleted after the graph has been created. The others are compacted.
That mark phase... The Object base class could play a role. As I said last time, there could be some flag in Object thats set signifying that it's garbage and should be deleted. The other way could be that the collector creates a table of pointers to just the garbage objects to delete. In that case, we wouldn't need that base class with the flag.
The other reason why I feel having Object as the base class is not directly connected to garbage collection is cause MFC also has a root CObject class. I'm not very knowlegable about MFC, but if you want to "play well" with the framework and use your objects in the collections, you need to derive from CObject.
I guess Rahul might be on the right track regarding having those common methods in all objects. But I'm still not totally convinced.
Generics in C++ essentially auto-generate the classes based on type?
Yup. Templates - It's all done at compile-time. If the compiler comes across a declaration of the template with a type, it will auto-generate the class based on the type. And then that class is compiled. Dinesh can you confirm this?
What do you think happens in Java/.NET Generics? I suppose they 'fortified' the current Collections by forcing Type. This reduces Casting troubles at run-time and also provides better perf. So I think Generics are as dependent on Object.
As I understand it, in .NET, when the compiler comes across a declaration of a generic class with a value type (primitives, structs), it creates a new class definition. But it will only create one class definition for all reference types. This is because it holds references, which are the same regardless of what type it's pointing to.
So for example, if you have
ArrayList<int> intList = new ArrayList<int>();
ArrayList<double> doubleList = new ArrayList<double>();
ArrayList<string> stringList = ArrayList<string>();
ArrayList<MyClass> myClassList = ArrayList<MyClass>();
This code will create only three class definitions - One for int, one for double and one for references. The references definition will be used for both string and MyClass.
I believe Java will spit out four definitions.
You seem to have agreed with the importance of the other methods. toString( ), clone( ) and equals( ) are not the most important, but are pretty useful in many cases. Placing them in Object must have been thought over.
Actually, I just gave those methods as examples. I was talking about all of them. I realize they were thought over a lot. The guys who designed these systems are geniuses. I'm just trying to understand if that really was the reason for having a Unified Type System.
Saturday, July 10, 2004
Re: Unified Type System
I was saying because there is a hierarchy with Object being the root, the Collection classes can work with just Objects and not have to worry about other classes. Now, if they had introduced the framework with generics, you could have just done ArrayList, ArrayList, ArrayList and they would NOT need to inherit from Object. This is how it is in C++.
I'll repeat what I think you meant. Collections store pointers of type Object which can be later Cast into various Types. If this is what you meant, yipee for understanding and I see your point.
Generics in C++ essentially auto-generate the classes based on type?
What do you think happens in Java/.NET Generics? I suppose they 'fortified' the current Collections by forcing Type. This reduces Casting troubles at run-time and also provides better perf. So I think Generics are as dependent on Object.
I don't see this as an advantage
You seem to have agreed with the importance of the other methods. toString( ), clone( ) and equals( ) are not the most important, but are pretty useful in many cases. Placing them in Object must have been thought over.
I'll repeat what I think you meant. Collections store pointers of type Object which can be later Cast into various Types. If this is what you meant, yipee for understanding and I see your point.
Generics in C++ essentially auto-generate the classes based on type?
What do you think happens in Java/.NET Generics? I suppose they 'fortified' the current Collections by forcing Type. This reduces Casting troubles at run-time and also provides better perf. So I think Generics are as dependent on Object.
I don't see this as an advantage
You seem to have agreed with the importance of the other methods. toString( ), clone( ) and equals( ) are not the most important, but are pretty useful in many cases. Placing them in Object must have been thought over.
Friday, July 09, 2004
Re: Unified Type System
But, I'm skeptical since there are garbage collectors out there for C++ and we all know C++ doesn't have a Unified Type System. Even Java allows for different garbage collectors. So I wouldn't think that Object would play a role in it.
The reason I said that was sometime back I had gone through some simplistic garbage collection code and I remember distinctly that the objects had to be inherited from a common base IMMObject or something, which kept track of the various objects created. This is as far as my memory serves me, cause I think this was quite some time back!!
I was thinking of garbage collection myself and I do think a common base is required that keeps say two things, a count and a vector of pointers (or references) to the objects created, at the very minimum.
Or maybe it's just a whole "everything has to be OOP's" thing. So they created a single root hierarchy.
Dinesh.
The reason I said that was sometime back I had gone through some simplistic garbage collection code and I remember distinctly that the objects had to be inherited from a common base IMMObject or something, which kept track of the various objects created. This is as far as my memory serves me, cause I think this was quite some time back!!
I was thinking of garbage collection myself and I do think a common base is required that keeps say two things, a count and a vector of pointers (or references) to the objects created, at the very minimum.
Or maybe it's just a whole "everything has to be OOP's" thing. So they created a single root hierarchy.
Dinesh.
Re: Unified Type System
I was a bit confused about what you are trying to say? Do you mean simple Casting? How is C++ better at handling collections/generics w/o unified type system?
I was saying because there is a hierarchy with Object being the root, the Collection classes (just as an example) can work with just Objects and not have to worry about other classes. If they didn't have this hierarchy then you would need a StringArrayList, IntArrayList, MyClassArrayList etc... In other words, specializations for every possible class you would want to put into any collection. Now, if they had introduced the framework with generics, you could have just done ArrayList<String>, ArrayList<Int>, ArrayList<MyClass> and they would NOT need to inherit from Object. This is how it is in C++.
To notice the advantages of Object look at the class itself. Object guarantees that Thread support is provided out of the box with final classes like wait( ) notify( ). Other methods like clone( ) equals( ) getClass( ) and hashCode( ) provide features to be extended by child classes. getClass( ) is important for Reflections. hashCode( ) is important for generating hashcode indices for Collections like Map. Also finalize( ) serves as a Destructor.
I don't see this as an advantage. If your class never needs to be output to console (or whereever), you won't need the ToString() method. Similarly for Clone(), if you won't ever make a copy of yourself or Equals() if you will never be compared. C++ gives you the option. If you want to output to console (or whereever) you overload operator<<. Same for equals and clone... overload operator== and copy construtor. You are in control. There is no default overhead.
You even could argue why they didn't make CompareTo() a method in Object. Why did they choose to go for an interface Comparator (IComparator in .NET)? C++ has a similar way of doing it. Not with interfaces, but functors. If you want your object to be sorted, you create a functor, which performs the comparison, and pass it to an algorithm that sorts the collection.
I think I may have drifted quite a bit, but hey.. it is a pvt blog!! Now can any of you verify this?
Drift as much as you like... It's all good.
We discussed casting a while back. Check out the archives. It's pretty much exactly as you said it.
Do you know how it happens in C++?
I would think it's the same, except there is no Object at the top. In Java and .NET, it's ALWAYS there.
I thought this had to do in a Major way with garbage collection too
You might be right, but it would depend on implementation details. When a garbage collection is invoked, it creates a graph of all reachable objects from the roots in the application. It marks all those that are NOT reachable and destroys them. I guess this is called the mark and sweep collector. Maybe during the mark phase, an implementation would change a flag in the objects to say that it is garbage. If this were the case, then, yeah, Object would play a role.
But, I'm skeptical since there are garbage collectors out there for C++ and we all know C++ doesn't have a Unified Type System. Even Java allows for different garbage collectors. So I wouldn't think that Object would play a role in it.
Not sure though, a detailed answer by someone would be welcome.
I'm quite confused about this. I don't think any of us has hit the nail.
I was saying because there is a hierarchy with Object being the root, the Collection classes (just as an example) can work with just Objects and not have to worry about other classes. If they didn't have this hierarchy then you would need a StringArrayList, IntArrayList, MyClassArrayList etc... In other words, specializations for every possible class you would want to put into any collection. Now, if they had introduced the framework with generics, you could have just done ArrayList<String>, ArrayList<Int>, ArrayList<MyClass> and they would NOT need to inherit from Object. This is how it is in C++.
To notice the advantages of Object look at the class itself. Object guarantees that Thread support is provided out of the box with final classes like wait( ) notify( ). Other methods like clone( ) equals( ) getClass( ) and hashCode( ) provide features to be extended by child classes. getClass( ) is important for Reflections. hashCode( ) is important for generating hashcode indices for Collections like Map. Also finalize( ) serves as a Destructor.
I don't see this as an advantage. If your class never needs to be output to console (or whereever), you won't need the ToString() method. Similarly for Clone(), if you won't ever make a copy of yourself or Equals() if you will never be compared. C++ gives you the option. If you want to output to console (or whereever) you overload operator<<. Same for equals and clone... overload operator== and copy construtor. You are in control. There is no default overhead.
You even could argue why they didn't make CompareTo() a method in Object. Why did they choose to go for an interface Comparator (IComparator in .NET)? C++ has a similar way of doing it. Not with interfaces, but functors. If you want your object to be sorted, you create a functor, which performs the comparison, and pass it to an algorithm that sorts the collection.
I think I may have drifted quite a bit, but hey.. it is a pvt blog!! Now can any of you verify this?
Drift as much as you like... It's all good.
We discussed casting a while back. Check out the archives. It's pretty much exactly as you said it.
Do you know how it happens in C++?
I would think it's the same, except there is no Object at the top. In Java and .NET, it's ALWAYS there.
I thought this had to do in a Major way with garbage collection too
You might be right, but it would depend on implementation details. When a garbage collection is invoked, it creates a graph of all reachable objects from the roots in the application. It marks all those that are NOT reachable and destroys them. I guess this is called the mark and sweep collector. Maybe during the mark phase, an implementation would change a flag in the objects to say that it is garbage. If this were the case, then, yeah, Object would play a role.
But, I'm skeptical since there are garbage collectors out there for C++ and we all know C++ doesn't have a Unified Type System. Even Java allows for different garbage collectors. So I wouldn't think that Object would play a role in it.
Not sure though, a detailed answer by someone would be welcome.
I'm quite confused about this. I don't think any of us has hit the nail.
Thursday, July 08, 2004
Re: Unified Type System
My immediate thoughts turned to collections... Having a requirement that every class in the system implement a common interface (Object's) makes it possible for collections to be generic enough to be used with anyone.
I was a bit confused about what you are trying to say? Do you mean simple Casting? How is C++ better at handling collections/generics w/o unified type system?
Personally I do not think that Collections were a reason for Object. Object was an initial design consideration, but Collections came in at a later stage. Casting though is a very important factor.
To notice the advantages of Object look at the class itself. Object guarantees that Thread support is provided out of the box with final classes like wait( ) notify( ). Other methods like clone( ) equals( ) getClass( ) and hashCode( ) provide features to be extended by child classes. getClass( ) is important for Reflections. hashCode( ) is important for generating hashcode indices for Collections like Map. Also finalize( ) serves as a Destructor.
Actually I have this picture of how a JVM may work. I have already given you guys lots of dumb ideas and stuff before so one more. I do not know from where I got this idea or if I have mentioned it before. Anyways...
Suppose I have 3 Classes with C extending B and B extending A.
C c = new C( );
And now only one pointer is created on the stack pointing to the new C object on the heap. Something like ..
ptr-----> ((((Object)A)B)C)
stack---> heap
so if I say (B)c;
ptr is used to read data sizeof(B) and that is used to retrieve (rather reconstruct) the instance from the heap.
if I say (A)c;
the same ptr is used to read data sizeof(A) and that is used to get the instance of type A.
And in this way Casting is done.
So I would like to emphasize that one pointer is used which initially points to type Object and this can be 'extended'. In this way the JVM and Classloader have a starting point for any Class which is seems to be a benefit.
I think I may have drifted quite a bit, but hey.. it is a pvt blog!! Now can any of you verify this? Do you know how it happens in C++?
I was a bit confused about what you are trying to say? Do you mean simple Casting? How is C++ better at handling collections/generics w/o unified type system?
Personally I do not think that Collections were a reason for Object. Object was an initial design consideration, but Collections came in at a later stage. Casting though is a very important factor.
To notice the advantages of Object look at the class itself. Object guarantees that Thread support is provided out of the box with final classes like wait( ) notify( ). Other methods like clone( ) equals( ) getClass( ) and hashCode( ) provide features to be extended by child classes. getClass( ) is important for Reflections. hashCode( ) is important for generating hashcode indices for Collections like Map. Also finalize( ) serves as a Destructor.
Actually I have this picture of how a JVM may work. I have already given you guys lots of dumb ideas and stuff before so one more. I do not know from where I got this idea or if I have mentioned it before. Anyways...
Suppose I have 3 Classes with C extending B and B extending A.
C c = new C( );
And now only one pointer is created on the stack pointing to the new C object on the heap. Something like ..
ptr-----> ((((Object)A)B)C)
stack---> heap
so if I say (B)c;
ptr is used to read data sizeof(B) and that is used to retrieve (rather reconstruct) the instance from the heap.
if I say (A)c;
the same ptr is used to read data sizeof(A) and that is used to get the instance of type A.
And in this way Casting is done.
So I would like to emphasize that one pointer is used which initially points to type Object and this can be 'extended'. In this way the JVM and Classloader have a starting point for any Class which is seems to be a benefit.
I think I may have drifted quite a bit, but hey.. it is a pvt blog!! Now can any of you verify this? Do you know how it happens in C++?
Re: Unified Type System
I thought this had to do in a Major way with garbage collection too. Not sure though, a detailed answer by someone would be welcome.
Dinesh.
Dinesh.
Wednesday, July 07, 2004
Re: The C++ Source (C++ future)
One complaint which Java devs have of Swing (Java GUI) is that GUI components like Buttons etc have to be placed within containers and stuff. It is not possible to place components at absolute positions on the screen. Everything has to be relative to other components. How is it in .NET?
Any particular reason they've done that?
In .NET each control is independent of others. You have the option of grouping them together if you want. Each control has absolute position. Before .NET, this could cause some problems. If you expanded the windows, all the controls would stay in the same exact location - it wasn't dynamic in relation to the window size. In .NET, you can assign properties to each control in relation to the window size. You can either have it "grow" when the window resizes or just change location.
Any particular reason they've done that?
In .NET each control is independent of others. You have the option of grouping them together if you want. Each control has absolute position. Before .NET, this could cause some problems. If you expanded the windows, all the controls would stay in the same exact location - it wasn't dynamic in relation to the window size. In .NET, you can assign properties to each control in relation to the window size. You can either have it "grow" when the window resizes or just change location.
Performance of Java vs C++
http://www.idiom.com/~zilla/Computer/javaCbenchmark.html
The actual benchmark isn't the main attraction. The article has several general points that I thought were quite good.
The actual benchmark isn't the main attraction. The article has several general points that I thought were quite good.
Unified Type System
I came across this question on one software developer' blog I read: "Why is each class in Java implicitly inherited from Object?"
My immediate thoughts turned to collections. Because neither system (Java nor .NET) had generics when they were introduced, without having every class implicitly inherit from Object, it would require a specialization for every possible class to be able to put it in a collection (which is impossible). Having a requirement that every class in the system implement a common interface (Object's) makes it possible for collections to be generic enough to be used with anyone.
I can't think of any other reason. How about you?
We sort of take it for granted that Java (and .NET) has a unified type system. We rarely really think about why it is that way.
My immediate thoughts turned to collections. Because neither system (Java nor .NET) had generics when they were introduced, without having every class implicitly inherit from Object, it would require a specialization for every possible class to be able to put it in a collection (which is impossible). Having a requirement that every class in the system implement a common interface (Object's) makes it possible for collections to be generic enough to be used with anyone.
I can't think of any other reason. How about you?
We sort of take it for granted that Java (and .NET) has a unified type system. We rarely really think about why it is that way.
Re: The C++ Source (C++ future)
We're all borderline bums so we don't have real work.
I know that. I'm in the same category!!
Anyway, those UI's looked good. It's not impossible to come up with a good UI in Java. The question is how easy is it?
One complaint which Java devs have of Swing (Java GUI) is that GUI components like Buttons etc have to be placed within containers and stuff. It is not possible to place components at absolute positions on the screen. Everything has to be relative to other components. How is it in .NET?
I can't claim to have used many Java client apps. The only one I have used is Forte by Sun. It was an alright experience - not bad, but definitely could be better. It just felt like the app was out of place in Windows.
In Java there exists a concept called LookAndFeel (laf). laf is like a theme/skin. So a skin can be applied to a GUI like Motif, Windows, Metal. As of now Metal is the default cross platform laf. A few more lines of code have to be written to apply the native laf. In Java 1.5 the Win XP and Red Hat laf's have been added.
Is it possible to create a java desktop application that w/o any change will work on any platform?
Simple answer - YES. Any Java app is cross-platform. Unless some native libraries are used, which is very very rare.
I know that. I'm in the same category!!
Anyway, those UI's looked good. It's not impossible to come up with a good UI in Java. The question is how easy is it?
One complaint which Java devs have of Swing (Java GUI) is that GUI components like Buttons etc have to be placed within containers and stuff. It is not possible to place components at absolute positions on the screen. Everything has to be relative to other components. How is it in .NET?
I can't claim to have used many Java client apps. The only one I have used is Forte by Sun. It was an alright experience - not bad, but definitely could be better. It just felt like the app was out of place in Windows.
In Java there exists a concept called LookAndFeel (laf). laf is like a theme/skin. So a skin can be applied to a GUI like Motif, Windows, Metal. As of now Metal is the default cross platform laf. A few more lines of code have to be written to apply the native laf. In Java 1.5 the Win XP and Red Hat laf's have been added.
Is it possible to create a java desktop application that w/o any change will work on any platform?
Simple answer - YES. Any Java app is cross-platform. Unless some native libraries are used, which is very very rare.
Tuesday, July 06, 2004
Sunday, July 04, 2004
Re: The C++ Source (C++ future)
If you guys have no real work; have a look at a few of the better Java desktop applications here.
We're all borderline bums so we don't have real work.
Anyway, those UI's looked good. It's not impossible to come up with a good UI in Java. The question is how easy is it? If it's not straightforward "by default" then regular joe java devs will be putting out awful interfaces. And I guess that's whats been happening. The less expected of programmers the better.
I can't claim to have used many Java client apps. The only one I have used is Forte by Sun. It was an alright experience - not bad, but definitely could be better. It just felt like the app was out of place in Windows. I feel like apps should look like they were made for "my" platform. Each platform has its own features and strengths and the apps should use that. This is the area I feel Java is limiting.
Is it possible to create a java desktop application that w/o any change will work on any platform?
Java's strengths are it's weaknesses and I suppose same for the other languages/platforms.
Can't think of a better way of putting this.
We're all borderline bums so we don't have real work.
Anyway, those UI's looked good. It's not impossible to come up with a good UI in Java. The question is how easy is it? If it's not straightforward "by default" then regular joe java devs will be putting out awful interfaces. And I guess that's whats been happening. The less expected of programmers the better.
I can't claim to have used many Java client apps. The only one I have used is Forte by Sun. It was an alright experience - not bad, but definitely could be better. It just felt like the app was out of place in Windows. I feel like apps should look like they were made for "my" platform. Each platform has its own features and strengths and the apps should use that. This is the area I feel Java is limiting.
Is it possible to create a java desktop application that w/o any change will work on any platform?
Java's strengths are it's weaknesses and I suppose same for the other languages/platforms.
Can't think of a better way of putting this.
Saturday, July 03, 2004
Subscribe to:
Posts (Atom)