7 Stages of new language keyword grief

0 comments suggest edit

My last post on the new dynamic keyword sparked a range of reactions which are not uncommon when discussing a new language keyword or feature. Many are excited by it, but there are those who feel a sense of…well…grief when their language is “marred” by a new keyword.

C#, for example, has seen it with the var keyword and now with the dynamic keyword. I don’t know, maybe there’s something to this idea that developers go through the seven stages of grief when their favorite programming language adds new stuff (Disclaimer: Actually, I’m totally making this crap up)

1. Shock and denial.

With the introduction of a new keyword, initial reactions include shock and denial.

No way are they adding lambdas to the language! I had a hard enough time with the delegate keyword!

What is this crazy ‘expression of funky tea’ syntax? I’ll just ignore it and hope it goes away.

Generics will never catch on! Mark my words.

2. Longing for the past

Immediately, even before the new feature is even released, developers start to wax nostalgic remembering a past that never was.

I loved language X 10 years ago when it wasn’t so bloated, man.

They forget that the past also meant managing your own memory allocations, punch cards, and dying of the black plague, which totally sucks.

3. Anger and FUD

Soon this nostalgia turns to anger and FUD.

Check out this reaction to adding the goto keyword to PHP, emphasis mine.

This is a problem. Seriously, PHP has made it \ this far without goto, why turn the language into a public menace?

Yes Robin, PHP is a menace terrorizing Gotham City. To the Batmobile!

The dynamic keyword elicited similar anger with comments like:

C# was fine as a static language. If I wanted a dynamic language, I’d use something else!

Or

I’ll never use that feature!

It’s never long before anger turns to spreading FUD (Fear Uncertainty Doubt). The var keyword in C# is a prime example of this. Many developers wrote erroneously that using it would mean that your code was no longer strongly typed and would lead to all hell breaking use.

My friend used the var keyword in his program and it formatted his hard drive, irradiate his crotch, and caused the recent economic crash. True story.

Little did they know that the dynamic keyword was on its way which really would fulfill all those promises. ;)

Pretty much the new feature will destroy life on the planet as we know it and make for some crappy code.

4. Depression, reflection, and wondering about its performance

Sigh. I now have to actually learn this new feature, I wonder how well it performs.

This one always gets me. It’s almost always the first question developers ask about a new language feature? “Does it perform?”.

I think wondering about its performance is a waste of time. For your website which gets 100 visitors a day, yeah, it probably performs just fine.

The better question to ask is “Does my application perform well enough for my requirements?” And if it doesn’t then you start measuring, find the bottlenecks, and then optimize. Odds are your performance problems are not due to language features but to common higher level mistakes such as the Select N+1 problem.

5. The upward turn

Ok, my hard drive wasn’t formatted by this keyword. Maybe it’s not so bad.

At this point, developers start to realize that the new feature doesn’t eat kittens for breakfast and just might not be evil incarnate after all. Hey! It might even have some legitimate uses.

This is the stage where I think you see a lot of experimentation with the feature as developers give it a try and try to figure out where it does and doesn’t work well.

6. Code gone wild! Everything is a nail

I think we all go through this phase from time to time. At some point, you realize that this new feature is really very cool so you start to go hog wild with it. In your hands the feature is the Hammer of Thor and every line of code looks like a nail ready to be smitten.

Things can get ugly at this stage in a fit of excitement. Suddenly every object is anonymous, every callback is a lambda, and every method is generic, whether it should be or not.

It’s probably a good idea to resist this, but once in a while, you have to let yourself give in and have a bit of fun with the feature. Just remember the following command.

svn revert -R

Or whatever the alternative is with your favorite source control system.

7. Acceptance and obliviousness

At this point, the developer has finally accepted the language feature as simply another part of the language like the class or public keyword. There is no longer a need to gratuitously use or over-use the keyword. Instead the developer only uses the keyword occasionally in cases where it’s really needed and serves a useful purpose.

It’s become a hammer in a world where not everything is a nail. Or maybe it’s an awl. I’m not sure what an awl is used for, but I’m sure some of you out there do and you probably don’t use it all the time, but you use it properly when the need arises. Me, I never use one, but that’s perfectly normal, perfectly fine.

For the most part, the developer becomes oblivious to the feature much as developers are oblivious to the using keyword. You only think about the keyword when it’s the right time to use it.

Conclusion

Thanks to everyone on Twitter who provided examples of language keywords that provoked pushback. It was helpful.

Found a typo or error? Suggest an edit! If accepted, your contribution is listed automatically here.

Comments

avatar

