This has to be the worst example I've ever seen to back up any argument,
of any kind.
XML is a markup language. I would never consider storing data in a
markup language. Might as well just create PDFs of your data, or throw
them in word documents. Beyond the fact that using XML is not
appropriate, your example is logically flawed. If you were really to
make an XML representation of your table definition, it would be
something like:
<client>
<client_id type="integer" size="10" nullable="false"
key="primary"/>
<name type="varchar" size="40" nullable="false" key="none"/>
</client>
If you were to use the plural, then it would say <clients>. Then you
would have a separate xml file called clients.xml that contained the
individual client records with the data they contained:
<client>
<client_id>1</client_id>
<name>Best Client Evar!!!1</name>
</client>
<client>
<client_id>2</client_id>
<name>Not such a great client</name>
</client>
The table definition is a skeleton of the individual records, indicating
what data it is to store, what restrictions that data has, and how that
data relates to other tables. A table definition is not a collection of
records, it is a schema for an individual record. It's most closely akin
to a Class definition in object-oriented programming, if you feel the
need to compare not entirely related concepts.
I agree that your database should be extracted from your code. That's
what the Model layer of code is for, to translate between your internal
data structures and your storage engine. If you were so stupid as to
convert from a relational database to XML files, you'd have to replace
your Model layer with code appropriate to your new storage engine. The
same thing would be required if you changed database engines, unless all
of your queries were generic enough to work in any database, which would
mean that your system is in serious need of optimization. Despite their
best efforts to standardize SQL, every database engine has its own
extensions, and none of them support the full standard.
Greg
> -----Original Message-----
> From: plug-bounces at plug.org [mailto:plug-bounces at plug.org] On Behalf
Of
> Mark Hobson
> Sent: Tuesday, April 18, 2006 6:35 PM
> To: 'Provo Linux Users Group Mailing List'
> Subject: RE: Mysql Naming Convention
>> Just as a followup...
>> Technically, the database should be abstracted from the code. Now
that
> doesn't mean that the code can't be named based on the database, but
the
> database layer should be abstracted enough so that it can be replaced
with
> a
> different flavor of database or a different engine altogether...like
xml.
>> Taking that into account, if there was an xml file, would, say of
clients
> and notes, would you structure it like this:
>> <xml>
> <client>
> <client>
> <name>
> <note>
> <note>
> <content/>
> <note_id/>
> </note>
> <note>
> <content/>
> <note_id/>
> </note>
> </note>
> </client>
> <client>
> <name>
> <note>
> <note>
> <content/>
> <note_id/>
> </note>
> <note>
> <content/>
> <note_id/>
> </note>
> </note>
> </client>
> </client>
> </xml>
>> Definitely not!!, you would wrap the client nodes and the note nodes
> within
> <clients></clients> tags and <notes></notes> tags respectively. Thus,
a
> client has multiple notes, all of which are wrapped in a container
tag.
> Likewise, a clients table contains multiple clients, all of which are
> "wrapped" in a container table called clients.
>> Mark
>> -----Original Message-----
> From: plug-bounces at plug.org [mailto:plug-bounces at plug.org] On Behalf
Of
> Mark
> Hobson
> Sent: Tuesday, April 18, 2006 4:22 PM
> To: plug at plug.org> Subject: RE: Mysql Naming Convention
>> Plural is the right way. SQL was designed to be a natural language
(thus
> the select col from tablename where...)
>> Thus, a class represents a row in a table...a single row, whereas the
> table
> represents a collection of rows (plural). Therefore, the table name
is
> plural, the class name is singular.
>> If you are using a framework, it should have a small function to
convert
> from plural to singular. You'll have to anyway, since at some point,
> you'll
> need to have a plural word somewhere (i.e. "List of Clients" for the
title
> of a page, that queries the clients table).
>> MySQL even has built in functions that are plural:
>> Show databases
> Show tables
>> Mark
>> -----Original Message-----
> From: kirk [mailto:kirk at emstraffic.com]
> Sent: Tuesday, April 18, 2006 4:17 PM
> To: mark at emstraffic.com> Subject: Fw: Mysql Naming Convention
>>> ----- Original Message -----
> From: "Louis Zirkel" <lzirkel at cendev.com>
> To: "Provo Linux Users Group Mailing List" <plug at plug.org>
> Sent: Tuesday, April 18, 2006 4:12 PM
> Subject: Re: Mysql Naming Convention
>>> Gregory Hill wrote:
>> > But, there is no rule or standard in this regard.
>> Someone else said it as well but I personally think that since there
is
> no true standard that consistency is the most important thing. I
think
> the best thing would be to have a set of "engineering standards" for
> naming conventions, be it in source code or sql code, or anything
along
> those lines for that matter.
>> --
> Louis Zirkel / lzirkel at cendev.com> Developer/SysAdmin/DBA
>> /*
> PLUG: http://plug.org, #utah on irc.freenode.net
> Unsubscribe: http://plug.org/mailman/options/plug> Don't fear the penguin.
> */
>>> /*
> PLUG: http://plug.org, #utah on irc.freenode.net
> Unsubscribe: http://plug.org/mailman/options/plug> Don't fear the penguin.
> */
>>> /*
> PLUG: http://plug.org, #utah on irc.freenode.net
> Unsubscribe: http://plug.org/mailman/options/plug> Don't fear the penguin.
> */