Google Blogoscoped

Monday, December 10, 2007

Natural Language Programming?

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
            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
    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

    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


Blog  |  Forum     more >> Archive | Feed | Google's blogs | About


This site unofficially covers Google™ and more with some rights reserved. Join our forum!