Why Use DOM Manipulation Over Custom Code?

Every once in a while, I write a fairly long response to a question in one of my USPJ Academy courses that just feels like a blog post. Here’s another one of those.

We’ve been discussing why you would choose to use DOM manipulation over custom .NET programming. Here’s one of my replies in the thread. It’s a little out of context, of course, but the points are still valid.

  • jQuery/JavaScript is equally available to a .NET programmer. If you write a custom Web Part, for example, you can embed script to give it client side behaviors, including Web Services calls to avoid postbacks. This just doesn’t seem to be a common line of thinking in .NET programming, where the tendency is to want to have everything happen on the server. (I believe that there are many historical reasons for this, including Microsoft’s late focus on the Web, but that’s another whole long blog post!)
  • As I discuss in my Middle Tier Manifesto, bad programming is bad programming. If you’ve hired contract .NET programmers and ended up with unsupportable code, then you’ve hired bad .NET programmers. Client side code is no different than any other code. It should be well organized, well documented, and well tested.
  • Client side functionality absolutely is not the answer to everything. Much functionality is best placed server side. It’s a set of tools, not the whole toolbox.