in reply to [meditation] Structured, Typed Program Catalogs

Perhaps I am appearing to be overly anal. Overly paranoid. Overly structural. Overly typed.

Perhaps so. Perhaps you're being too specific in your solution.

On any sizeable project I've been involved with, we eventually "externalize" all significant strings into a set of repositories, where the repository can be a simple flat text file with (key,value) tuples. This process, which sometimes happens very early on in development, is part of "internationalization"(I18N) -- those steps you take to prepare for eventual "localization" (L10N) of the application for some target language. Once you have strings in repositories, you can switch in translated versions of the repositories to localize.

If you're careful where you put externalized strings, "types" (classifications) can be determined either by which section of a repository they're in (e.g., group all SQL queries together in one section, and error messages in another) or by which repostitory they're in (e.g., keep separate repositories for different types of strings).

While it's common to externalize end-user visible text, it's a little less common to externalize SQL. But if your application is well structured, SQL should be limited to a set of readily identifiable modules.

  • Comment on Re: [meditation] Structured, Typed Program Catalogs

Replies are listed 'Best First'.
Re: Re: [meditation] Structured, Typed Program Catalogs
by princepawn (Parson) on Nov 18, 2002 at 20:02 UTC
    While it's common to externalize end-user visible text, it's a little less common to externalize SQL. But if your application is well structured, SQL should be limited to a set of readily identifiable modules.
    But then how do you answer the type of questions I mentioned? Ie, what types of queries, what tables are they querying. Also, when you have > 1000 queries (and queries can be quite large), they take up memory space and should be externalized. I list all the motivations for SQL::Catalog in its docs. Kind of in a hurry now...

    Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality

      I like to keep it simple. Personally, for me I usually store all of my SQL in a seperate module for easy swapping.
      If I had a 1000 queries, I would probably use a tied BerkeleyDB hash instead to cut down on load time, etc.
      If I had to figure out what was doing what, I would probably write an SQL parser, (probably building off of SQL::Statement or similar) running it on all the queries in the module and verifying the unparsable ones by hand.

      -Lee

      "To be civilized is to deny one's nature."