66 responses

  1. Avatar for Rob Conery
    Rob Conery August 31st, 2009

    Don't know if you meant to, but you kind of relegated everyone's negative comments to a kid who's cat died. The term "ad absurdia" springs to mind :).
    I'm one of those grieving geeks :).
    My issue isn't with the sound of the train, if you will, nor is it FUD. My thoughts are more along the line of ... "why"?
    Bertrand summarized it to me nicely: "because it makes tedious reflection tasks a snap". Yay! That's a great reason and I like it. But why is the focus on addressing Reflection? I know this will make someone cranky - but it's how I roll :) - usually when people Reflect on things it's because they're trying to spin up some magic...
    That's why I use it (and abuse it). Dynamic languages don't need to worry about this - code gymnastics (and contortions) are built in - it's the fabric of the experience.
    Trying to work a static, typed, compiled language into that experience is... well it's weird. C# is awesome in so many ways but if I want MethodMissing well... you know what I'm thinking.
    It's like that time we went to a strip club and we ended up at Chippendale's. I wanted to go, you wanted to stay and you said "look - there's a cross-dresser... just don't worry about what's underneath".
    OK that didn't really happen but in a really NSFW way - well that's the kind of thing that's crossing my mind.
    But - to back you up a bit - Cheese Moving is hard. But it doesn't mean that the Cheese has been moved properly :).

  2. Avatar for Joe Chung
    Joe Chung August 31st, 2009

    There's an eighth stage where you begin to question the language keyword once again and wonder if maybe there isn't a better way to do that. Usually only language designers or LISP (and maybe Ruby) programmers get to that stage though.

  3. Avatar for Andrei Rinea
    Andrei Rinea August 31st, 2009

    I don't get it... it's just syntactic sugar for reflection isn't it?
    [ What stage am I in now? :P ]

  4. Avatar for Andrey Shchekin
    Andrey Shchekin August 31st, 2009

    My problem with dynamic is "people can abuse it and people will". I have seen projects written by people whose intelligence seems to be comparable with one-celled organisms.
    While lambdas and generics are hard to really abuse and such people do not use them anyway, dynamic is really simple to use incorrectly. For example, why learn and care about interfaces, if you can call a specific method on any instance?
    And then someone gives you such project and asks estimate on required changes.
    (I like the dynamic dispatch, however).

  5. Avatar for Jason Olson
    Jason Olson August 31st, 2009

    I would disagree that the dynamic keyword simply "makes reflection easier." In my mind, there are two simple reasons why the dynamic keyword exists: 1) Dynamic Language interop (calling out to IronPython, IronRuby, [insert_some_other_dlr_lang_here]) and 2) COM Interop (perhaps better read as "Office Interop").
    When it comes to interop'ing with COM, it's a very powerful feature. When it comes to interop'ing with dynamic languages, it's also a very powerful feature. Outside of that? Not so much.
    Will it be abused? Absolutely it will! But that's true of almost every technology "improvement"/"feature". A feature isn't evil by itself simply because it can be used for evil. Are computers evil because terrorists can use them to coordinate their actions? That's a bit of a tangent though that is better suited for discussion over beers :).
    What's my personal take on this feature? While I see its usefulness in places, my reaction is honestly one of fear. Not fear of the dynamic language itself, that's not the problem. It's the fear that C# as a language is becoming more of a "jack of all trades, master of none" with each successive release. There is something to be said for a simple, elegant language that focuses on a specific scenario (or category of scenarios) and does them exceedingly well.
    Compare .NET land with the JVM space. Adoption of new languages built on the JVM is an increasingly popular paradigm on "the other side of the forest". Look at the growing popularity of Scala, Groovy, Clojure, etc. The most powerful languages are powerful because they minimize the amount of cognitive dissonance that is present when people learn to use the language. In other words, their concept count is low. Smalltalk and LISP are excellent languages that exhibit this aspect. Unfortunately, they didn't exactly "win" in the language space (though that can be explained by many other factors outside of language design).
    So, long story short, I fear that C# is introducing more and more concepts that a "new" C# developer (or even existing C# developers) need to know in order to be efficient. What if it continues to be an excellent general purpose language that is truly "general" purpose and doesn't particularly excel at anything?

  6. Avatar for Bertrand Le Roy
    Bertrand Le Roy August 31st, 2009

    @Rob: you know Latin, we get it :) I think like it was the case for Lambdas, it's our own initial lack of imagination that makes us miss the point.
    I don't buy your argument that if you need something like dynamic you should just use a dynamic language: nobody switches languages in the middle of a project, let alone of a class. The places where you will really need dynamic are few and far apart, so you will use the language you know best, or the one your boss told you to use, and you're going to use it for the whole project. If it lets you do X or Y more easily that's bonus points (and dynamic qualifies for that).
    @Andrey: dynamic languages by construction let you do that. Did the world end because of that? Of course not. Don't worry, everything will be fine. Well, let me rephrase that: everything will be just as fucked up as it used to be, no more, no less.

  7. Avatar for Adam Finster
    Adam Finster August 31st, 2009

    ... 'dynamic' models, 'dynamic' route dictionaries, 'dynamic' html attribute collections.
    I'm already thinking about a million and one ways I can abuse this! Yeah!

  8. Avatar for Danny
    Danny August 31st, 2009

    Haha, C# developers are quite easy going. You should see what happens when they suggest something new for Java.

  9. Avatar for vikram
    vikram August 31st, 2009

    Really good post. Loved it all the way....

  10. Avatar for David Markle
    David Markle August 31st, 2009

    Huh. Nobody has yet mentioned how useful "dynamic" could be when writing unit tests. I mean, if we're really writing our unit tests FIRST, that means we pretty much break the ability for our solutions to compile in a statically typed world, yes?
    I'd love to write my tests with dynamic whored everywhere. That way I would finally be able to live the dream of true TDD development in C# the way I could with, say Ruby. Writing a test for a test for a class or method that does not exist should just be a failing test, not a monkeywrench which keeps everything from compiling.
    On the other hand re: language enhancements, I think you do need to be careful, though. C++ was once a fairly elegant language, and I can barely recognize it now. It's now got most of the overhead of a modern language, and a ton of deprecated ways of doing things. That's not really due to a lot of new keywords, though...

  11. Avatar for Jonas Follesø
    Jonas Follesø August 31st, 2009

    I allways go straight to step 6.

  12. Avatar for Mark Rendle
    Mark Rendle August 31st, 2009

    Stage 6? I'm sure I don't know what you're talking about. I certainly haven't got reams of code treating generics like STL templates that I really need to go back and refactor.
    Of course, dynamic will be extremely useful when I do do that...

  13. Avatar for Ricardo Diaz
    Ricardo Diaz August 31st, 2009

    Good stuff Phil, had me smiling all the way :)

  14. Avatar for Craig
    Craig August 31st, 2009

    Great post, totally agree. But in the interest of not making every line of code a nail, perhaps you could post something in the future that more directly details examples of what good usage vs. bad usage entails?
    Thanks for the great work, Phil!

  15. Avatar for andyshader
    andyshader August 31st, 2009

    So what the f*** happened with ".NET is cool cause' you have one common runtime engine shared by all sort of different purpose .NET-aware languages". Seems C# is turning into a semi-functional, semi-dynamic..semi-crap father-know-it-all-language. To bad...it looked promising.

  16. Avatar for Jonas Stawski
    Jonas Stawski August 31st, 2009

    hahhahaahaha! Very funny and true at the same time. I went through these steps with the nullable types. I even wrote a blog post about how stupid they are and how they don't make sense. 3 years later I think they were a great addition to the languague.

  17. Avatar for John Teague
    John Teague August 31st, 2009

    There are a lot of great things coming with C# 4.0, but I am seriously worried about having a boiling frog problem. Those of us who embraced C# early on have had 6 years to digest all of the features added to the language. But a someone new to the language has a very steep learning curve to get up to speed. It is very difficult to put a junior person on an advanced team that is using the language features.
    Don't get me wrong, they are great features and make my life easier. But I think it's time for Anders and his team to go on vacation!!

  18. Avatar for Haacked
    Haacked August 31st, 2009

    @Rob, I'm like Stephen Colbert man. I don't see "static" or "dynamic". I just see a language. The language has various properties and features. Some are useful all the time, some are useful occasionally.
    It may well be that the future of languages are hybrids where trying to bucket the languages as being only static, only dynamic, only functional doesn't make sense. Many languages will exhibit some properties of each, even while being predominantly in one category.

  19. Avatar for Rickj1
    Rickj1 August 31st, 2009

    I'm a novice so I'm still learning on the demo I seen they were making javascript calls using C# and they had full intellisense that makes good sense to me javascript is a pain to use it is not for the beginner or novice to be able to do more things with C# to me is a good thing I'd like to see more tutorials and examples on using it to replace javascript in a web application and really put it to work I find debugging javascript a nightmare with this new feature the nightmare might turn into a good dream and if we have to kill a few kittens along the way I'm down with that

  20. Avatar for Bertrand Le Roy
    Bertrand Le Roy August 31st, 2009

    Some of the comments are quite ironically driving Phil's point home. "what, me? No, I'm not in denial!" You just can't win. :)

  21. Avatar for Danny
    Danny August 31st, 2009

    Phil please implement comments RSS, they are quite good as well. :)

  22. Avatar for Francois Ward
    Francois Ward September 1st, 2009

    You forgot step 8: Jump Ship.
    A new language comes in, that does exactly what the language used to do well before it got bloated, +/- the things that worked and those that didn't, clean up the mess, etc.
    How do you think C# caught on in the first place? People went through the first 7 steps with Java, then went on to step 8.
    That said, my issue personally is that the whole point of the CLR is so that there can be languages for everyone, but the VB-sation of C# is leaving a gapping whole: there's no clean and easy strict language anymore.
    Make C# into VB with curly braces if you want, just make sure to fill the gap that its leaving.

  23. Avatar for Rob Conery
    Rob Conery September 1st, 2009

    @Bertrand I don't know latin but I hear it's almost as fun as French...
    I was agreeing with you (if you didn't notice :) - it makes reflection a lot easier. Yes I think it will be a "cool feature", and yes it will be abused (as many things are). These aren't my issues...
    Consider the case when you say "Hey, I might need something a bit more dynamic here...". You might then spin up some Reflective code and off you go. Dynamic makes this dead simple - which is lovely.
    Fast-forward. Not a lot of people use Reflection every day but this bitchen keyword will do a lot to show just how flexible C# can be. This most likely will lead folks to try out some new and interesting ways to - well maybe come up with a Data Access tool that derives a SQL Statement from MethodMissing using Phil's stuff.
    It's tantalizing! Sexxy! Fun! And there are languages for that :).
    Now of course you're not going to change mid-project (in fact I'm fairly sure I didn't suggest that). But if you're a dual-wielding dev (which most are these days) you might just go with Ruby if you're going to do something that requires dynamic coding. Or PHP if you know it.
    The power of C# is how "clean" it is, the type-safety of it all, and the speed. I'm sure the dynamic keyword is nice and fast, and I know it will trim the code - but the place that it takes the architect and the developer is well-trodden.

  24. Avatar for Sean Scally
    Sean Scally September 1st, 2009

    Is it still true that anything declared as dynamic doesn't play nice with LINQ? The c# 4.0 spec seemed to indicate this, and I don't know if it's still true, but it somewhat limits the use of dynamic.
    The reason you pick a particular tool for a particular job is that it is well suited for it. The syntax for some operations is just cleaner and more readable in one language than in others -- that is why some people prefer different languages for jobs that require those operations.
    As Phil mentioned earlier in his post, it's widely considered a bad practice to take any particular golden hammer and see every problem as a nail. Isn't C# going this same route, then? Why not pick the right tool for the right job instead? I mean, I could work on my car with a Swiss Army Knife rather than a toolbox, but I think if I spent any non-trivial amount of time on such a task I'd be wanting more than just one tool. :)

  25. Avatar for dc
    dc September 1st, 2009

    Nice post and don't get me started about the using keyword...

  26. Avatar for Howard van Rooijen
    Howard van Rooijen September 1st, 2009

    The only real problem with var is the name of the keyword itself. The Gu himself posted the following:
    "A common misperception that people often have when first seeing the new var keyword is to think that it is a late-bound or un-typed variable reference"
    This is a common misconception because "var" has so many other connotations in dynamic languages. If only the keyword was called "infer" instead it would make so much more sense and make the code so much more readable.

  27. Avatar for Bertrand Le Roy
    Bertrand Le Roy September 1st, 2009

    @Rob: my point was that you are rarely getting up in the morning "to do something that requires dynamic coding". You are getting up to create a blog/commerce/younameit application. You just happen to need dynamic aspects in places, but you don't decide up front that you will need dynamic aspects and that is certainly usually not the most important requirement of your project.
    That is what makes C# attractive to me: I know it and I know for sure it will just get the job done with reasonable effort; same thing can't be necessarily said of other languages I like.
    I'd also like to answer those commenters who fear that C# is a jack of all trades, good at none: have you guys seen Linq at all? Lambdas anyone? :D

  28. Avatar for Rob Conery
    Rob Conery September 1st, 2009

    @Bertrand - getting up in the morning I think about coffee :). If I thought about anything dynamic that often, I wouldn't be having this discussion - that's my point.
    Recall, if you will, a discussion you and I had on campus during lunch one day RE dynamic languages...
    It's not nearly as simple as you're putting it. If you decide you're going to flex *anything* dynamic - well it's woven into your app. You flex a language and its strengths, or you don't. Dynamic is not the strength of a typed language in the same way that fire isn't something water produces to warm itself (unless you add magnesium... but...)
    C# is attractive to you because you know *what it can do with the framework*. Not what *it as a language* can do. If you worked with Django/Ruby/whatever every day - I think we'd be having a different conversation :). I know how much you love Ruby :).
    C# is becoming a jack/trade language. You said it in the previous sentence - "I know it and I know it will get the job done". At some point you have to ask: is a hybrid class better or should I just roll a Mage?

  29. Avatar for Bryan Watts
    Bryan Watts September 1st, 2009

    How would this argument play out if controversial keywords like var and dynamic were products in a supermarket?
    "Look, those cheesy poofs get your fingers all orange."
    "That's fine, it's worth it. I love cheesy poofs."
    "Man, this store is getting to be a jack-of-all-trades bloated behemoth. I cannot BELIEVE they sell cheesy poofs. They totally stain your hands."
    And what about features favored by the naysayers?
    "They started selling LINQade? This store is SO innovative!"
    Variety is the spice of life people. You can't stop bad code. Well-implemented tools are not a detriment.

  30. Avatar for Joe
    Joe September 1st, 2009

    Who are we helping when we introduce these new features/keywords into a existing language?
    The only people that are going to read our code are us, and other coders (other coders within our company, or other coders around the world if it's open source)
    Let's say we have a bug in our program which someone else is trying to figure out, and we are using some new feature like method missing. If they've never seen this before, they've now got to spend a while figuring this new language feature before they even solve the bug.
    They end up spending their time figuring out the syntax as well as the semantics of the program.
    The C programming language it pretty much the same now as the original language.
    C# however, has 4 times as many keywords and constantly has developers playing a Game of Fire and Motion (www.joelonsoftware.com/articles/fog0000000339.html) instead of being able to concentrate on the actual code. (The semantics)

  31. Avatar for Michael Chandler
    Michael Chandler September 1st, 2009

    @Joe - If C did everything we wanted then there wouldn't be C#, now, would there?
    New constructs/keywords don't bother me at all. They're easy to learn. What I see as overwhelming are all of the new frameworks and paradigms. I feel sorry for new developers that need to learn the BCL, WPF, MVVM, DI/IoC, TDD, BDD, DDD, ORM and about 10000 other acronyms.

  32. Avatar for Denny Ferrassoli
    Denny Ferrassoli September 1st, 2009

    :) I almost fell off my chair LOL'ing... "What is this crazy ‘expression of funky tea’ syntax?"
    Although not really syntax I don't like it when something gets added to a framework and then gets the cold shoulder... *cough* LINQ to SQL

  33. Avatar for Mark Hoffman
    Mark Hoffman September 2nd, 2009

    Some seem to be making this out to be an issue of resisting change or resisting new keywords or being a jack of all trades. It's not so much about adding a new keyword. It's about the line of reasoning that thinks a statically typed language needs dynamic features. Add features. Add useful features. But this smacks of "All the cool kids are using dynamic language. We need to have some of that, too." What does this really bring to the table? And what kind of problems does this bring?
    The nerd in me says that the dynamic keyword is cool. It's nifty. The pragmatist in me is frightened at how it will be abused and mis-used by people that simply don't know any better and are spoon-fed their entire programming knowledge from MSDN. Horrible scary.

  34. Avatar for Bryan Watts
    Bryan Watts September 2nd, 2009

    @Mark Hoffman,
    There are very specific scenarios for which the dynamic feature is targeted, common pain points that all C# writers can have a good laugh about. That so many different scenarios are enabled from such a simple mechanism is a testament to the elegance of its integration into a static language. Framing the feature as simply jumping on the dynamic bandwagon is a strawman.
    I wonder about the line of reasoning that says "static is static and dynamic is dynamic and never the twain shall meet". Developing well-implemented features that enable core scenarios is what language writers are paid to do. They are not paid to maintain anachronistic lines between obviously converging paradigms.
    Step 8: Become apologist.

  35. Avatar for David Nelson
    David Nelson September 2nd, 2009

    I seem to be in perfect agreement with Rob, which has me very worried :)
    "...you kind of relegated everyone's negative comments to a kid who's cat died."
    Indeed, it is bad form and frankly somewhat insulting to state that everyone who disagrees with you about the utility and value of a feature is automatically guilty of FUD.
    "You flex a language and its strengths, or you don't."
    This is the key point to me. Sure dynamic has potentially huge value in very small areas. And yes, bad programmers will write bad code no matter what language features are available. These are the edge cases, and they are not what concerns me.
    What concerns me, is the middle ground where *framework designers* will start to see dynamic as a way to get around all of the pesky things that the (inherently strongly typed) .NET platform currently forces you to do. Your interfaces seem to be getting too large and unwieldy for consumers to implement correctly? Don't bother refactoring, just use dynamic instead! Framework consumers now have a choice: use dynamic in their own code where it is clearly not wanted, or ditch the framework altogether, which defeats one of the primary purposes of using the .NET Framework in the first place (framework support).
    I simply don't understand why the C# design team chose to set up developers and the platform for failure this way. If nothing else, they could have done what they did for unsafe code and forced the use of a dynamic compiler switch. This would be a strong deterrent against overuse of the feature, while still allowing those who need it to use it without much extra hassle. Yet they didn't even do that.
    @Bertrand,
    The great thing about telling someone that they are in denial is that they can't deny it. That doesn't make it true.

  36. Avatar for Zack
    Zack September 2nd, 2009

    everything I know about 'dynamic' I leared on haacked.com in the last 2 days so keep that in mind. From the little bit I've gleaned, it looks like a reasonable solution for the problem it seems to be targeted at. However, I always cringe whenever someone proposes a new language feature and when others seem wary they decry, "but you don't have to use it!". This is a really short sighted answer. The only way this is true is if you only ever work on your own code. When you work on other people's code or read their articles or grab code snippets you have to work with other people's code and that can mean using features you don't usually use. I found a really good example today on stack overflow. stackoverflow.com/.../why-arent-there-macros-in-c Someone asked why C# doesn't have macros. Short answer? Macros are evil. But, someone else could just as easily said, "well I want macros, but you don't have to use them." Try telling a C/C++ programmer that they don't have to use macros. They don't have any choice. They can avoid writing any themselves, but the language and libraries and frameworks are littered with them (remember MFC?). Anyway, my 2 cents.

  37. Avatar for Mark Hoffman
    Mark Hoffman September 2nd, 2009

    @Bryan - Strawman? What are some of these "core scenarios" that you are referring to? What pain points is this solving?
    I see these types of "features" make it easy to throw good design and OOP principles out of the window and just say "Good design is hard. Oh to hell with it. Let's just toss in a dynamic and call it a day." I've seen reflection abused this way because the developer simply didn't understand how to build and design something properly and reflection provided a shortcut. Dynamic makes it even easier.
    Yes, bad code is impossible to eliminate and that can't be a reason to stop the progress of language. But I don't see how this is progress. I largely see it as a way for people to hack together something to make it work.
    Don't get me wrong. I like dynamic languages. I'm currently knee-deep in Objective-C and iPhone development and I look longingly to Ruby which strikes me as a beautiful language. But mixing them like this in the same language? I see it bringing much more pain than progress.

  38. Avatar for Haacked
    Haacked September 2nd, 2009

    @Bryan says it much better than I did.


    I wonder about the line of reasoning that says "static is static and dynamic is dynamic and never the twain shall meet". Developing well-implemented features that enable core scenarios is what language writers are paid to do. They are not paid to maintain anachronistic lines between obviously converging paradigms.


    @Mark I don't agree that using a dynamic language suddenly means you throw good design out the door. Good design is still a key element no matter which type of language you use.
    Design Patterns, for example, are common patterns of solutions to common problems. What's interesting is some of those problems are a result of static languages themselves. In many cases, dynamic languages don't need the same design patterns because there's no problem in the first place.
    I think there are a whole new set of design patterns that need to be hashed out with dynamic languages. I think that's the beauty of the dynamic keyword in C# though. In the rare cases when I'm writing a bunch of static code following some pattern that's unnecessary in a dynamic language, I can simply use the dynamic feature and simplify the code.
    @Rob ok, right tool for the right job. Show me an example of calling into Ruby from C#. Lessee. You have to create a DLR Host. Now you have to create a Ruby context within that host. Now find the source you want to execute and load it into the host. And so on.
    I think writing Ruby plugins on-top of an existing application where the application is already a host for Ruby is great! I've shown many examples of this on my blog.
    But in cases where your app isn't already a Ruby host, and you simply want to call into something dynamically, it's a pain to switch to Ruby just to do a small thing dynamically.

  39. Avatar for Haacked
    Haacked September 2nd, 2009

    @David Nelson I didn't mean to be insulting. As you might have noticed from the tone of the post, it was largely tongue in cheek. I don't think everyone goes through all 7 stages. Maybe they go through none.
    Not to mention, similar to Kurt Cobain's quote around Paranoia, just because you're spreading FUD, doesn't mean it's not true. ;)

  40. Avatar for anton
    anton September 2nd, 2009

    haha just read the php link...
    goto hell;

  41. Avatar for Justice~!
    Justice~! September 2nd, 2009

    Sincerely, this was the funniest post I think I've ever read from you!! So awesome!

  42. Avatar for Mark Hoffman
    Mark Hoffman September 2nd, 2009

    @Phil - I wasn't suggesting that using a dynamic language is evidence of bad design. Far from it. As I mentioned, I'm developing in a dynamic language right now and quite fond it. I'm merely questioning the wisdom of trying to force-fit a dynamic feature into a statically typed language.

  43. Avatar for Scott Koon
    Scott Koon September 2nd, 2009
    Design Patterns, for example, are common patterns of solutions to common problems.


    Design Patterns are, more often than not, a language smell. What is missing from your language that requires you to set up a lot of pomp and circumstance to make the hard possible?
    Why do we really need a Dynamic keyword and optional parameters in C#? Because the poor schmucks doing Office interop are tired of typing "null,null,null,true,null,null,null,null,null,null,null,null,null" and the IronPython/IronRuby folks are tired of banging their head against the CLR. So what we have here is a case of the business need driving a language feature. The Office division screwed up so we'll change C#?

  44. Avatar for Jason Olson
    Jason Olson September 2nd, 2009

    For those of you who immediately discount the "jack of all trades, master of none" argument or that think "it's just one more keyword, how bad can that be?", you have to think about it another way. We, as C# developers, are the frog in the pot that's slowly heating up. We don't feel the growing pain. However, if you throw a new frog directly into the water (i.e. a developer who is just learning C#), they are going to be in major pain.
    It's exactly like the erosion of freedom. Every single step makes sense and seems well thought out. But when you step back and realize what that means for the long-term, is it really worth it? We're losing sight of the forest, after all, it's just another tree! What's the harm?
    I also don't buy the supermarket argument. While common sense seems to say "more is better, choice is good", common sense is wrong. I wish every developer (especially API designers) would read the book "The Paradox of Choice." An over-abundance of choices isn't good, it is often very debilitating and can lead to major confusion.
    I also wish more C# developers would branch out and learn non-CLR languages, even if they are modern-day irrelevant. Go learn Smalltalk, go learn LISP, go learn Clojure, go learn Scala, go learn Groovy, go learn Ruby, etc. Ruby is currently the "cool kid", but there are so many other great languages out there that we can learn a lot from.
    C# is growing more and more into the modern C++, where long-time C# devs love the language, but it is very difficult for new developers to learn. For those of you who think it is a very simple language to learn (and that dynamic won't add to that baggage), go ahead and try to teach developers C# using .NET 3.5 SP1. Compare the cognitive overhead C# requires to a language like Smalltalk. With Smalltalk, you learn _two_ concepts: Objects, and Messages. Even an "if" construct is really a message sent to/from a Boolean object. It's truly elegant and powerful. Have you stopped to look at how many keywords alone C# has in it?
    So some might argue that Smalltalk isn't a good example because it "wasn't successful." While that is unfortunately true as far as market penetration goes, it wasn't because of the language. I've seen examples of 8-10 year olds writing programs in Smalltalk that I know many C# devs wouldn't be capable of today.
    Now, I'm not afraid of change. I'm afraid of change for the wrong reasons. I love rocking the boat and not taking things for granted.

  45. Avatar for commenter
    commenter September 3rd, 2009

    Jeez. Perhaps all these kneejerk conservatives should just go and use J# - lovely and cleannn.
    I feel like I've fallen into a time warp where all the stick-in-the-mud Java programmers have morphed into C# programmers.

  46. Avatar for Rob Conery
    Rob Conery September 3rd, 2009

    @Phil:
    >>>Show me an example of calling into Ruby from C#.
    Sure - here ya go:
    1) File | Exit
    2) Fire up Macbook
    3) mate MyProject
    4) (Open Terminal): rails MyProject
    I wouldn't - but it's not nearly as hard as you're pointing out (we did it for Kona). Either way it was a very strange and foreign concept to be programming a dynamic feature to a static app.
    -- I just left a really long reply but I'm going to move it to my blog so I don't hog space here.
    Either way - good post Phil! You've got people talking :)

  47. Avatar for Jason Olson
    Jason Olson September 3rd, 2009

    @commenter, interesting that you bring up "stick-in-the-mud Java programmers." I look up to the modern JVM space as they very much take the approach "right tool for the right job." There is no shortage of great languages on the JVM that fill as specific void and do it well. It seems like the idea of spinning up another language on the CLR is unheard of to many people, while it's (dare I say) common on the JVM side.

  48. Avatar for commenter
    commenter September 3rd, 2009

    Yes we could have different languages for different paradigms - if for some reason it was decided that paradigms shouldn't be mixed.
    But I can't understand why a new paradigm requires a new language.
    Do I need one car to drive to the supermarket and one to drive to work? The requirements are different - wouldnt it be more elegant to have two cars?
    But then, what if I want to drive to the supermarket on the way home from work? What if I dont want to spend twice as much on cars?
    In the real world programmers don't have free reign to grab and use the latest shiny language, and mixing languages in one project is awkward and has a cost.
    Extending C# to support different paradigms is useful to people who can't just pick and choose.

  49. Avatar for Jason Olson
    Jason Olson September 3rd, 2009

    I don't think that's the right comparison to draw. It's more like this:
    Sure, you could use a car as a garbage truck. It's not what it was originally designed for though. It works, but is, let's say, "less than optimal." However, I could design a new vehicle that is specifically designed for task of hauling garbage.
    I'm not arguing that it's a bad idea to haul garbage with your car. In small quanities, it's fine. But if you're trying to accomplish something that it was not originally designed to solve, it will be painful and there are probably better ways to get the thing done.
    After time, I could certainly add a dumper/fork-lift front end to my car, a trash compactor on the back, an optional snow plow on the front, and some painting equipment on the bottom to paint lines on the road. But eventually, it merely becomes a crappy car...

  50. Avatar for commenter
    commenter September 3rd, 2009

    Yes, too late did I remember that car analogies are a terrible way to argue about programming languages, or pretty much anything else apart from cars. That goes for my analogy and yours both ;)

  51. Avatar for Jason Olson
    Jason Olson September 3rd, 2009

    HAHA, they totally are. I was just starting to think the same thing after I posted my own :P.

  52. Avatar for commenter
    commenter September 3rd, 2009

    If I have a large existing app that's written in C#, it's probably not sensible from a business point of view to integrate a whole new language into the dev process (or rewrite in the latest designed-from-scratch language), just to implement a small part of the system where dynamism would be useful. The mere act of adding this new language complicates the whole dev/maintenance process and 'plugging' in the new chunk with the C# chunk is work in itself. So there's a big cost to language purism.
    That criticism doesn't cover starting a new project from scratch, but even there most programmers aren't free to commit their companies to supporting the latest language they've set their eyes upon.
    Dynamism, functional programming, OO - these aren't really 'trades', they're tools in a single trade - programming. I don't think combining them in one language weakens the power of each.

  53. Avatar for Haacked
    Haacked September 3rd, 2009

    @Rob you wouldn't, but you're discounting the full range of scenarios where people would. As many have mentioned in this comment thread, "Use the right tool for the right job".
    Well a single application has many jobs. Within the same application, the right tool might be a static language for one thing, and a dynamic language for another.
    Now I'm glad you're happy with firing up Rails, but what about me here building a client application where I need to do a small task where a dynamic language is the right tool for the job? You're saying I should just rewrite the whole app in a dynamic language? Firing up Rails is not a solution for everything my friend and it completely side-steps my question to you.
    Are you saying none of these scenarios are valid because you haven't run into them?

  54. Avatar for Zac Duncan
    Zac Duncan September 3rd, 2009

    As fat as I'm concerned, if a language feature can help me write expressive code and help eliminate duplication, that language feature is a win.
    All language features can be and will abused by developers who lack discipline and/or knowledge of design principles. Unless you are or work with that sort of developer why wouldn't you want your language to give you more power?
    As far as the "jack of all trades, master of none" argument goes, I'd much rather have a language that allows me to apply a multi-disciplinary than to have to introduce multiple languages into my project. I'm all for polyglot if it's a necessity, but if I can easily do what I need to do in my primary language there's no need.

  55. Avatar for Rob Conery
    Rob Conery September 3rd, 2009

    @Phil - I don't think that you can use a dynamic approach like you would a hammer or a screw. Reflection - sure. But then why are you using Reflection in the first place?
    I'm not telling you to rewrite the app - because you're a smart dude and would have tested all this first no doubt :) and realized "hey maybe ramping Reflection through the roof with C# is a bit messy. Maybe I should just use [language X] instead".
    It doesn't side-step the question as I think you need to think about the app before you write it. Let's take a blog for the masses :) - at some point you might want a pluggable system where you can override functionality on the fly, adding admin pages etc.
    Sure - you could do this with .NET. But a language like PHP or Ruby is much better for the task because that's how it's built. Bertrand and I had this exact conversation (before we built anything).
    Make sense?

  56. Avatar for Brian H. Madsen
    Brian H. Madsen September 3rd, 2009

    ahhhh...some of these replies brings me back to the time(s) where you hear developers spout sentences like "VIM is the best IDE for development" or "Notepad rocks, i write all my code in Notepad".
    seriously - a language has to evolve, otherwise it'll be superseeded by something else 3-5 years down the track.
    I know PHP is still alive, but how slow has it been in the evolutionary chain? and why is that? because some has put the "pure white hat" on and dictated what it should evolve to (or rather, not evolve to).
    Remember, that for all sense and purposes, a language is a toolbox. You might not use all the tools available to you, but you'd rue the day when you actually needed one of them. Imagine putting a shed up in the backyard, and all you had was a shovel.
    There's bound to be "purists" that claim their stance is for the "better of the community"...unless these "purists" are the sole reflective voice for the community, then it's null and void - and frankly, how many people can say they speak for everybody and take every single equation into account?
    Yes, when new features come out there's bound to be a "flood of sin" with overuse of a feature..be it "var" or "lambda expressions" - but that's curiosity (which in many cases like this, kills the cat) causing it - sometimes it's fascination of a new feature that grows into an obsession, but should these cases really dictate the pros and cons of how a language evolves?
    those of you who counts yourself as excellent developers, wouldn't be using a feature in excess..you know how to apply the language in the best way to reach a goal..
    As the saying goes - use the right tools, for the right job....
    Would i see a reason to use "dynamic"? yes, certainly...would i use it to the exclusion of all others? no.
    @Rob, one small comment (and yes i know, i'm a little fish in the big pond)...when deciding on what language/platform to use for a project, do you look at it as a 80/20 rule or would you choose something like PHP because it handled a single instance/situation better? I doubt that you would, seeing as you're a smart cookie (way smarter than me as well)..
    i firmly believe that the more features a language/platform has, the better equipped it is to handle the myriad of project types out there - making the choice of platform easier for me...why swap language if you don't have to? why resist a language having more and more features? because of bloat? bloat is identified as features that does NOT make a contribution to the usage of the language - it does not mean having features in there that's useful for a given situation.
    to all others - the "back in the good ol' days" comments just shows your ages fellas...there's a reason that the combustion engine took over from the draft horse.

  57. Avatar for Bryan Watts
    Bryan Watts September 3rd, 2009

    @Mark,
    The pain points are inherently untyped systems that, for whatever reason, we have to work with from C#.
    These include:
    - COM interop
    - Reflection
    - XML
    - Dynamic language interop (IronRuby, Javascript in Silverlight)
    - HTML DOM manipulation in Silverlight
    - Any scenario which otherwise requires a bunch of ugly code
    Some percentage of people who use C# encounter these situations enough for the language team to pick this feature over the vast multitude from which they had to choose. OO, while useful, is not the only approach to solving problems. LINQ is functional in nature, and helps tremendously in otherwise-OO scenarios. Dynamic is the natural third of the triad.
    The dynamic keyword is just mildly extensible syntactic sugar. The decision to use COM, reflection or XML to solve a problem is independent of how you express that solution. It boils down to people being uncomfortable with other people having sharp scissors.

  58. Avatar for Juan Zamudio
    Juan Zamudio September 3rd, 2009

    @Brian: "there's a reason that the combustion engine took over from the draft horse"
    And now we have a planet full of pollution.
    Seriously though, it appears that most of the people advocating for the dynamic thing are flying solo or are in a team full of super stars and don't care about maintaining old code. At my work the dynamic keyword is maintenance hell waiting to happen.

  59. Avatar for Brian H. Madsen
    Brian H. Madsen September 3rd, 2009

    @Juan,
    "And now we have a planet full of pollution"..
    yeps, used to excess that's what happens..same goes for using "var", "lambda" or "dynamic" to excess :)
    "At my work the dynamic keyword is maintenance hell waiting to happen"
    documentation, documentation, documentation :)
    as for flying solo or full of super stars...nah, regular folks like "dynamic" as well...they just don't know it yet :)

  60. Avatar for Jason Olson
    Jason Olson September 3rd, 2009

    @commenter LOL, it may not sound like it, but I'm in full agreement with you. I think there are definite uses for the dynamic keyword. And as a geek, I'm a huge fan of the addition.
    The fact that we live in a world where we have to be able to interop with technologies/languages outside of our stack, the dynamic keyword and the abilities it brings for interop alone is a win.
    I'm just stating that I have a fear that C# is becoming more and more watered down with each successive release. As far as language trends go, this is how it always happens :). Sooner or later, a language will come along that will "beat out" C# and learn all the lessons that C# learned and do them better (hindsight is always 20-20).
    I'm _definitely_ not against a language harnassing several different programming paradigms. But some ways of achieving that are better than others :).
    LOL, keep in mind that a lot of my thoughts are merely "what ifs." Also, as much as I like to bring up languages like Smalltalk and LISP, my coworkers find it hard to believe that the first programming language I ever learned was C# :P.

  61. Avatar for Charlie Flowers
    Charlie Flowers September 3rd, 2009

    Man, you truly are a funny guy. Well done.

  62. Avatar for Robz
    Robz September 3rd, 2009

    And then the cycle starts over again ... it's never ending :D

  63. Avatar for Dummy Customer
    Dummy Customer September 4th, 2009

    @Haacked: If you're Stephen Colbert, than I am Jon Stewart!
    And as Jon I would use my Star Wars action figures to show you the solution:
    Master Yoda: Dark cloud over C# I sense. Act we must!
    Master Shaakti: There is only one solution to this problem.
    Master Paratus: Yes, that solution is both simple and elegant.
    Apprentice Dummy: errr...you're talking about Option Strict for C# right?

  64. Avatar for EricTN
    EricTN September 6th, 2009

    I'm pretty sure an attempt to enforce good design principles on programmers by keeping a language pure and avoiding throwing in various swiss army knife tools is doomed to failure. Let's not underestimate the power folks that might be in the wrong profession can have on a code base if not properly managed by standards and a somewhat iron fist. I'm attempting to clean up a large complex app that uses mainly rudimentary aspects of the language that has been sabotaged into near oblivion simply because Control-C Copy and Control-V Paste exist.

  65. Avatar for Pop Catalin
    Pop Catalin September 6th, 2009

    I don't like dynamic anymore than I like using weak typed hashtables.
    However there are legit uses for dynamic like when you're interacting with a weak typed environment, like a Javascript object, other than that, I don't like the use of dynamic where strong typing could be used instead.
    Let's try not to make "dynamic" be "Option Strict Off 2.0" ...

  66. Avatar for Alan
    Alan September 15th, 2009

    Sorry, I just had to add:
    An awl is tool used to make holes in belts. It's what made Louise Braille go blind when he stabbed himself in the eye with it.