Freelancers Network
 
skill list top cap
Homepage
Join the Freelancer's Network
Update your details
Find a freelancer
Post a project
Find a project
Projects Archive
Post a job
Find a job
Jobs Archive
See Dan's Pages
See Andy's Pages
Link to this site
Resources
Join/Leave Forum
Forum Messages
+Additions+ Adverts
Advertising
Contact Us
Subscribe to our newsletter - enter your email address and hit return
Freelancers.net is owned and operated by Andy Stowell and Dan Winchester
skill list end cap
guru web hostcom

Find me again on Freelancers.net

Re: FN-FORUM: What's the best development platform for creating Web 2.0 business applications?

date posted 22nd November 2007 10:34



Graham Stark wrote:
> On Wed, 2007-11-21 at 17:36 +0000, Dom Latter wrote:
>
>> On Wednesday 21 November 2007 16:57:10 Graham Stark wrote:
>>
>>
>>> A couple of Wikipedia articles show what I imagine Richard is trying to
>>> do:
>>>
>>>
>> Unless I'm missing something (quite possible) there's nothing wrong with
>> *adding* a unique auto-increment ID and timestamp to a record. It's
>> not going to break the "rules" and it may well help with debugging.
>>
>>
>
> I suppose it's a question of where you do things. If you have an
> auto-increment id field as the main (primary) key, you effectively have
> a logger: all incoming updates are accepted, and you sort out whether
> they're meaningful somewhere else, in application code or in some of the
> enormous SQL queries that get posted here from time time.
>
> The idea is, sort out what really makes a record unique (a username,
> perhaps, or a username and an order number) and use that. Let the
> database do the work for you.
>
It depends where you want to put the weight on your database- if you
want to work harder on insertion you might want an auto-increment ID
key, if you want it to work harder on select you may want to use
multiple field keys.

Given that for the type of databases I create for web stuff are likely
to be queried more than inserted to I tend to use auto-number ids for
primary keys. I can still sort out the referential integrity through
correctly created foreign keys and normalisation really has nothing to
do with it - a well normalised database will still often have regular id
fields.

I don't quite understand how leaving the logic in the database helps-
presumably if you try to insert bad data you get an error from the
database which you then have to handle in code? So why bother passing it
through code to the database in the first place, given that either
you're doing some processing on the way in?

It may be because I did a bunch of java stuff in my younger days but
I've always thought that the idea was to put your logic in the middle
tier rather than the database.

The view that Rails doesn't reflect a well normalised database model is
simply incorrect. It supports them fine, but it does expect auto-number
id fields, which is logical as most professional database designers
would use them anyway.

-ben



Messages by Day
November 30th 2007
November 29th 2007
November 28th 2007
November 27th 2007
November 26th 2007
November 25th 2007
November 24th 2007
November 23rd 2007
November 22nd 2007
November 21st 2007
November 20th 2007
November 19th 2007
November 18th 2007
November 17th 2007
November 16th 2007
November 15th 2007
November 14th 2007
November 13th 2007
November 12th 2007
November 11th 2007
November 10th 2007
November 9th 2007
November 8th 2007
November 7th 2007
November 6th 2007
November 5th 2007
November 4th 2007
November 3rd 2007
November 2nd 2007
November 1st 2007


Messages by Month
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007


Messages by Year
2008
2007
2006
2005
2004
2003
2002
2001
2000