Thursday, 10 November 2011

Continuing With Dart



I have now written around 1000 lines of Dart and am starting to get a feel for the language.

Programming in Dart is pretty easy. If you know Java/Javascript/C# (probably) then Dart feels like second nature within an hour or so of coding. More and more these days I feel a programming language should get out of your way. That is be small and easy to remember. If you have to pick up a book/documentation to remember how to do something in the core language then, in my opinion, that is a fail for language designer (Yes C++ I am looking at you). Note: everyone usually needs to look up API calls they don't regularly use I really mean core language here.

I have written a few examples using the HTML5 canvas and having auto completion on the context helps compared with doing the same in JavaScript. Yes after a few examples it was starting to stick into my head.

I don't want to give you a glowing view on Dart it is early days yet and I do have some gripes.

When hacking on small scripts I would like to be able to create inner classes. It is a small thing but it helps keep me in the flow. I am sure many would argue it is not the best form of encapsulation. For me it is a form of encapsulation that is useful when working on small scripts (that are growing). I don't want to break my flow and start a refactor of classes into separate files but I do want to ensure that a certain class is only visible inside another class to ensure things don't get too tangled up before the inevitable refactor happens.

I may have missed it but there the supplied libraries need fleshing out. How do I shuffle an array of objects and stuff like that. With Dart at V0.04 at the time of writing I am expecting this sort of thing to be missing. The really important stuff is there. In some way I am wishing Dart was a year to two further along the development path.

This one is not a gripe. Operator overloading is wonderful. If ever there was a feature that should be in more programming languages this is it. Coming from C++ not being able to overload the plus(+) for vectors in languages like Java and JavaScript just feels awkward at best. Even having to use myvector.get(idx) instead of myvector[idx] often feel odd to me. I am sure if you have grown up with this stuff operator overloading can feel odd or dangerous and just not needed. You can get carried away with operator overloading but most people don't and most use it in sensible ways.

I would like the IDE to gain one important feature. I would like it to check and download updates for itself. I missed one revision of the IDE. Sure the changes are minimal and you could make the automatic updating optional but I would like to not have to worry about manually checking for updates.

My biggest complaint so far is the size of the Javascript output by the Dart to JS compiler. At 6.5MB for a hello world it is too big. Google have given use a new language to play with so lets those that are playing share the stuff they have made without eating up tons of bandwidth.

The other night I created a simple little game about making squares disappear. It is simple but took about 2hrs to make including designing 18 levels. A nice evening hack and given a couple more evening of coding I could make it into a presentable little, simple game. At 6.5Mb I don't plan on uploading it for other to play any time soon.

In my opinion this large file size should be a top priority even at this early stage, people want to show what they have been making and that is a barrier to it. They say they plan on fixing it but the sooner the better.

On the whole I am quite happy with Dart. It is easy to focus on the negatives part but for now I plan on continuing to write some code and getting to know it a little better.



No comments:

Post a Comment