Wednesday, January 23, 2008

Why developers and infrastructure people don't get along

I think today I stumbled upon a big reason why developers and infrastructure people never seem to get along, terminology.

I was reading my friend Dion's blog post today about a new feature in the Google Maps API. He talks about things being dynamic and asynchronous. I take a quick look at the code, and think "wtf? this isn't really dynamic or asynchronous!", and of course I have to comment on it. I'm sure anyone who is an AJAX programmer who read my comment immediately said "what a tool, he doesn't know what he's talking about!". 

So, lets look at the words "dynamic" and "asynchronous" and see how a developer and an infrastructure person think of them.

First, synchronous vs asynchronous. 

As a person who has been engulfed in infrastructure for the past 10 years, the first example I think of is synchronous vs asynchronous disk writes. A series of synchronous disk writes happen in order they were called, while a series of asynchronous writes could be completed to the disk in any order and each write will return as soon as the OS has it buffered, and your application keeps running. From the application side, you don't care about when the asynchronous write is actually completed, you leave that up to the OS to figure out and trust that it will do it properly. From designing a system to handle a large number of asynchronous writes, I care about doing all those writes as fast as possible, and it doesn't matter the order or if one is delayed. As long as the application the infrastructure was designed for knows the write is done, it doesn't matter.

Now, lets look what an AJAX programmer thinks about the A in AJAX. The AJAX programmer does things asynchronously in their applications so that things can happen behind the scenes. They tell javascript to do "X" and once they tell it to do "X" they move on. This is the same as the sync vs async in disk writes. But, the difference comes in that the AJAX person actually cares and needs to do something when "X" is complete. But since Javascript is more or less top to bottom code, at some point their code is going to wait for "X" to complete if it hasn't by the time it needs the return of "X".  AJAX then, in my mind uses asynchronous bits even tho sooner or later the application will treat it as a synchronous item.

Now, lets look it from a C programmer standpoint. You write a multithreaded application. You spawn off 3 threads to do X, Y, and Z. You do require X, Y, and Z to complete before you can exit your application. You first wait on the mutex for X, then Y, then Z. Now you finish your application. Your waits probably don't care about how X, Y, or Z finished, just that they did so you can exit cleanly and not muck with running threads.

In either of these programming options, parts of the application are asynchronous, but they still as a whole are top to bottom and will rely on things being done in order at some point (either processing the data the asynchronous parts did, or waiting for them to be done in some sort of order). From the infrastructure side, you look at the programmer and say "stop calling your application asynchronous, its just partially asynchronous!!!!"

Now lets look at the term "dynamic"...

From an infrastructure standpoint, I think of something that is dynamic is something that will change based upon outside influences. Perfect example, DHCP (Dynamic Host Configuration Protocol). A completely separate service is responsible for handing out the dynamic data for a DHCP client. No where in the DHCP client code is the dynamic data stored as a constant in the code.

Now, lets look at dynamic from an AJAX perspective. AJAX/Javascript folks consider and refer to text that is generated inside Javascript on a webpage to be dynamic. Even tho that text may be sitting inside a bunch of constants and pushed out into elements on the page, the act of pushing the text out is the dynamic portion, not the content itself.

We both have different meanings of dynamic referring to different things. It took me awhile to grasp on the AJAX side that a bunch of constant strings in javascript can be called dynamic. While I'm sure a lot of programmer say "What is dynamic about DHCP, I get the same address every time!"

So, the developers say the infrastructure people are idiots and the infrastructure people think the developers are smoking something strange, and no one gets along, and projects fail.

But, the thing is, neither of us are wrong in our thought process. We just don't all have all the needed thought processes framed correctly to properly communicate, so we end up fighting and ruining projects.

So, what is the solution to this problem? Well, the only solution I can think of right now is beer.


1 comment:

Unknown said...

Brian, I think on closer inspection you'll find that you are mistaken regarding the "A" in Ajax.

Ajax requests are truly asynchronous. At the low level, an Ajax request invokes a callback function with the current state as the request progresses. At higher levels, Ajax libraries typically associate progress/completion functions with these state changes.

As JavaScript is single-threaded, these callbacks aren't executed concurrently to to other code, rather they are queued and handled like other events.

In my experience, waiting for the completion of a request does not happen. I haven't seen any code that does this. Rather, callbacks fit in quite well with the usual, event-oriented programming style of client-side code.