Archive for November, 2008
(This is the second part of a little case study on usability. Read “Deconstructing Joomla 1.6 SEF Settings” first.)
Here’s the table from part 1 again:
| Option |
Tooltip message | |
|---|---|---|
| 1. | Search Engine Friendly URLs | Select whether or not the URLs are optimised for Search Engines |
| 2. | Add suffix to URLs | If yes, the system will add a suffix to the URL based on the document type |
| 3. | Use Apache mod_rewrite | Select to use the Apache Rewrite Module to catch URLs that meet specific conditions and rewrite them as directed |
| Warning: Apache users only! Rename htaccess.txt to .htaccess before activating. |
Let’s try to come up with some ways to make it easier to understand.
A user expects Joomla to output a ‘good’ site, and a good site has SEF URL’s. The historical reasons to have a configuration option for this, are no longer relevant in 1.6. My suggestion: turn SEF on in all installations and remove the option.
This feature adds .html, .feed, .pdf… It looks a lot better than adding ?format=pdf. It fits in nicely with the idea that a website has a /my/folder/myfile.html structure, which is a concept everyone gets. So again: let’s turn it on permanently and remove the option.
This is the most difficult one, and not entirely solvable. For starters, we could rename the option to “Remove ‘index.php’ from URLs“. This makes a direct mental connection between the setting and the intended effect. The users can see index.php in their URL’s, they click the button, and index.php is gone.
Back to our question from part 1: “Can the system decide this without user interaction?” Joomla could:
If all checks succeed, Joomla removes the index.php.
Alternatively, Joomla could rename the htaccess.txt file automatically. As an extra failsafe, it could do a HTTP request against the frontend, and revert the changes if a 500 error is returned.
In a third approach, the .htaccess file could wrap the rewrite codes inside <IfModule mod_rewrite> … </IfModule>.This automatic handling of htaccess might be a bit too risky, because depending on apache config, it can crash your frontend. Further testing and brainstorming is required.
By keeping an open mind and coming up with creative ways, I’m sure it’s possible to remove half the options in Joomla, in the configuration as well as all core and 3PD extensions. Joomla can be smarter than the humans using it, by analyzing it’s environment and making informed decisions. We need to step down from the idea that having more buttons means that the software is better.
So what do you think? Which options or buttons would you drop from J!1.6?
Most people don’t read manuals. All we can do is make sure our applications are easy and intuitive for everybody. Joomla does pretty well in that area, hence it’s success, but the work is never done. And many third party developers seem to confuse ‘options’ with ‘features’, and ‘configurability’ with ‘power’.
When working on Nooku, we constantly ask ourselves: “Do we really want the user to make a decision here? Can the system decide this without user interaction?” For each configuration option, users will need to understand
To illustrate the process of making an application easier, let’s do a small case study of the SEF feature that is in J!1.5. There are three Yes/No options in the Global Configuration:
| Option |
Tooltip message | |
|---|---|---|
| 1. | Search Engine Friendly URLs | Select whether or not the URLs are optimised for Search Engines |
| 2. | Add suffix to URLs | If yes, the system will add a suffix to the URL based on the document type |
| 3. | Use Apache mod_rewrite | Select to use the Apache Rewrite Module to catch URLs that meet specific conditions and rewrite them as directed |
| Warning: Apache users only! Rename htaccess.txt to .htaccess before activating. |
Even though a user knows what a search engine is, that doesn’t mean he knows what search engine optimization is. The user might interpret it as “Optimizing the search box in my Joomla site”. Let’s look at the options again. Concepts that all users can be expected to understand are green, technical terms are red, and orange is in between.
| Option |
Tooltip message | |
|---|---|---|
| 1. | Search Engine Friendly URLs | Select whether or not the URLs are optimised for Search Engines |
| 2. | Add suffix to URLs | If yes, the system will add a suffix to the URL based on the document type |
| 3. | Use Apache mod_rewrite | Select to use the Apache Rewrite Module to catch URLs that meet specific conditions and rewrite them as directed |
| Warning: Apache users only! Rename htaccess.txt to .htaccess before activating. |
For a newbie, each red block is a question that needs to be answered before he can make a decision. “What is Apache?”, “What is a document type?”,… And even a professional CMS integrator, who’s testing different solutions and quickly wants to assess if Joomla fits his purposes, will want to answer as little questions as possible.
In part 2 we have a look at how we can make this easier. And for everybody who’s in web design or development, read “Don’t make me think” by Steve Krug.
(Last week I posted a little challenge for PHP developers. You might want to give it a try for yourself before reading the solution below.)
I received about 15 e-mails. Most of them were a variation of the same theme: get the id’s from the database, and update each row — which usually meant having the update query inside a foreach loop. To limit the number of queries,some people worked out a way to only update the rows that actually needed updating. One person used a stored procedure in MySql, which was then called from the function.
These people sent in the best solution (ordered!):
They win eternal Joomla glory, and a spot in Open Source Heaven (which is just as good as regular heaven, but there’s no entrance fee and you get to make your own changes!)
My solution only requires a single query:
SET @order = 0; UPDATE jos_products SET ordering = (@order := @order + 1) ORDER BY ordering ASC;
Setting the variable in the first line obviously doesn’t count as a query. The intent should be very clear: the rows are ordered, and each row get’s a new value. The winners had some small variations, but the way it’s written above is the one that’s most readable. To see the solution as a Joomla method, download the attached zip. Of course, if you have a better solution, let’s us know.
The reason for this little challenge, was to get an idea of what MySQL features people actually know how to use. Joomla 1.5, nor most of the code from 3PD extensions I’ve seen, make full use of MySQL. That’s a pity, because there is plenty of opportunity there to make your code faster, and more stable. There are of course the historical reasons: Joomla 1.5 still has to run on MySQL 4. But I believe many people regard MySQL as PHP’s little brother: you drag it along because you have to, but you don’t really know it all that well.
Past October I was invited by DOP, one of our Nooku partners for a friendly ‘Clash of the Titans’, aka Drupal vs Joomla. The Drupal project was represented by Bert Boerland, Drupal evangelist and a personal friend.
Mathias already wrote about this little get together a few weeks ago. One of the things that came up during my talk was the presentation that I gave about Joomla at the second DrupalCon in Amsterdam in 2005. A historical event, it was in Amsterdam that Dries gave his first State of Drupal talk… I promised Bert I would try to dig up the slides of my presentation. Took me a while but here they are …
This is probably the first public presentation that was given about Joomla, only a mere 2 months after it’s birth. Looking back at this 3 years later, all I can say is that things have changed quite a lot. Some goals mentioned where met, others are still being worked on, others will never happen. I will try to look back some of the things mentioned in this presentation in a next post. Stay tuned.

