This is a post for all web developers who’re on my friends list or passing by my journal.
1. Get back the response object, and then insert the data appropriately by making the xml dom object methods.
2. Get back the response object, and then create a whole bunch of html in a string and pass that into the innerHTML of some div element. This is still acceptable for me where I might have to consider the implications of browser-specific issues with dom method usage. The classic one I’ve found is when I have to write setAttribute(“class”, something) AND setAttribute(“className”, something) for it to work on IE and Firefox. If I just wrote a string and passed it to innerHTML, I can just write the html in it that would be more browser friendly than the dom methods.
3. Get back the response object which itself has presentation logic that the client just pass to innerHTML of a UI element. Am I being snobbish or elitist to think that this is stupidness? Or maybe it’s the object oriented programmer in me squirming to still maintain elements of object oriented programming in a programming domain where you have to use a whole bunch of hacks to do anything that resembles good coding practices (which then nullifies the effort to bring about some order to the way we integrate html with back end systems). It’s not that I’m just being a purist in not wanting to receive presentation content directly from a server call that was meant to be a search or an action. It’s just that this approach seems to make programming more like taking a whole bunch of darts and flinging them at a dartboard and hoping that somehow they all stick in the right order in the right place. Debugging any problems becomes a nightmare. Not only that, whoever’s going to come maintain this code after you leave is going to curse you for being an insensitive git.
So here’s my question to all you web developers out there. What’s your take on all of this? I think web developments is one arena where programmers with various different backgrounds mingle and can share ideas. I’d like to hear your arguments to sway me to the third option above. (or hear validating arguments to let me know that I’m not insane).