Thursday, September 22, 2005

Preview C# 3.0

Based on an analysis found here

1. Implicitly variable types
var i = 5;
Somebody said, in the context of usability: "Don't make me think".
This is not the case: the code is easier to write, but more difficult to read.

2. Object Initializers
Point p = new Point { X = 0, Y = 1 };

I hope this does not encourage people to use setters.
To put everything in the constructor, and eliminate the Setters,
would be a much more object oriented approach:
new Point(0,1).

...and probably faster: if we watch the IL,
two extra calls to the setters are made.

(Discussion about why getters are good, setters are bad.)

3. Anonymous Types

I cannot see how this would make the code more readable/maintainable.
Maybe for LINQ stuff ?

4. Extension Methods
Ahhhh... This is a trick to extend "sealed" classes.
(Pls. read multiple-inheritance hack, partial implementation of ruby-mixins).
Eiffel supports both multiple-inheritance and .Net,
so why are we hacking around?

By the way, why do we have sealed classes?
Why am I, a client who want to use your classes,
obstructed to extend your work,
with my extra_funky_functionality?
Isn't your class Open-Close?

5. Lambda Expressions

Great!!! Finally the "modern" languages are approaching Smalltalk.

6. D/X Linq

I really don't understand this decision. Instead of "minimizing" the (syn)tax,
Microsoft is making C# more and more complicated.
Why can't we have a clear separation ofconcerns:
- here is the bussiness logic,
- here is the persistance layer, with this DB,
and this is how is mapped(SQL commands).
iBatis makes a really nice job with the databases.

So what we will have: a big FoxPro (sorry VB/C#) soup,
which nobody can maintain.
No problem, than we can (re)start from begining.

ps. Another analysis on Mixin-Closure/Block-DynamicProxy

No comments: