To GC or not to GC – and other programming language thoughts

Having read the following article about programming language sacred cows, I was reminded of being annoyed in the past.

I can really sympathise with points 7 and 8 (Compiled vs Interpreted. Static vs Dynamic & Garbage collection is bad).

It’s nice to be able to chuck a Java/C# “executable” to anyone and have a fairly good idea it will work, but there are many times when I know exactly where the “executable” is going.. My production environment! Why the hell can’t I just compile it there and then with all the optimisations in place. I know there are lots of people who say JIT compilers run just as quick etc, but there is inevitably that “first time” lag, why do I need to suffer that when I don’t need to.

Having spent a day twonking about with strings in C++, I can remember why everyone gave a sigh of relief when string manipulation was made so easy in Java (I know you could get the C++ boost libraries and have similar functionality, but I didn’t know about that at the time, which is kind of the point). When I want to concatenate a few strings together and write out the result, I really don’t want to have to deal with memory allocation and the fear of the impossible to find memory leak. However, if I’m making an ant simulation where there are thousands of entities being created and destroyed, I want really tight control of when they go away. I don’t want the dead ants to hang around just because I once referenced a parameter in the wrong place (JavaScript, you know who you are).

The other points, while I can see the advantage of not storing things as text, trying to get people to standardise around another format. It’s bad enough with text, with my .Net code, I feel rather locked into Windows (I know there’s Mono) because the code works so tightly with Visual Studio. I think maybe the popularity of JavaScript comes from the fact that you just throw around plain text, so you can edit it on your mac or Windows laptop with equal ease, it’s the shared execution environment that provides the unification.

 

Advertisements
  1. I really like programming in C, it’s just so quick in execution, but you pay for that in development overhead (plus more care and design is required to avoid memory leaks or the dreaded core dump). Modern C++ has a lot of helpers and automatic cleanup, but it’s still a bit low level for modern developers.

    Anything that runs in a black and grey window isn’t top of my list, sorry Java, code it once, recode again, pull your hair out and curse at it.

    Interpreted/dynamic languages have their place, but not in high load processing systems. Testing those exception cases becomes difficult at times and a modern compiler (including intelisense) can catch a lot more than your eye can.

    I prefer Windows and .NET nowadays, the documentation is generally of a high standard too.

    • Oh, one thing I miss in some modern languages is a declaration of what exceptions are thrown from a method, though this is verbose, I’d be happy for autocompletion to help us out there. It would save me having to document it in the comments (time permitting) and indeed force proper planning of exception handling. From memory Java has this, but it’s not complete from what I recall.

      • Agree with the declared exceptions.. It was nice to be able to say that my method would throw a “JohnMessedUpException” and my compiler would force me to deal with it or re-throw. Perhaps an “I can’t be bothered to deal with exceptions” flag or something for a particular method.

        With the languages, my point is that if I like a particular syntax, I shouldn’t be forced to use a particular execution model. Maybe, I like JavaScript, but why am I forced to run it as an interpreted language on my server if I’m using Node. Hell, I can’t use Direct X unless I write in C++ (maybe time to import libraries: http://www.codeproject.com/Articles/1392/Using-Unmanaged-code-and-assembler-in-C )

        The ecosystem is a point made by the original blog. Microsoft has a good ecosystem for putting together a UI whereas Java really doesn’t. I have a freind who’s doing games in Java so they’ll work on Android, but personally I’d go straight for HTML5 for mobile because there are already alot of good tools for working up HTML.

      • Are you talking about JavaScript in a DLR sense? I didn’t realise it was in the DLR. We’ve been toying with IronPython recently, but if we could use JavaScript that would be even better from my side of things.
        Essentially we want C# compiler as a service, not long to wait hopefully.

      • DLR? Do you mean CLR?

        I was talking in more general terms. But the plan is that Node is going to be supported by IIS at some point, so it could be what you’re looking for. http://www.hanselman.com/blog/InstallingAndRunningNodejsApplicationsWithinIISOnWindowsAreYouMad.aspx

        Don’t think it’ll be using the CLR though. You might want to check out IronJS / Node.net for such things.

      • No, I mean what I said, DLR!
        http://msdn.microsoft.com/en-us/library/dd233052(v=vs.100).aspx

        IronJS is indeed built on the DLR, ace, shame it isn’t MS, but open source.

      • Found out abit about the DLR after I had responded. Node.js seems the one with the momentum at the moment, but it’s based around V8, not the DLR. There may be a merger at some point in the future as MS have alot of interest in it.

        Why do you want the compiler as a service?

      • C# scripting.
        http://www.microsoft.com/download/en/details.aspx?id=27746
        I’ve not ventured into it until it is a real release as I can’t use in production until that point.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: