|Submitted by jestin on Sat, 03/05/2011 - 00:00.|
Computer programming is a game of trade offs. It seems to be an immutable fact that you cannot optimize for everything, so decisions must be made. If you want to use less memory, you may have to sacrifice speed. To get faster speeds, you may have to use more memory. To get both speed and efficient memory usage, you may have to use lower level languages and sacrifice development time. If you need to hit a certain deadline, you may have to accept less than efficient code. Trade offs are practically the underlying theme of any engineering discipline. You can't avoid them.
As my interests have changed from tradition desktop development to the client/server model of web and mobile device development, I have started running into new trade off scenarios. The usual trade offs are still there, but they start to be a secondary concern behind the new ones. More specifically, I'm talking about what tasks are done client side, versus what tasks are done server side.
For my current web development interests, I have been using ASP.NET MVC on the server side, and JQuery and HTML5 on the client side. I then use Ajax to stitch it all together. ASP.NET MVC allows me to create a nice RESTful api to be used with my Ajax requests, and JQuery allows me to request information in raw form and as partial views. These technologies really work together to create a nice system. The trade offs come in when I need the user to interact with dynamic data.
In most cases, a query into my database is necessary, so nearly every task has a back end server side component. The .NET framework offers my many ways of querying my data (DBLinq FTW!), but then I have a choice of how much work to do before passing it back to the user's web browser. I make heavy use of partial views, which MVC and JQuery make trivial to use, but it's not always the best solution. For example, on some pages I have an HTML canvas that uses a big blob of JSON to hold it's data. I can use my RESTful api to query this directly with Ajax, or I can build it into a view or partial view. If I go with using a partial view, I then have to decide whether it should be constructed when the page is first served, or whether it's best to be requested by JQuery and stitched into the DOM. As with all trade offs, it comes down to my priorities.