http://channel9.msdn.com/pdc2008/TL16/
Although from 2008, this is still an interesting talk from Anders Hejlsberg - the lead architect of the C# programming language. He outlines the future (now mostly present) of C# and describes the many forces that influence and shape the future of programming languages and explain how they fit into C#.
In the end he talks a little bit about what is beyond 4.0 and he demonstrates the "compiler as a service", which is something I am looking forward to see :)
In fact guys from Mono already moved things forward a little bit: http://www.mono-project.com/CsharpRepl
2003, Guy Steele: "And you're right: [the designers of Java] were not out to win over the Lisp programmers; we were after the C++ programmers. We managed to drag a lot of them about halfway to Lisp. Aren't you happy?"
I have written a fair amount of C# code, although not so much recently. I think Microsoft are in danger of crowbarring too much into this language. Ideally I think they ought to start looking at rationalising and simplifying the syntax rather than adding ever more stuff to it.
There isn't a great deal of actual "new" features. Alot of the fixed, such as "IEnumerable<Object> objects = new List<String>();" are just filling out gaps in implementation. I have a large amount of just written code that is dying for the above feature, not to mention optional+ named parameters!
We switched over in our shop on release week, and I must say that I'm enjoying the new features of .NET and C# 4.0. COM interop with Office Communicator is cleaner. IronRuby + Sass for css with ASP MVC rocks. Optional parameters have killed off many pass-through overloads. Also, DynamicObject and IDynamicMetadataProvider give potential for the dynamic keyword goes far beyond ExpandoObject. It opens up possibility for new DSLs within C#. Although likely to be misused, having the power to manipulate the meaning of the language is an impressive feature.
Have we not been getting ready for C# 4 for some time? It's been in CTP and Beta variants for most of the last year. Some good new features exist of course.
The in/out naming for covariance and contravariance is pure genius! It's much easier to learn and to determine which one to use compared to notations in other programming languages. It would be even better if out weren't already in use for something else, I agree.
The real advantage of named parameters is the ability to have optional parameters as well. Which means that instead of:
var c = new X(3, "blue", null, null, null, null, false, true, null, 1, null);
(which, sadly, is an all too common implementation pattern), you can have:
var c = new X(foo: 3, bar: "blue", baz: false, quux: true, wibble: 1);
Which seems quite a bit better.
Another advantage of named/optional parameters is that you can use them in the construction of immutable objects, whereas you don't get that advantage if you use settable properties.
Named parameters are awesome. The equivalent pattern in javascript is passing in an options object.
foo({
'name': 'bar',
'title': 'Bar'
});
This means not having to look up what the exact order of options are, nor having to pass in a bunch of null parameters because the one you want is the last parameter. Very cool.
I agree that it makes it "more readable", but that only would matter if intellisense wasn't working. I see the parameters, and they are strongly typed. In JS, this isn't the case, so it is much more helpful (e.g, I can completley screw up types/params and they will probably materialize as some strange behavior. As far as bools, I generally try to avoid having more one or two bools as an argument, unless it's required, and it rarely is.
Do you have intellisense in your eyes? A line of code with a handful of named parameters reveals its intentions (and possibly also its correctness) for more readily than a line of code with a laundry list of parameters that you need to mouseover then do a bit of mental juggling to line up which value lines up with which parameter. In doing so you've likely interrupted and degraded your reading of the code and you've definitely degraded your ability to readily spot the difference between correct and incorrect code.
I've passed on anything coming out of microsoft since about 2003 or so, and I feel much better for it. No more stacks of MSDN cds, no more 'support events' and so on.
No more viruses, worms, trojans, piles of malware and other nonsense, besides license fees, subscriptions to stay up-to-date, re-installs every 3 to 5 months.
Open source all the way for me these days, and I feel much happier for it.
It's possible that C# is a great language and that I'm missing out on something that would improve my life in a way that I can not currently imagine but there always seems to be a price for that.
Although it was perhaps understandable, your cognitive bias has led you to avoid a useful modern programming language. C# works in Linux with Mono, and so although Microsoft controls the language, you can reap the benefits on a platform without the Microsoft stack of technologies, if desirable. Personally, I love C#, and use it at home for hobby programming, but not professionally.
I'm aware of mono, but the 'heritage' has really put me off.
The way microsoft has behaved in the past is such that if I can avoid using stuff that they have a hand in I will.
It's true that that may 'hurt' me in the sense that C# is probably a great language, but there are so many 'great languages' that this was a luxury problem anyway.
Between Python, Clojure and more exotic stuff like Erlang and Haskell there isn't enough time already. If microsoft had been a little nicer in the past they might have had an advocate in me, but enough really is enough.
With some other big companies, such as for instance IBM I've got the feeling that they really understood and have changed their ways, with microsoft I've never lost the feeling that they still don't get that they were in the wrong and are still just trying to dance their way around the real problems without admitting that they were wrong and bettering their ways.
I think that they will only change when the last of the 'old guard' at microsoft have stepped down from day to day management positions.
Actually, C# is not a great language by any stretch of imagination - its just Java willing to evolve. There is some great stuff happening at Microsoft Research which drizzles down to the MS languages every so often though.
My problem is not the heritage and other superfluous stuff. I am not willing to deal with a horrible operating system. Dave Cutler and team just don't get it - surprisingly Ken, Dennis and Brian did.
"...with microsoft I've never lost the feeling that they still don't get that they were in the wrong and are still just trying to dance their way around the real problems without admitting that they were wrong and bettering their ways."
Care to elaborate? I still do not understand some of the over generalized MS bashing, especially when it comes to software development. From my experience, they have had some of the best tools and support over the years. Perfect? No way. Bloated libraries? Hell yeah, but only use parts that you need. Able to get the job done? Yes.
[I primarily used their tools when I worked for a couple of videogame studios and at university - currently using both open source and MS tools and languages]
They could be making the very best tools in the world, for all I know they are. But the toolmaker in question has a bit of a history and I haven't forgotten that just yet: http://www.eweek.com/c/a/Linux-and-Open-Source/BayStar-Confi... (sorry for the ads on that page), they just couldn't help not playing nice.
Then there was netscape, the media player issue, a bunch of FUD to various governments to get them to extend their lock-in rather than to go with open source and a series of briberies http://slashdot.org/articles/06/12/27/1423234.shtml and so on.
The tools and their quality don't enter in to it, it's the corporate conduct that I have a problem with.
If you're in the Python, Clojure, Erlang, Haskell playground, you'd like F#. Also, clojure and scala on .NET are pretty quiet now (e.g. (I believe) they both still do type erasure on CLR just to conform with JVM), but the potential is huge.
Well its not all that good in Mono. Lots of libraries are still be ported. So code breaks when compiled in mono. Also, C# is too integrated with microsoft's one dimensional stack.
As a community of startup founders, we're all in the game to make money, and as such we're all nominally competing against one another, albeit on a very low level.
Whenever I see somebody making a business decision based on emotion rather than technical analysis, I can't help but crack a little smile. One more potential competitor has weakened himself just that little bit.
Closed minds in others are a competitive advantage for your business.
Effectively you are arguing here that microsoft tools are categorically better than anything open source and that C# is the best possible language, because technical analysis obviously did factor in to your decision and you choose 'the best', and I didn't.
What is best and what is not is dependent on a lot of factors, and if you think that microsoft is 'the best' then you should realize that what is best for you may not be best for everybody else.
I didn't realize we were potentially in competition, but I sincerely wish you the best possible success.
You'll notice that I didn't mention any technology or company in my post. So no, I'm not making that argument, nor am I advocating Microsoft in any way.
Allow me to restate: Keep an open mind and make business decisions based on rational analysis, or your business will suffer as a result.
I'd say the same to you if you were angry with Apple or In & Out Burger.
I read this: http://www.expatsoftware.com/about.html before replying to you, and assumed that you were using microsoft software based on your analysis of the pros and cons, the headers of 'expatsoftware.com' indicate it is running on IIS 6.0. Even if you didn't mention companies or technologies you clearly seem to have a vested interest in at least convincing yourself that you made the right decision.
So, of course you'd have made the same remark if I were angry with Apple or In and Out Burger.
Now, I have no experience with 'In and Out Burger', but Apple's antics of late have given me reason to regret buying an Imac for myself and my son a little while ago.
It is almost as though ever corporation that strikes it big in software immediately feels the need to not just taste but swallow, they literally want it all. I don't feel comfortable about that, and if that means I'll make a few bucks less, then so be it.
But so far it hasn't given me the feeling that I'm making less bucks, in fact I'm probably making considerably more.
To the tune of a substantial amount of money since I decided to leave microsoft behind me.
How is it working out for you on the other side of that line?
It's a shame some HN users down vote people just because they disagree with their opinion. I didn't seen anything in this comment that would be considered offensive to anyone. I didn't even see any FUD.
Can any of you really disagree with "No more viruses, worms, trojans, piles of malware..."? In all the time I have been using Linux (OpenBSD now) I haven't had this sort of problem. I am not saying this systems are invulnerable. But OSS/*NIX system users will probably not have this sort of problem and even if they do it won't be as often as Windows users.
P.S. Maybe the title attracted only Windows and C# people?
Perhaps because I have used windows for about 20 years now and never had piles of malware. I have never reinstalled the OS. I have never paid license fees, subscription fees etc. It is almost as if he were living in an alternate reality from the one I inhabit.(Note I have been dual booting Linux for around 10 years. I like both sides of the fence.)
Two all is comments are about Windows OS not a single one about C# which is presumably the topic at hand.
I've used microsoft products from before 'DOS' was even around, and I quit around 2003. I would have quit earlier but I still had to support a bunch of stuff that was running on windows (the webcam.exe client side stuff to connect to our websites), and a bookkeeping program that was windows only.
I've had to re-install machines numerous times because they became unusably slow or infested with malware. We had one machine to which this never happened, nobody really understood what made it different from all the other ones (as much as 25 machines at a time at some point), that little machine just kept chugging away. Maybe it needed an occasional reboot, but even that must have been rare because I don't recall ever having to do that. It's not like it was build with premium components either, it was mostly built from leftover bits and pieces.
I was a licensed MSDN developer for a long time, it cost a pretty penny. You've never paid license fees ? Ok, that's your decision, I always paid for the ones we used, in fact I probably paid for plenty that I didn't use (aka the microsoft tax).
For the most part though, windows was nothing but trouble for me and the people that I worked with, and since switching to linux I haven't had any experience even remotely comparable to what used to be my lot when still using windows.
The machine I'm writing this on was bought in December, the 'vista' installation that came with it was wiped and replaced with Ubuntu. It's a fair sized machine, 10G of ram and an i7 processor, this is still the first logged in session on that machine since I got it. That's amazing stability. It's possible that microsoft has comparable stuff now but I won't be seeing any of it until I either absolutely have to or they do something unthinkable today to prove that they really get it. (Such as, for instance really opening up the source to windows or some earth shattering move like that).
I'm happy you're happy with either, I'm more happy with FOSS stuff, it feels like it is a more natural and democratic approach to computing than having my capabilities granted and removed by some corporation, especially one that has been a bad little boy in the class of corporations.
You've never paid license fees ? Ok, that's your decision, I always paid for the ones we used, in fact I probably paid for plenty that I didn't use (aka the microsoft tax). Any copy of windows I have came with the machine, so I have never directly paid license fees(as far as the Microsoft tax goes Dell seems to charge the same for its Linux boxes). As a developer I have always used the other guy(borland and watcom mostly.)
this is still the first logged in session on that machine since I got it. That's amazing stability. Not sure what to say about that, I have only rebooted Windows after applying system updates for as long as I can remember but then I mostly turn it off when I know I am not going to use it for a few hours so I have never had a large uptime.
That still doesn't address the fact that this is entirely off topic as Windows OS != C#. My entire use case for C# is as the scripting language for Unity3d which is based on mono since it is cross platform capable.
I downvoted his post because I found his argument to be completely off-topic. "I hate Microsoft" has just about nothing to do with a post describing what is new in C#.
That's a pretty all-inclusive title, it apparently also addresses me. But I won't be 'getting ready for C# 4.0' and I think that I'm within my rights to say so and to explain why.
Maybe you don't like my reasons. Maybe you think I 'hate' microsoft (I don't, actually I think some of their products are pretty good, notably excel and visual studio, but I can't stand 'word', 'outlook' and 'clippy'). But I think they as a corporation still have to show they understand that they've done some things wrong in the past and until they change their ways (and deal better with the virus plague on their machines), and convince me that they mean it I will not be switching back, even though that probably would save me a bunch of headaches when communicating with customers that still think attachments in proprietary formats are a valid means of communication (it is to them all their buddies are using microsoft, I'm the odd one out).
I remember IBM handing out little flashlights on a trade show a few years ago, they were labelled 'we've seen the light'. It took them being beaten within another 3 years of their lives to finally 'get it', if not IBM could have easily gone the way of SUN and SGI. Microsoft still hasn't reached that phase.
I wish microsoft and all those that support them the very best, meanwhile I'll be playing over here with other, almost equally shiny toys.
I ignored the title and read the actual content (you generally need to tell me to RTFT, not RTFA :) ). I see what you mean now.
About the virus plague -- yes, I was hit by Blaster on XP too, but MS seems to have really started getting security around 2003. The only explanation for your product having more malware than your nearest competitor's, even though your product is objectively more secure, is that the amount of malware is a function of market share.
I agree with you about the downsides of using proprietary formats. However, the power of a general-purpose computing platform like Windows, Mac OS X or Linux is that you can choose to lock or not lock yourself exactly as much as you want to, so I consider it a non-issue. Given that the platform gives you the freedom to not lock yourself into it, to my mind technical specifics and personal preferences for tools become the deciding factor. I really like the Visual Studio debugger and C# as a language.
> I ignored the title and read the actual content (you generally need to tell me to RTFT, not RTFA :) ). I see what you mean now.
np.
> is that the amount of malware is a function of market share.
I've heard that a lot, but it may very well just be bad design. By the time another platform displaces windows we'll know.
Whether it was 'objectively more secure' I don't know.
The number of exploits that have been found over the years is alarming, I don't think that the various unix based desktop systems are that vulnerable.
One argument why I think that is true is that if the number of windows hosts is 100x as large as the nearest competitor (and it's not, it's much less) then the 'niche' of the competitor is large enough that for a few of the entities targeting windows and getting only a small share of the machines because of inter-viral warfare (and that's pretty much the norm) the competitor is actually 'low hanging fruit'.
Assuming of course that the platform is equally easy to exploit.
The fact that we're not seeing something like that to me suggests that there really is a real difference between the various platforms in exploitability.
I haven't read C# In Depth for 4.0 yet, but I would suggest that you should not pass on the 3.0 version. Here's why.
C# In Depth is not like a technical reference book where the author rehashes the same information what you can find on your own at MSDN. Jon discusses the evolution of language starting from C# 1.0 up to 3.0. I sincerely wish that all technical books were written like this. If you are still not convinced and want the cofnirmation from someone more authoritative, let me point you to Eric Lippert's forward for the book.
Eric Lippert is a senior developer on the C# compiler team and his blog is a must read for all C# developers.
Coming to the main point, my guess is that Jon may be skipping on some details in the new version of the book which he has already covered in the current version. And I think it would be great idea to learn about the choices/compromises made by the language designers.
Thank you. It occurred to me that it would be nice if the pre-generics artefacts were somehow erased from history. (They're essentially clutter in a space that's getting fuller and fuller, right?)
The funny thing I come back to question myself with after seeing ExpandoObject and not needing to declare types (var blah = ), is, why not just go all the way to Ruby instead of being stuck inbetween?
Well, I'm not sure that's fair. In most dynamic languages, you can add type annotations and/or formal pre/post-conditions to selected pieces of code, usually for either compiler verification or optimization purposes; thus making a little piece of your code statically typed. Would you say they should just "go all the way to C#" (or ML, or whatever you prefer?) Of course not.
The C# situation with dynamic is analogous. It's for people who like working in a static language, but want a particular piece of code dynamically typed because it happens to be very convenient for the task at hand. Obviously, there are a fair number of such tasks; mostly whenever you're dealing with a piece of structured but unpredictable data that lives outside your static bubble, like XML or external unmanaged libraries.
And var isn't really worth mentioning; it's just very simplistic type inference on declarations. It's just (very good) syntax sugar and doesn't have any special semantic meaning at all.
The part I fear most is that every object suddenly becoming an ExpandoObject; there will be someone 'clever' that will do that. I'm speculating, but when you have a hammer...
I think this also has to do with language expectations, express-tivity, and maintainability. A project already using a dynamic language will have some sort method to deal with the nature that certain calls will or will not exist. The addition annotations/conditions seem like optimizations, but doesn't fundamentally change how a programmer would go about using that dynamic language. C#, on the other hand, the language is more constrained to begin with. A (C#) programmer would normally expect certain things such as an interface having a certain number of methods with certain types. Just imagine a library exposing an api with expandos... =p
I agree, and so does Microsoft, actually; I had the chance to ask a fellow on the C# team (I don't work for MS but I was there recently) why some things in the BCL weren't made dynamic -- for example, when you call a constructor via reflection, and it passes you an object whose type is indeterminate at compile-time, why doesn't it now return type dynamic instead of type object?
His answer was basically your concern, that they didn't want to get in the habit of exposing dynamic things all over the place, since they felt it was sort of an unexpected thing to be doing in a language like C#. Hopefully third-party library programmers will be equally judicious.
The use of .NET and C# (and Java) is often mandated by management levels, specially in large companies. For those unlucky folks, even a tiny little progress is a move in the right direction.
Even if you want a .NET-like environment, you could use JRuby, Jython or Clojure and have a far better programming experience on top of the JVM.
I really see no reason to even consider C# or .NET.
I didn't mod it down, but it seems intentionally shortsighted. I use both C# (for work) and Clojure (for fun) regularly; I'm a big Lisp weenie, and even I don't feel like I'm having a "far better" programming experience with Clojure than with C#. The language is somewhat better, but the tooling is somewhat worse, in my opinion.
Saying those things are "far better" is just flamebait. If you're going to write such criticism, it's up to you to justify your statements, not up to other people to defend against a non-existent argument.
EDIT: Stop modding me up, holy shit. This is off-topic and it's not important. Why do you want to highlight this self-evident comment so much that you're giving it a bunch of points? If I could have just messaged jacques instead of posting, I would have done that.
"I don't feel like I'm having a "far better" programming experience with Clojure than with C#. The language is somewhat better, but the tooling is somewhat worse, in my opinion."
That does make sense. When it comes to things like, say, desktop application development, Clojure probably isn't there yet, even though it's backed by all the Java libraries. C# and .NET, on the other hand, were designed with this purpose in mind (among other things). If I had to write a Windows desktop app, I probably would choose C# over Clojure any day, even though I like Clojure better as a language. But, as they say, programming languages don't operate in a vacuum...
Which is great, because you actually provide some arguments. Downmodding like that to me is like trying to muzzle someone, as though by downvoting you can somehow prove they're wrong, whereas you can only really show someone is wrong by bringing a counter argument, preferably a solid one.
To encourage counter-arguments, one ought to make the original argument concrete and objective. Making a post to argue against a paragraph of snubs and the unsupported statement that X is just a "far better programming experience" than Y feels to me like getting trolled, not like having an argument.
Yes, but your own counter argument is based on a feeling, that's not much more solid than what Ricardo said to begin with, it is also unsupported, or at best anecdotal.
None of this based on objective facts or stuff that you could measure. His truth to me is as good as your truth.
But he got modded in to the ground and you got modded up.
I know. I didn't intend mine as a counter-argument, but just as background for why I felt it was flamebait -- I have experience that indicates to me it's not credible to just uncategorically state that one is "far better." Like I expressed, it doesn't seem like there was much of an argument to make a counter-argument to.
I wouldn't have modded me up, either; in fact, I would have modded me down, because this whole discussion is off-topic and doesn't deserve attention. I think the majority of moderation on here seems awful and is rarely even vaguely proportional to the quality of the comments, and I agree that this is an example of awful moderation. So you're arguing with the wrong fellow.
EDIT: I amended my comment above to be irritating and sarcastic toward people who modded me up.
His comment was idiotic and he's sounding like a smug dynamic language weenie. It pulls the "mandated by management" straw man, groups C# and Java together and treats them the same (which is strong evidence that the parent doesn't have a clue about what he's talking about) and did I mention it's got that classic dynamic language weenie smell?
The image that got conjured in my mind when reading that post was one of a teenage girl on the phone going, "C#? What. everrrr."
"I really see no reason to even consider C# or .NET."
This looks like an exhibition of the classic blub fallacy.
So, let's try to make your post into something more informative.
> he's sounding like a smug dynamic language weenie
I'll give you that. I have a strong opinion on the overall usability of statically-typed languages. I have been writing Java code for the past month and I really feel less productive than the month before, despite the very smart tools that take away most of the drudgery. I am also not anti-static-typing: I like C a lot. I don't like C++ that much because of Smalltalk-induced bias.
> It pulls the "mandated by management" straw man
I am yet to witness a C# project that's not born out of a corporate IT department. I have never seen someone move from dynamic languages to static ones for other reason than execution speed, and, even then, only after careful profiling.
> This looks like an exhibition of the classic blub fallacy.
Name 5 reasons to consider C# as your development language and I'll concede you another point. While you are at it, name 1 area where C# is considered the best language.
That would make sense, if C# was more powerful/expressive than Python, Lisp or the like. It's not; it's just the least sucky (language-wise) of the mainstream statically typed languages. Plus it has all the .NET libraries and works well on Windows (naturally), which are reasons why people choose (or are forced) to use it. Not because it's the epitome of power and flexibility...
"As long as our hypothetical Blub programmer is looking down the power continuum, he knows he's looking down. Languages less powerful than Blub are obviously less powerful, because they're missing some feature he's used to. But when our hypothetical Blub programmer looks in the other direction, up the power continuum, he doesn't realize he's looking up. What he sees are merely weird languages. He probably considers them about equivalent in power to Blub, but with all this other hairy stuff thrown in as well. Blub is good enough for him, because he thinks in Blub."
The "paradox" (or "fallacy", as you called it) here refers to looking at a language that is more powerful, but not realizing that it is. By contrast, when looking at a language that is less powerful, this is usually obvious.
My interpretation of the definition is that it's about being unable to recognize the benefits of something you're unfamiliar with.
> By contrast, when looking at a language that is less powerful, this is usually obvious.
You mean like how when I look at Python, its deficiencies relative to C# are obvious? Or are you talking about how when you look at C#, its deficiencies relative to Python are obvious? The blub paradox goes both ways.
The main reason is that it makes it much, much easier to interface C# with languages like IronPython or IronRuby. This allows you to take advantage of those languages' dynamic typing, but not have to drop into C when you need to squeeze a bit more performance out of your code.
ExpandoObject basically says you can add properties ad hoc. When that happens, how do I know when a property on the object exists or not? The value of static typing goes down with ad hoc properties.
Sure; if every object was an ExpandoObject, the value of your "static typing" would be nil. The point is that you can just make an ExpandoObject if you really need ad hoc properties in one place, and it cooperates with the rest of your statically-typed code.
To illustrate the value of such a thing, I invite you to look at the ADO.NET libraries for data access, which provided a verbose, painful "dynamic property bag" experience as far back as .NET 1.0; you had DataTables with columns that you would pass a type to, and then you had DataRows that you indexed into with strings to put objects in and get them out, and you had to cast them back and forth as you did it -- all of it ugly, none of it checked at compile-time. The value of C# dynamic (besides interop) is that now you can have such a thing in a fairly concise form with syntax that doesn't make you sob uncontrollably when you use it.
And people do use it. I have worked on a mind bending .NET call centre application within which the entire state of the program is stored within untyped, globally accessible datatables.
It's down to the old "with great power comes great responsibility" idea.
This ruby comparison might make sense if people were to use C#'s dynamic all over the place, but it's just a single feature intended for specific situations. Most of the code will remain as sensibly static as ever.
In the end he talks a little bit about what is beyond 4.0 and he demonstrates the "compiler as a service", which is something I am looking forward to see :) In fact guys from Mono already moved things forward a little bit: http://www.mono-project.com/CsharpRepl
I like where this is heading.