Monday, December 10, 2007

Can you write it human readable?

I was literally amazed to see this. Although quite weired but what an idea!!

Function Show Books (search query)

If the database connection as specified in global
settings isn't open, open it.
Grab all book records which contain the search
query anywhere.
Note to escape the search query above.

If some records are found, do this:

For each record in the records, do this:
Display the record content in an HTML
table row.
If the length of the record content above
is over 30 characters, remove subsequent
characters.
Note to escape HTML entities above.

Wrap the above in an HTML table.

otherwise, do this:

Display a "sorry" message taken from the site
messages file.
Use local language setting for that message.
Wrap message above in an HTML paragraph of
the "sorry" class.

Close the database connection.

For this whole function, use a medium priority,
and spread it across different servers for extra
speed.
If the function takes more than 0.5 seconds to
finish, email the site administrator as defined in
the global settings with details about what
happened.

For this whole function, if the search query is
empty, display the "empty search query" message
from the site messages file. Use local language
settings for that message.

For this whole function, display important
ambiguities before compiling.

End of Function


[via Blogoscoped]

0 Comments:

Post a Comment

<< Home

Free Web Counter