Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • In SQL, the minimum likely use case is:

    SELECT id, name, alignment FROM characters;
    With a class, the minimum likely use case is:

    object = Class.new;
    I don't think anyone who uses other than the pluralization that I use deserves a painful death, but I also don't see that the number of tables and classes needs to be tied.
    --
    rjbs
    • In SQL, the minimum likely use case is:

      SELECT id, name, alignment FROM characters;

      And each row you get back is made up of those attributes of a 'character'. Sure you get multiple rows, but I don't get how that's different from defining a class in order to instantiate multiple objects.

      With a class, the minimum likely use case is:

      object = Class.new;

      A common case in Rails is:

      @character_list = Character.find(:all)

      Which ultimately generates SQL along the lines of:

      SELECT * FROM CHARACTERS

      And the application will then instantiate one Character object for each row retrieved from the table. In this case there is a clear and deliberate one-to-one mapping between an instance of the class and a row in the table and yet different rules are used for deriving a name for the container. That's the bit I don't get.

      And yeah - I'm not planning to burn anyone at the stake for plural table names. The point of my post was to question why people apply different rules to what appear to be analogous situations (at least to my eyes).