I've been working on learning JavaScript over the last month or so and I've come to a point where I've started to delve into the hot topic of "Asynchronous JavaScript, DHTML and Server-side Programming", or as some pundits have termed it "Ajax". The 'x' is supposed to stand for XML since one of the primary enablers for this technology is the JavaScript object XMLHttpRequest (though you can use it to return any type of text).

Overall, there are two main (and obvious!) problems with programming for the web that I've experienced so far:

  1. Lack of Cohesion

    I'm coming from an environment where all I do is program in C++. To do anything non-trivial for the web requires a solid understanding of at least 5 different technologies: (X)HTML, CSS, JavaScript, PHP and the DOM (I separate this from knowing the core JavaScript language). If you want to use a database, you'll also need to know some SQL and how to interface PHP (or ASP or whatever) to the database. If you want to have some interactive graphics/animations, you'll likely need to know Flash or SVG. Now we're up to seven different technologies.

    Learning all these new languages is great, at first. You can plop those babies onto your resume and sit back and watch the job offers roll in. However, actually working on a web application can either be tackled in two ways: 1) design up all your interfaces between the various technologies beforehand and then tackle each side in turn (do all your PHP, then work on the client-side bindings, then work on the presentation code, etc) or 2) start to cobble together pieces of things as you work in the hopes of getting something you can watch evolve into your final app.

    I've got (maybe) an hour or two to spend each day on something like this. Which way do you think I work?

    Of course, the problem with working on everything at once is that it is really disorienting to switch gears. I think I'm getting better at the switch between PHP and JavaScript but it still leaves me a little breathless when I do.

    The other problem is that it takes a ridiculous amount of time to do everything you want to do because of the steep learning curves. Being a man with other priorities (aka "my family") means that the amount of time I can spend learning anything has been drastically reduced since my single days (not that I'd ever trade my life for that). Expecting to learn seven new technologies and come up with something "killer" is highly unrealistic (and, well, just plain sad, really). The best I should be hoping for is to focus hard on a one or two areas and partner with others to cover everything. Alternatively, I can continue creeping along the seven paths and deal with the whole thing as a hobby to fill the time.

    Along with the "developing-everything-at-once" syndrome, there's also the matter of debugging/testing your app. Basically to test an end-to-end application requires a web server running PHP and potentially a database (MySQL) set up and configured on any machine you want to test it on. The other option is to constantly FTP your server-side files to your "live" web server into a sandbox location (which is what I do, since I tend to work on the same things from different machines throughout the day).

  2. Lack of Standards Compliance

    The server-side, I can deal with, and I can deal with it pretty well. The environment is fixed and even though I'm not fully in control of it, once I get things straight I really don't need to worry too much about it.

    The problem comes with all the different browsers (user agents) out there that might chance upon my application / website. Each browser is made by a different set of developers, each interprets standards a certain way, each has various levels of standards compliance, each has its own sets of bugs and each has special (aka "non-standards compliant") features they have chosen to implement. Getting even a few browser configurations right when programming up the client-side has proven to be quite a learning curve for me (considering I'm also learning JavaScript and the DOM). At this point, I'm targetting very modern browsers: IE 6.0 and FF 1.0. I may venture into Safari, Opera, and Netscape at some later stage long after things are stable and well-tested but I don't think I'll ever try to be compliant with older browsers (Netscape 6-, IE 5-, etc).

Now the problems I've listed above may be very obvious to a web developer, but what amazes me is that everyone is ok with them. Web developers seem to thrive in this environment where they have 8 different (and very sharp!) knives instead of one big bazooka. I can't say I can see a solution either: 8 knives it is...they all do different tasks (and they do them pretty good).

I'd like to make at least one suggestion: Someone come up with PHP for the web browser, will you? By this, I mean being able to write a client-side script in PHP in a web page that can access the DOM. At least if we have this then we can use one scripting language on both ends: server-side we have the core PHP and the massive PHP libraries invoked by the server and client-side we have the core PHP language and the DOM invoked by the browser. At least then I don't need to remember whether my variables need dollar signs in front of them or to be declared with "var"...

§79 · April 11, 2005 · Ajax, JavaScript, PHP, Software, Technology, Web, XML · · [Print]

1 Comment to “Ajax – The Power Of Clean?”

  1. Brett says:

    We are NOT “ok with them”. It’s shitty. Of course, you could always use a higher-level tool like Visual Studio.NET …