avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicola Ken Barozzi <nicola...@apache.org>
Subject Re: [OT] .Net better than Java in some ways
Date Mon, 12 May 2003 15:16:11 GMT

Leo Simons wrote, On 12/05/2003 14.15:

> Nicola Ken Barozzi wrote:
> 
>> Leo Simons wrote, On 11/05/2003 11.07:
>>
>>>> I personally hate the Capital Letters In Method Names too. (;-)).
>>>
>>>
>>> +1 to that.
>>
>>
>> It's how a programmer understands the Java suggested notation at a 
>> first glance... so IMHO they did look at Java, but did they really 
>> work with it? ;-P
> 
> I think you can safely assume they did a few long thorough studies on 
> the matter. MS is really good at user studies and product improvement 
> through customer feedback. We just disagree with the average MS customer 
> I guess ;)

I guess that they just had to make it *look* different ;-)

>>        http://www.geocities.com/csharpfaq/
>>
>>    maybe you'll be surprised to see the pitfalls ;-)
> 
> Some of that is just silly. Example: "Do not use boxing and unboxing 
> (...) use wrapper classes.". How often do you test for identity for 
> wrapper primitives? If the identity of an int were important, it 
> wouldn't qualify as a primitive!

The problem arises because you don't know what you are dealing with.

The example is:

Point p = new Point(10, 10);
object box = p;
p.x = 20;
Console.Write(((Point)box).x);


Now, it's very clear to me that the above should give 20.
NO! It gives 10, because the class was written this way:

  struct Point {
   public int x, y;
   public Point(int x, int y) {
     this.x = x;
     this.y = y;
   }
}

It seems that it's more a problem with structs than with boxing, but the 
two combined are really potentially whacky nevertheless.

>>  -  for <blah> in <list>: Java 1.5 will have for ( <blah> : <list>
)
> 
> finally! :D

I thought at first that the notation is crap, as I'm more and more 
getting used to python.

In fact, I started some time ago with C++ but notation was crap: I 
prefer much to use class A extends B than colons or similar.

As you know in Java:

   if (!list.contains(blah)){
     do_this();
   }

In Python:

   if blah not in list:
     do_this()


As you know, Python is *much* easier to read.

So I would have liked:

  foreach(blah in list){

  }

But it would mean new words in the language, 'foreach' and 'in', so they 
preferred to use a colon. Bleah.


>>  - the event mechanism: JDK 1.4 already a this utility class
>>    that uses Proxies.  Look at 
>> http://java.sun.com/j2se/1.4.1/docs/api/java/beans/EventHandler.html
> 
> 
> neat. Can't wait till deployment standards switch to 1.4.

The problem though is that you loose static checks, as you pass the 
method name as a string. Event handling should really be a nice thing to 
do with metadata.

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Mime
View raw message