How C# Was Made
prostoalex writes "Bruce Eckel (from the Thinking in C++/Java/Patterns/Enterprise Java fame) and Bill Venners have interviewed programming legend Anders Hejlsberg. After 13 years in Borland and joining Microsoft in 1996, Hejlsberg now leads the development of C# language and talks about the development process, reasons some things exist in C# and some not, as well as future directions."
There a great interview with The father of C# here too,
There is a pretty good interview on the .NET show on MSDN with Anders too. It runs about one hour, so get a comfy chair.
Joel Spolsky published a great article a while back on .Net, his company's strategy for the platform, and why Anders so damn cool. Also, just in case you're curious as to how his last name is pronounced, it's pronounced hells-burg.
iRooster, the Mac OS X a
...right here to save you a click thru the MSDN page.
The Army reading list
Microsoft starts trying to tell people that "OO is soo... yeasterday. You want Indigo."
You're referring to Don Box, specifically, right? I don't think it's so much that Don is pooh-pooh'ing OOP in general, it's that he feels that a service-oriented architecture is better suited to the kind of problems we face today than DCOM or CORBA. His point is that trying to use an OOP metaphor for enormous, architecturally sound remote object invocation/data transfer systems is a terribly complex task.
Also, keep in mind that Don wrote *the* book on Microsoft's COM technology; OOP has its place, but CORBA and DCOM are not really the place.
iRooster, the Mac OS X a
They hit the black key to the right of C.
I don't know why Java developers always feel the need to point out that C# took a lot of ideas from Java. I don't see C++ developers always pointing out that Java's mandate was to "co-opt" C++. Of course C# took a lot of ideas from Java (I don't think Microsoft has ever denied this), because Java got a lot of things right. C# also made a lot of improvements (event handling is MUCH improved in C# for example) and is a great language to program in. I think it would be even better if there were a .NET runtime for an OS other than Windows, but the good people on the Mono project are working on that already.
It's well known that the C# designers paid a lot of attention to Java, but more importantly, it's also quite clear that they also spent a lot of time paying attention to the experience of developing in Java.
So while I might not entirely agree with the uncaught exceptions or the way methods aren't virtual by default, I do think it would be a good idea for Sun to take the lesson from MS, and take what is best about C# and move it into Java.
In a sense, Java was designed to co-opt C++. But co-optinging C++ was not made as a business decision to lock in Sun customers, it was made as part of Sun's vision of "The Net is the Computer" (or whatever they called it).
Sun embraced the internet years before Microsoft and looked out into the future and realized that desktop computing and huge, standalone applications were going to be increasingly replaced by device computing and small, internet downloadable applications would be prevalant.
To that end, they tried to design a language that was simple, that had built-in libraries to handle basic internet protocols and to a large extent, their vision was spot-on and Java was hugely successful.
Without Microsoft spending years trying to undercut them it's very conceivable that Java would be the lingua-franca of the internet right now.
-- You see, there would be these conclusions that you could jump to
Fine with me. A java-like language that doesn't gobble ram like no tomorrow? Sounds good.
As a bonus, Gtk# has the best API I've ever used in a gui toolkit.
What are you talking about? Nobody uses java for "internet downloadable applications", or even intranet downloadable ones. Their vision of thin-client computing was shown to be a pipe dream, to everyone except you anyway.
...wearing a skin-tight topless leather jumpsuit, with cutaway buttocks and transparent crotch panel.
Actually, Java supports both checked and unchecked throwables: the latter with the class Error. My programming style is to make throws that I don't expect to be "routinely" caught throw Errors rather than Exceptions. An Error can still be caught, but since you don't expect it, you needn't declare it.
The checked exceptions are still useful for the case where it would probably be a bug not to handle the exception, e.g. "search found no element" or "file not found". The reason for the two kinds of throwables is exactly this: you don't want to declare that every method doing division throws DivideByZero. Unfortunately, the Java library designers don't seem to have gotten it, and so there's a bunch of things like IOException that IMHO should have been Errors.
For fucks sake, man! Wake up and smell the marketing bullshit. The most innovative impressive thing about Java was that it was successfully marketed as basically the second coming (more tangibly as the solution to 10 different huge problems), all while just being another platform. Get it? They created their own platform without hardware leverage, OS leverage, app leverage, etc. It's bootstrapping by marketing.
Java was designed to co-opt Smalltalk, or at least Sun brand it and bring it up to date.
Think about it... Smalltalk's main points were the single root object heirarchy, the bytecode compilation, and the large runtime library including full GUI. Did C++ have this? No. It was more "object oriented concepts ported to C" - lean and mean, machine dependant and no standard GUI. The C++ generics and the STL weren't standard when Java arrived.
Does my bum look big in this?
But people DO say that Java was co-opted C++, including you and now .. me. Languages naturally progress from those that already exists like every other technology. Why reinvent the wheel and find out that squares don't work... over and over.
.NET runtime concept that works so much better than Java on a Windows machine is something that could exist for Java some day. C# might actually have a legitimately supported OS other that Windows, and although the Mono project is great, it ain't by MS.
... then another will come along.
Java is taking ideas from C# as well, just take a look at 1.5 with enums, yes I know they existed before C# but I think their existence in C# prompted the move.
I just find it funny that pro-MS people often don't like to hear that C# could even possibly be an evolutionary step off of Java. And unlike older languages, Java itself is still evolving. The
I've used both and the both work and they'll both change... for a while
I wounldn't try to find religion in a programming language, they come and go too quickly.
Bingo...and in the end, we programmers don't have 1, but -two- improved languages, as they try to improve to each other. MS trying to lock in their customers or not, Sun trying to control java or not...doesn't matter... Now we have 2 languages that try to improve on each other as fast as possible, and we win!
Your comment is a fascinating insight into a fanatical mind. You may not yet be as bad as the guy that lives on the corner of my block, with the foil under his NY Yankees basball cap, but the distinction is small.
You've esentially said C# and
Wonderfull logic.
Your prison/Gates metaphor-pun is wonderfully melodramatic as well.
Thanks for play,
-Malakai
A Dragon Lives in my Garage
Gonna burn some karma on this...
;) And yes, I am just teasing.
Gandalf: This is C#. Forged by the Dark Lord and his engineers in the fires of Mount Redmond. Taken by him from the hand of evil himself. All who use it are bound to him. Gates needs only this ring to cover all the lands of a second darkness... He is seeking it, seeking it; all his thought is bent on it.
Frodo: Alright, we put it away. We keep it hidden. We never speak of it again... No one knows its here, do they? Do they, Gandalf?
Gandalf: Unfortunately, yes. The power of Gates is far reaching. The innocent would use C# from a desire to do good, but through them, it would wield a power too great and terrible to imagine.
You get the idea...
*-*-*-*-*-*-*-*
"We are Linux. Resistance is measured in Ohms."
I think on many issues, Hejlsberg is missing the point and the reasons he gives aren't necessarily the actual reasons why particular design tradeoffs are good ones.
.NET) may turn out to be the free and open language that Java should have been; time will tell.
But it really doesn't matter. The changes that C# made relative to Java are obvious and proven (e.g., value classes, removal of statically checked exception declarations, declared unsafe code sections). Many of them had made Sun's bug parade. All of them had been in other languages before either Java or C#. In fact, C# is, in many ways, close to Modula-3.
There seems to be another reason for some of the design decisions: patents. Sun has patents on several aspects of the JVM and Java, and if Microsoft wanted to be free of potential future claims by Sun, they had to avoid those in their own competing virtual machine.
Keep in mind that Hejlsberg is also a salesperson for the language anyway. That means that he may not be telling you the real reasons behind design decisions, but the reasons that sell the language well.
In any case, however it came into existence, C# is a somewhat better language than Java, and we should be happy about that: whether you are planning on using C# or not, it raises the bar for what is considered standard in industry. Without C#, Sun probably wouldn't even have made the largely cosmetic changes they made to Java in 1.5, and maybe the continued existence of C# will force them to fix other misfeatures of Java and the JVM in future versions. And C# (but not
1) Pseudo-compiled languages are easily decompiled.
Um, compiled languages are easily decompiled as well.
http://hte.sf.net is a badass hexeditor/disassembler.
Case in point, I walked through the assembly of iTunes to figure out the AES key that iTunes uses for iTMS. And iTunes was written in C++.
C++ is the opposite. In C++, you can do anything you damn well please on a variable of a type parameter type. But then once you instantiate it, it may not work, and you'll get some cryptic error messages. For example, if you have a type parameter T, and variables x and y of type T, and you say x + y, well you had better have an operator+ defined for + of two Ts, or you'll get some cryptic error message. So in a sense, C++ templates are actually untyped, or loosely typed. Whereas C# generics are strongly typed.
// . . .
I disagree with that assessment. Both C# and C++ generics/templates are strongly typed. It's just that the enforcement happens in different places.
In C++, if you try to stick a class into a templated class when that class doesn't have a particular member function defined, the compiler will yell at you, just like Hejlsberg said. But for some reason, this doesn't count as type checking? Yes, template error messages can be strange (and very long) if you're not familiar with them. But that's just a lesson in "know your tools."
To me, "strongly typed" is strict type enforcement at compile time. C++ templates certainly do this.
Constraints, however, are something that I think are a generally good idea. Stroustrup's reasoning for not including them in C++ was that "Requiring the user to provide such information decreases the flexibility of the parameterization facility without easing the implementation or increasing the safety of the facility." (The Design and Evolution of C++, Stroustrup, 343).
He does, however, show an interesting way to get around this using inheritance:
template <class T>
class Comparable {
T& operator=(const T&);
int operator==(const T&, const T&);
int operator<=(const T&, constT&);
int operator<(const T&, const T&);
};
template <class T : Comparable>
class vector {
};
(The D&E of C++, Stroustrup, 344)
This technique is similar to how C# does constraints, class List where T: IComparable. One is supported and enforced by the language, the other is a natural consequence of the languages facilities. In general, I think that constraints are probably a good thing. Having an error message like "Can not instantiate class Y<T> because T does not implement z()" is probably best, and when looking at a class' declaration, it would be nice to see up front what assumptions the templated class makes.
why trust your development to a language designed to lock you in to Windows? C#, for all its niceities is just a way of getting you to buy more Windows 2003 Server licenses.
C# is just a language, it doesn't lock you into Windows at all. Mono supports the entire C# language.
It's the classes you choose to use that lock you onto a specific platform.
You can't blame C# if people want to use classes that aren't available on other platforms.
Its like saying that C++ sucks because DirectX doesn't work on Linux.
Well, if you're a Java programmer worth your salt, you DON'T propagate every exception class the underlying modules might want to throw. You make your code catch exceptions rising from below and either handle them or massage them into the exception set your module exports. This is much better for the upper-level users because they want to deal only with situations raised by, and meaningful for, the APIs at hand, and they don't have to care about what would brew beneath.
If you don't want to lose exception stack information, as of J2SE 1.4, you can chain an original exception to your higher-level exception, so that everything would be rolled down nicely in a trace printout.
My exception safety is -fno-exceptions.
Here's your macro: http://weblogs.asp.net/jan/archive/2003/04/29/6168 .aspx
There are plenty of people working on tons of free libraries out there. The gotdotnet workspaces are pretty good place to search for things, but your best best is to follow the weblogs on asp.net.