Wednesday, 5 December 2012

Early Dec 2012 JavaScript Adventures


My JavaScript adventures continue. I have sort of started a separate little game project but more on that in a minute.

The little sprite editor that can't continues. I added a tiny bit of polish to it in the way of a title bar across the top. Suddenly is has started to look like a web app.

Currently it sits are about 750 lines of JavaScript but that probably needs a bit of a going over. Thankfully I am not starting to feel it is getting to complex just yet. This must mean my skills in JavaScript are improving  I look forward to how the app feels when I trundle past a 1000 lines.

As I wrote this it felt weird. talking about handling complexity of a 1000 lines. I regularly write code in Java or C++ in code bases that get close to 500k lines of code and do not struggle (and I do not know the full system obviously just a mental model) but in the past when playing with JavaScript I have noticed the fun starts to disappear when I get in the 500-1000 line mark.

I suspect it is because I am used to statically typed languages and dynamically typed languages need a slightly different approach. Also I am less familiar with dynamic languages so may make poor choices in terms coding idioms. I have noticed this in JavaScript and re-factor my work often as I learn more tips and tricks. Either way I feel I am rapidly improving in terms of skill in JavaScript.

One area I have to keep correcting myself on is generating html code in JavaScript. This makes the JavaScript verbose and I don't like it from a separation of things point of view. Having effectively made a few UI components it does give me an appreciation of the approach the say JQueryMobile have taken. Perhaps "What would JQueryMobile do?" would be a good question to keep asking myself.

So my approach to developing this little app is if I can do it somewhere other than JavaScript I should. Another example of this is the used of the animate function in JQuery where I should really be using css transition. All the browsers I plan on supporting have this implemented.

Enough pixel editing talk. My second project on the go is a very small game. I wanted to get a better feel for using entity systems inside game dev. It is a HTML5 canvas game and currently consists of a square that moves around. I am thinking of producing a space invaders clone. Yep small scale and not innovative but it should give me a good feel for entity systems.

That pretty much sums up my coding life. Quite enjoying it and it is nice going with the flow and coding up stuff I am enjoying. I am sure post Christmas new year I will get the urge to try to progress on to stuff that will be more useful for people but for now I am hacking code for fun.

No comments:

Post a Comment