Happy Thanksgiving
Happy Thanksgiving to all the US residents out there! This has been a particularly good year, as I’ve been able to keep OEIC running strong on interesting projects for great clients. Many thanks to everyone I’ve worked with this past year for the opportunities; I hope your generosity returns to you two-fold! It has been both immensely satisfying and challenging running a development business. Today is the day to be grateful, and I’m most definitely feeling that way. Thanks again!
Gmail 2.0 - wave of the future?
A few days ago, Google rolled out a new version of Gmail that offers a few interface enhancements. One thing I immediately noticed was that the “Loading…” warning that appears when you first request the page has changed from Times New Roman to Arial, and it’s margin has increased. Aside from that though, the changes to the email writing and browser interfaces seem minor, if not undetectable. The interface for Contacts has changed considerably, and seems to mimic OSX’s finder window, with three vertical panels in a row.
What is really noteworthy about this application deployment is how heavyweight it is. It takes much longer to load up front, the Contacts screen takes about as long as a traditional page request, and most importantly, it crashes Firefox under a number of different circumstances. It seems that we have reached a point on the web where programs (websites) are taxing the operating systems ( browsers) to the point of failure. This is an issue that has been alive on the desktop for as long as I’ve been around, but it is pretty novel in terms of the web. It seems like a an important milestone for a few reasons.
There has long been a retail computing hardware gap between such “lightweight” tasks as word processing, email, web browsing etc. and “performance” tasks like CAD, graphics, video editing etc. It has been assumed that if you’re just poking around on the web, you don’t need the fastest processor and huge amounts of memory to do that because you’re not really doing anything “serious”. I think Gmail is the first in what will be a long line of web applications that is going to raise the bar on what is considered the minimum hardware to use.
Following that trend, I think Gmail is leading the way for a true shift from desktop applications to web applications. While Google has been at this for some time with its various document services and data rentention, the fact that Gmail is going to force browser developers to improve their Javascript engines will lead to heavier web apps for many parties.
Much has been said about the shift from desktop to web, and I’ve probably just parroted a lot of it here, but the new Gmail interface seems like a real trailmarker on the path forward. When they make a documentary on Web 4.0 that goes to independent film festivals, I guarantee there will be an unknown engineer who says that Gmail started it all.
DC PHP Conference
The 2007 DC PHP Conference is right around the corner, and they have posted the Keynotes and Plenary Sessions today. There are a number of great speakers, running the gamut from performance to application design to interfaces to coding style. The sessions that seem particularly interesting to me are API design in PHP by David Sklar of Ning, Beyond SQL and ORM by Mike Ho of the Qcodo framework and Drinking from the firehose: building scalable SOA websites with PHP by Glenn Campbell of Yahoo.
It’s great to see PHP being used in enterprise areas, when not long ago it wasn’t taken too seriously by “real” programmers. As the computing world becomes ever more interconnected, the development speed and dynamic typing of PHP gets more and more valuable every day. I won’t be surprised if a slew of PHP books on these topics start to complement the nuts & bolts type books available today.
If you haven’t yet registered, you can get a discounted pass as a guest of the DC PHP Developers Group for $250; quite a deal for all the learning and networking to be had.
Tricking Wordpress
Sometimes I’m a big fan of Wordpress, sometimes I want to print out all the code and then tear that paper to shreds. Today, I realized that I enjoy it when I’m creating a theme for Wordpress, and I despise it when I have to use it. In particular, when I have to do any sort of content formatting for a page or a post.
Wordpress 2+ comes with TinyMCE packaged as a WYSIWYG editor for creating content in your blog. TinyMCE is a very impressive javascript-based rich text editor, which can be customized to a high degree. The Wordpress folks made the decision to keep tinyMCE pretty simple with the default Wordpress install. I think that’s a good idea: keep it simple stupid. As a sort of compensation, they also allow you direct editing of the HTML code generated by tinyMCE, in case you’d like to do any formatting more advanced that bolding text. This seems like an ideal setup, except for one unbelievable snafu: Wordpress modifies the code you write in the code editor.
Quite frankly, this is inexcusable, and has forced me to change my stance from a Wordpress advocate (for it’s ease of install, well put together interface, and glut of plugins) to a Wordpress skeptic. I have to fight the software to do what I want. If I’m supposed to be able to write code, let me write it. There is no faster way to frustrate a user than to arbitrarily modify input.
ZF overview from Nick Halstead
Nick Halstead and the developers at Assembleron recently launched a new service Fav.or.it, which is an RSS reader, and allows you to comment on the posts you’re reading. Pretty smart! Tangentially, there has been something of a comment backlash from a few of the software world’s most outspoken voices this year, so I find the new offering doubly intriguing.
Fav.or.it has been developed from the ground up on the Zend Framework, so Nick has graciously provided an overview of the framework and some of the components that he used. Of particular interest to me was his view that ZF is not for beginners:
“I will at this point make lots of enemies by saying that the Framework is a professional product and is not really for the beginner. Although it has made strides towards simplifying some aspects of the MVC (and other modules) it is still certainly more complex than others and if you have no inclination to do anything âout of the ordinaryâ then my advice is to use something else.”
I had been considering the various PHP frameworks on the criteria of convention vs. configuration, with convention being the philosophy that certain aspects of all applications are the same, so these similarities can be relied upon in framework code, whereas configuration is a philosophy that the developer is responsible for telling the framework exactly what and how logic should be executed. Convention leans towards speed, while configuration leans towards power.
ZF leverages a number of design patterns, and provides several approaches to a number of common problems, so I agree that it does take a more experienced hand to design an application with ZF. However, I also think that ZF is a great environment for practical learning about design patterns, as well as coding best practices. I hope that people who are new to PHP and/or web development find out about the framework, and sufficient learning resources are targeted at them. While ZF might not be the right choice to for your first “Hello World” code, trying to build more sophisticated tools with it will bring you up to speed with better practices very quickly.
CSS Framework Roundup
A great design and web front-end weblog, Smashing Magazine, has put together an excellent article on CSS frameworks. Building a great web front end takes a lot of elements coming together successfully, such as having a good understanding of your user’s needs, building an effective information architecture around that understanding and creating an engaging and intuitive visual design.
However, these planning aspects are some of the least time consuming of the entire build process. The nuts and bolts of front end design can be extremely tedious to put together due to inconsistencies between the various browser rendering engines out there. In fact, there are enormous sites dedicated to the technical aspects of cross browser design and compatibility. CSS frameworks offer the same advantage that back-end frameworks offer: detail management. The widespread adoption of these tools and techniques is another step in the evolution of the web development profession.
Zend Framework speed
Richard Thomas put together a performance comparison of basic PHP, the Zend Framework, the Solar framework and Richard’s custom framework, and the results surprised me. ZF is slow as molasses. Of course, any framework is going to incur overhead compared to all custom code because the framework is managing a number of tasks transparently from a developer standpoint. However, a performance discrepancy of 48x is more than I had imagined. Two caveats:
- The code being compared was a simple “Hello World” app. I’d imagine the difference between PHP and ZF would decrease as the complexity of the application increased. However, I don’t have any tests to back me up on this.
- Once ZF was run with APC enabled, the number of requests per second quadrupled. Good to hear there’s an immediate fix, but it wasn’t immediately clear to me if APC functions were built into the code, or if it was enabled at a software layer below.
This stresses to me the importance of some caching mechanism for ZF applications. There were also some interesting comments on the post about creating development and production forks of the Framework, as development stresses simple APIs and prototyping speed, whereas in production, performance is paramount. I think this is an excellent idea, and could likely be developed as a deployment tool, along the lines of a compiler, rather than within the code itself. Zend & IBM: sounds like a good project, eh?
In semi-related news, Joel Spolsky has some thoughts about features vs. performance. He has some inflammatory words for Google, which is weird because they are developing the exact type of technologies that he praises in the article, like Google Gears and Google Web Toolkit. Oh well, I guess you don’t get attention for writing well considered, even handed pieces. Zing!
Organic software
Jason Fried of 37Signals wrote up a thoughtful piece on the similarities between software development and plant development. I found it to be a pleasant, relaxing, and grounding read.
Date validation in Zend Framework
The Zend Framework has a powerful set of validation features, ranging from predefined data type checking (like email addresses and DNS hostnames) to classes for chaining together validations and input filters to create custom validation stacks. Since Rule #1 of web application security is Don’t trust ANYTHING that comes from the browser, I use the validation tool set a lot. One task that I often comes across is date validation: checking if the specified date is in the correct format, if it falls in a valid range of dates or if the date is even a date at all. Many applications try to simplify date validation by providing a separate select box for month, date and year.

