30 May 2006
•
Software Development
Never provide representations of static resources by dynamic means.
Or, serve anything you possibly can directly from a file on a local file system.
There are several reasons for avoiding dynamic mechanisms whenever possible. The most obvious reason is that it is wasteful to generate the identical content repeatedly. If the resource never, or very rarely, changes you can generate the representation(s) once, either at development time or when the application is built/deployed. Even if generating a resource requires little effort it will still result is longer response times, unnecessary server resource (CPU, memory, etc) usage.
The performance impacts of dynamically generating content should not be ignored. However, I think the impacts on ease of comprehension have a much greater effect. Understanding data that is create dynamically is significantly more difficult than static data. For the most part, static data may be understood simply by reading it. Dynamically generated data, on the other hand, requires that both the generated data and that the ways in which that data can vary be understood. Even in cases where the data does not actually vary the fact that it is served via a dynamic mechanism means that its generation must be treated as if the data can vary until the source code has been fully examined. Such examination can range from trivial to fairly hard but it is never free.
Using static representations does raise some practical issues, however. Most web servers tie significance to the pattern of filenames. For example, a file whose name ends with “.html” will be treated as a static HTML file and files whose name ends with “.php” will be treated as a script that will dynamically generate content. Additionally web servers also directly map URIs to filenames and directory structures. Those two decisions make it difficult to change one’s mind about the dynamism of a particular resource because if you want to change a representation from static to dynamic, or vice versa, that changes the URI itself.
If you are using Apache 2.x you avoid this issue by using the MultiViews option which causes Apache to correctly select the appropriate file if the filename extension is not explicitly specified in the URI. Unfortunately, MultiViews in Apache 1.3.x do not work well enough to completely solve the problem , but apparently rewrite rules can be used. Even if a technical fix is not available available this issue is fairly easy to manage. Changes in the dynamism of resources are rare and when they do occur correcting links to point to the new URI will generally only require a search and replace operation.
22 May 2006
•
Miscellaneous
•
Software Development
A few months ago Mr O’Grady mused about coffee shops being good places to work.BTW
Stephen, when is the next [Denver Tech
Meetup](http://www.denvertechmeetup.com/)? In that post he mentioned that he really liked the idea that while working in a public space you might run into other technically inclined people from the area. That idea had not occured to me before but now I find it seductive.
Mr O’Grady was kind enough to included a list of his favorite places to hang out and work in downtown Denver, which was excellent. However, now that I am working in Boulder that list is of a little less use to me. So, I need some suggestions of good public spaces in which to work, eat and/or get caffeinated in Boulder. If youSome of the local bloggers like [Ms
Zelenka](http://www.annezelenka.com), [Mr
King](http://www.alexking.org/), [Mr
Snyder](http://jroller.com/page/bsnyder), [Mr
Davis](http://www.davisworld.org/blojsom/blog/), [Mr
Raible](http://www.raibledesigns.com/page/rd), and [Mr
Carter](http://multipart-mixed.com/) must have some favorites, at
least. know of a great place to hang out, work and maybe have some interesting conversation in Boulder I would love to hear about it.
19 May 2006
•
Software Development
In my new job I am getting a chance to really learn PHP. PHP is the workhorse of the web these days. There are tons of web applications written in PHP, probably more than any other language or framework. This is primarily because it is so productive, as I found out a while ago. All that being said, I find PHP really weird. I should note that I have only used PHP 4. Because we use PHP 4 in production here, I have not take much time to check out what is different in PHP 5.
The first thing I missed was exceptions. Sure you can write software without exceptions but the result is just so ugly. Often you can barely see what is suppose to be happening because of all the isError()
checks. Of course, skipping those makes things even worse because you end up with killing the PHP process because calling a undefined method is a fatal error.1
Perhaps the weirdest thing is the way PHP deals with objects, though. I have been working almost exclusively in stronglyagik”) OO languages for a long time now so I am very used to the parameter passing orthodoxy of “object reference by value”.2 In most mainstream languages you cannot pass objects directly as parameters at all. Rather, you always pass an object reference.
PHP, on the other hand, not only support passing objects directly but pass by value is the default way to pass an object. Unfortunately, that is almost3 never what you want, so object based code ends up with pass by reference indicators sprinkled all over the place.
And then there are the nits…
I despise explicit statement terminators, they clutter the code without adding any useful information. If you, as a language designer, really feel that you cannot take the time to write a parser smart enough to automatically detect the end of statements at least pick a termination character that is less ugly than the semicolon.
Most of the time I don’t seem much need in investing effort to reduce “finger typing” but the method invocation operator gets typed so much that making is easy to type really is worth the effort. It really should only be one character, and preferably one that does not require the shift key. PHP misses on both counts by making the method invocation operator ‘->’, which is two character one of which requires the shift key.
Still, even with all it’s issues there is no doubting what you can do with PHP if you are willing to get a little dirty.
{Update: Added note about only know PHP 4.}
16 May 2006
I have been working my way through Bruce Eckel’s collection of software related interviews recently. A couple of weeks before Mr Eckel posted these I recently realized that I had stopped listening to most of the podcasts to which I subscribe, except for the episodes that were interviews. So when I saw this set of interviews I was quite happy to have a good bit of listening material to ease me into my new car based commute.This week I am really glad because \[my local NPR station\](http://www.cpr.org/ “Colorado Public Radio”) is having a fundraiser.
I have not yet listened to every interview in the set but the ones I have listened to so far are really good. This collection of interviews is many hours of listening but if you can find the time you will not be disappointed.
Today I am listening to Tim Lister of Peopleware fame. Peopleware is one of those book I have been meaning to read for years but after listening to this interview I think I might start with his newer book Waltzing with Bears about managing risk on projects. While talking about how most projects are estimated Mr Lister says:
Someone says “What’s the estimate?” and you say “38.5 work months”. I have taken enough statistics to know that the .5 is a joke, and the 8 is a joke and the 3 is a fraud. Other than that 38.5 is perfect.
That pretty much sums up every project estimate I have ever been involved with.
08 May 2006
•
Miscellaneous
I am just finishing my first day here at WebRoot. It has been an interesting day. I have learned a little of how things work here and meet some great people. You know, the usual first day sort of stuff. I cannot wait to do some real work.
For the first time in years I have an office with a door and everything. Even better my new office has a western view. That means that all day I get to look at the mountains. This picture is the best my phone can do but does not do the view justice. That is Boulder Creek you see in the foreground and the Colorado front range in the background. Maybe tomorrow I will bring a real camera so that I can gloat properly.