If you just can’t get enough of us here, we’ve also been broadcasting out into the Twittersphere with our Joomlatools account.
If you’re not in the know, Twitter is a microblogging service that makes it easy to keep up with your favorite people (hopefully us) on multiple networks and devices. We will be twitting about interesting stuff we are reading on the web and writing on our blog and offcourse keep you updated on what is happening in the Joomlatools HQ. Feel free to @ us with shoutouts and questions!
Who’s up for a little challenge? Everyone is invited to join in, even if you’re a beginning php developer. We’re going to tackle a simple problem. The winner gets eternal Joomla stardom!
Imagine a simple e-commerce system. The shop owner can manage products, and show them on the front page. The owner wants to able to give some products more prominence, by ordering the list. After a while, because of all the products being added, removed and reordered, the database table becomes messy.
This is the table:
CREATE TABLE `jos_products` ( `id` SERIAL, `name` VARCHAR( 100 ) NOT NULL , `ordering` INT NOT NULL );
The table might look a little like this:
+----+------------+----------+ | id | name | ordering | +----+------------+----------+ | 6 | Chocolate | 25 | | 8 | Beer | 2 | | 19 | Cookies | 19 | | 21 | Lemonade | 8 | +----+------------+----------+
We want the ‘ordering’ column to be sequential, like this:
+----+------------+----------+ | id | name | ordering | +----+------------+----------+ | 6 | Chocolate | 4 | | 8 | Beer | 1 | | 19 | Cookies | 3 | | 21 | Lemonade | 2 | +----+------------+----------+
Your job is to write a bit of code to clean up the mess.
To win, your code should be short, elegant, and performant, with as little queries as possible. Obviously, your code should use the Joomla framework. PHP 5.2 and MySQL 5 are assumed. All we need is the actual code to fix the table, not the complete component. So your submission should look like this:
function cleanup_ordering() {
$db = JFactory::getDBO();
/* your code here */
}
Please don’t go hunting the net for ready made solutions, that would kill the fun. The code should be your own work. Don’t post your submissions here, but mail them to mathias {AT} joomlatools {DOT} eu.
I will post my own solution when the contest is over. This will serve as the proof:
echo md5(file_get_contents('solution.php'));
// Hash of my solution: d5dc5903a8d57ea28af5c618ec92418e