As far as I know, most web development is done with tools which are little more than text editors. For as long as the web as been around, you'd think that these tools would be a bit more sophisticated. Sure, they have syntax highlighting, code hinting, and automatic spacing. Dreamweaver has a design view that will auto create the appropriate HTML and CSS for you, and Word can save a document as an HTML file. But, I feel that there should be more.
Content Management Systems like Wordpress and Drupal does wonders for designers who don't have the time (or knowledge) to edit raw HTML and CSS. But at what cost? Have you seen how many stylesheets are on some of those sites. There is a main stylesheet, a stylesheet for the theme, each plug-in has its own stylesheet. It's madness! I've even seen websites that don't come from a CMS with upwards of 7 - 10 stylesheets. And then there are all the javascript files that are called; custom scripts made just for the site, jQuery, some other script from some other place. I saw one website with a total of 14 external CSS and JS files. That is an extra 14 requests the browser has to make, not including having to get any images that aren't cached.
I read on Stack Overflow somewhere that firefox limits the number of concurrent requests to 6. I'm assuming that other browsers do the same and that the number of requests they limit is probably comparable. Lets say that a good connection has a ping of about 100ms, those extra requests will take a minimum of 300ms to get. 300 milliseconds. Thats pretty quick. But what about those who don't have such a great connection. Maybe something is interfering with their wifi, or they are using a mobile device and the network is clogged to high hell (like using a iPhone in New York City). What if their ping time was around 500ms. With that many external files to load, your looking at a minimal of 1500ms. Thats just getting the stylesheets and javascript files. Any images that aren't cached on the client computer would have to be requested as well. Still kinda quick in people time, but that is FOREVER in computer time. And yes, people do notice when a website loads slowly. I always dreaded the "my computer seems slow" phone call for tech support.
Why don't we just embed the styles and the javascript directly into the webpage? Then you only have to get one the webpage and any images associated with it. Lets say hello to code maintenance. Those who have had the pleasure of inheriting any sort of code to update or fix, will know what I'm talking about. Code is hard to really hard to read. Much harder than it is to write, and putting all your code in one giant file is like writing a ten page essay without dividing it up into paragraphs. In writing, a paragraph should really have one main idea, with some details sprinkled in to support that idea. In programming, each individual file is a paragraph, one main idea, or purpose, and a lot of details sprinkled in to support that purpose. This makes it easier to read, find bugs, and allows you to know where to look to change something.
So web developers compromise. They keep all the files separate so that their code is easy to maintain at the expense of efficiency. They justify this by saying that the trade-off is worth it. Of course, they are talking from their perspective. If they can load their page reasonably quick, then it isn't their fault if someone else can't. How can they be expected to go completely crazy trying to debug a 10 page long paragraph. It isn't fair to the developer.
This is why development and production are kept separate. For this very reason. So that developers don't have to pull out all of their hair looking around for bugs. They can have their nicely separate files on the development side, and when its time to go to production, embed all the external CSS and JS into one file. Hell, you can even write a script or small program to do it for you, kinda like a linker. Those of you not familiar with what a linker is (as some who work exclusively with the web aren't), a linker is a program that takes the code that is created from a compiler and combines it into one file. Sometimes it's called a loader. Usually the linker and the compiler is the same program.
However, none of the places I've worked at has this kind of separation between development and production. The production side is always just a mirror of what is on the development side. When a bug needs to be fixed, or a change needs to be made, its changed first on the development side, and then those files are copied over to the production side. I don't know if this is because no one wants to deal with the overhead of a "web linker", or if the thought of one just never crossed their mind.
Of course, why stop at just a linker. Why not have a program that does more, like maintain a "CSS Smart Library", or allow developers to link notes or documentation to files (a little different than comments). Oh, or even have a built in bug tracker (*giggles like a little school girl). Imagine being able to write code once and then having a button that transforms it to PHP, ASP, Python, Javascript, or whatever else you want it to be. Or even have an optimize button that optimizes your webpages for specific browsers so you don't have to deal with ugly looking hacks. If anyone knows of such a wonderful thing that exists, please, please, PLEASE......let me know. Heck, leave a comment and let everyone know.
I guess I just want more out of the tools I use for writing code. I did a search of web tools today and found a couple that look interesting and will give them a try. What? You mean I could build the thing that I want? Why, yes I could do that, but I'm pretty busy. I need to adjust the margins of my blog and find just the right shade of green for the background. I don't have time to do something like that!
No comments:
Post a Comment