I think that providing a standard text box and making the expected date format clear is a more usable solution. Providing a Javascript/CSS date picker is another nicety. I don’t have any metrics comparing text input to select box input, so I’d be happy to learn of such a comparison. Regardless, the user input must be validated rigorously at the server side anyway, as it’s quite easy to forge form input.
The Zend_Validate_Date class that comes with the Zend Framework is lacking in the functionality I listed above. It doesn’t allow a developer to specify the desired input format, instead only allowing dates in YYYY-MM-DD format, and it doesn’t provide a way to determine if a date is within a given range. I needed such features for a project I was working on, and I was lucky enough to find a Zend_Validate_Date replacement class by Ralf Eggert that allowed custom date formats.
However, it used an unfamiliar syntax for specifying the date format, didn’t support textual months, and it didn’t provide for date ranges either, so I decided I’d have to build out Ralf’s class. If you have similar needs, feel free to use and distribute it. It’s very similar to the stock Zend_Validate_Date, except with a few optional parameters available to the constructor.
Download it: Zend_Validate_Date
new Zend_Validate_Date([string $format] [,string $startDate] [,string $endDate]);
$format is specified with PHP’s standard date format codes. Allowable codes are d, j, F, m, M, n, y and Y.
$startDate is a date delimiting the beginning of a valid date range. Any date before $startDate will be invalid.
$endDate is a date delimiting the end of a valid date range. Any date after $endDate will be invalid.
Notes: the class provides the constant TODAY to use the current date for either $startDate or $endDate parameters. Also, due to limitations in PHP’s date handling prior to PHP 5.2, this class will not handle date ranges prior to 1970 in the expected fashion. If you need to validate dates are in a date window prior to 1970, look into PHP’s dateTime object.
Instantiating the validator with default m/d/Y date format
$v = new Zend_Validate_Date();
Instantiating the validator with a custom date format
$v = new Zend_Validate_Date('d-F-Y');
Instantiating the validator with a custom date format and a start date
$v = new Zend_Validate_Date('d-F-Y', '06-September-2007');
Instantiating the validator with a custom date format and an end date
$v = new Zend_Validate_Date('d-F-Y', null, '06-September-2007');
Instantiating the validator with a custom date format and a start date of whatever day it is
$v = new Zend_Validate_Date('d-F-Y', Zend_Validate_Date::TODAY);
Instantiating the validator with a custom date format and a start date and end date
$v = new Zend_Validate_Date('M-d-Y', 'Sep-01-2007', 'Sep-30-2007');
Download it: Zend_Validate_Date
Form design tips
As I discussed in my post on del.icio.us last week, sometimes the rush to create an innovative new tool or technique results in some of the fundamentals of good usability design being glossed over. Tried and true methods aren’t sexy… unless they have eye-tracking images! Luke Wroblewski has put together a very informative column on the placement of form submission buttons. If that sounds like an extremely boring topic to you, you’re probably right. However, if you’ve ever clicked on a “Reset” button accidentally, then you can appreciate that there are people thinking abut such issues. The included quantitative and qualitative data are frosting on the cake.
After browsing through his site a bit, I was also fortunate enough to stumble onto a PDF presentation summing up a number of form design best practices. It’s 112 slides, 3.9 MB and not particularly verbose, but if you learn visually, it’s a great package.
Categories
- App Design (8)
- Blogs (6)
- Business (4)
- Code Philosophy (2)
- Javascript (1)
- Open Source (5)
- PHP (15)
- Thoughts (2)
- Tools (10)
- Usability (3)
- Wordpress (2)
- Zend Framework (9)
