Thursday, August 25, 2005

AJAX means we are using Javascript more now than ever

Google has made my life a little more difficult, but in a good way. Now that google has their Gmail and Google Suggest sites up and people are using them and loving them. They’ve become the new standard/model for user interfaces on the web. Till these interfaces things like web mail haven’t advanced very far since 1999–2000 as far as the user interface goes. However with Google proving that application that use AJAX are a very viable method of enhancing a web interface without the use of plug-ins like Flash or Shockwave. The browser support for these applications are wide reaching as is the kind of applications that they can use it.

 For example, we have an employee directory application at work. It’s built the way that you would expect. ASP.NET  for our presentation layer, SQL Database for the data layer and  a business logic middle tier that acts as a transaction broker between the presentation layer and the data layer. Well being a database driven application, you have to have input data, right. So we have a page for inputting employee data. So of these fields are information about the employee. There are of course some fields that while not, duplicates are related to each other. For example, as with most places email addresses and network logins are derived from the users first name and last name. So using some logic on the server side, and the AJAX.NET component, I fill the earlier fields from the later ones. Now we’ve saved people steps, and saved steps are saved mistakes. However you have to know how javascript works to connect these things together.

I’ve had a love hate relationship with javascript, some of the things I don’t like about javascript, just isn’t it’s fault and goes back to my netscape 4.7 days. The fact that the DOM (Document Object Model) is just a little different for each browser is sometimes very hard to deal with. It requires hours of testing on different browsers and different operation systems. Another thing I have a really tough time is with debugging. I wish there was a tool that acted like Visual Studio and would at least give me a hint that something is awry in the code before I try to use it. 

Javascript is a good tool though and something that we are going to use more and more. In web development there use to be more of a line between the front-end logic and the back-end logic. They were written in different languages and didn’t communicate. Well AJAX and the demand for more dynamic user interfaces will demand, that they do communicate, they may not have to be written in the same language, but they are going to have to work together. Which brings me to my next point, I’ve gotten use to writing applications in reusable classes. Javascript doesn’t really work that way, you can create structures that mimic a class, but not very closely. This is going to need to improve, especially if you are going to have more logic in the front-end. 

The brings us to another point, now that the logic is in both the middle tier and the front-end the three-tier architecture gets a little muddy. The dividing lines are harder to see, and for a time like mine, there is more overlap that can be hard to communicate. If I ask my back-end guy to write javascript, he’ll think, that is the front-end guy’s job, if I ask the front-end guy to write a function in C# to handle some front-end process, he will look at me and say C#, that is the back-end guy’s job.

Security is another aspect that has to be considered. There are some real risks having logic in the front-end. Especially with search engines scouring every web page on the Internet. If your a financial institution you have to worry about phish, in fact you have to assume you will be phished. So with those things in mind, having a calculation that is important to your business in a .js file for anyone to find in a browser is like hiding the house keys in the mailbox. Sure it’s out of sight but most people can guess where they are. So anything really and truly important like that needs to be done on the back-end.  This is where AJAX over just javascript definely has an advantage. However it still must be smart enough to be session/context sensitive. AJAX.NET does a good job of this.

In short, I think that AJAX applications are only going to grow in popularity and complexity. Popularity because it provides a user experience closer to a native application. Complexity because the developer is going to be knowing where and where not to use these methods.  With a little forethought by application developer and architects web applications can be dynamic, easy to use and secure, but only if we user AJAX, where it makes sense, not just to use it.

1 comment:

Josh said...

I appreciate your information on sql database. I just bookmarked your site and will be back regulalry to keep on top of it. Please check out my blog on sql database exposed - I'd really appreciate it