Saturday, November 30, 2013

Javascript is the new BASIC. And that's not necessarily a bad thing.

I think I come from the last generation of programmers that grew up learning a BASIC dialect as our first programming language. Then came Java, then Python, then C#, and now Javascript.

I grew up with Qbasic 1.1 on MS-Dos 5, chugging along on my dad's old 386sx. We didn't even have a floating point co-processor. But coding on that thing was so much fun. I made my own sprite editor, a hand full of games, and got it to do some of my math home work for me. I can even go back today, and with a little bit of reflection, do some wizardry again in that ancient old programming language. Probably the best part about programming in QBasic was that a good chunk of this was before the internet. I actually had to go to the library and check out an ancient programming manual, then figure out how to adapt it to QBasic. This was fun.

So now here I am, 20 years later. (Have I really been doing this for 20 years?) I develop .NET all day working on a CRM system. Programming hasn't really been much fun. It's been quite productive, that's for sure, but not much fun. Then I decided to put together my Romflow application. This isn't the first time I've tried to make an emulation frontend, but this is probably my best effort to date. In looking at the other options available, I wanted to make something fast, something customizable, and something easy. So instead of doing a plugin system using C# interfaces, or hardcoding something using System.Drawing, I decided to look into using a web control hosted application. And you know what? It works really really well.

Kind of. You see, I'm not very good with the HTMLs and the CSS and the Javascript. Since I graduated from QBasic, I've stuck exclusively with statically typed languages. I liked the predictability and stability, and the ease of debugging that statically typed languages had to offer. However, at least not right away, this is not really an option for working with romflow. While it's possible to design a silverlight application, or a flash application, or a dart application, it's actually just much simpler to write something in Javascript.

Even though it's simpler, it's still not all that simple. You have to remember, we are doing things to HTML that it was never intended to be doing. HTML was meant to be a document, not an application framework. Never the less though, here we are. The biggest challenge for me is working with CSS though, not even Javascript. CSS feels like the rules are made up as you go along. Especially when it comes to vertically aligning content.

Despite having stack exchange, countless forums, and numerous other resources, making a good looking web app is still a gigantic challenge. Especially if you are invoking the dreaded window.external API. But, when I actually got something working the way I wanted it to work, I was 8 again, hacking away on my dad's dying PC. Hours started to go by as every minute, my app worked a little better, and a little better still. I no longer see an empty HTML page as a portal to evil, but rather as a canvas to paint my ideas upon. Javascript is fun. And fun isn't something I've had with programming for quite a while. It's challenging as well.