Coffeehouse Thread

21 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Useful resources #347: Database models

Back to Forum: Coffeehouse
  • User profile image
    W3bbo

    Scott Guthrie recently posted this website on his blog. Looks *Very* useful to me.

  • User profile image
    Minh

    Can you say over-engineering?


  • User profile image
    blowdart

    Minh wrote:
    Can you say over-engineering?



    Strange, if they were going to normalise sex to that level why leave it half done? You would have normalised names, date entered the UK, date of birth and phones into their own tables as well.

  • User profile image
    Ang3lFir3

    blowdart wrote:
    
    Minh wrote: Can you say over-engineering?



    Strange, if they were going to normalise sex to that level why leave it half done? You would have normalised names, date entered the UK, date of birth and phones into their own tables as well.


    Not if you were intending on being able to populate drop down lists or similar controls with the only possible values...without having to query the whole Individuals table....

  • User profile image
    Rotem Kirshenbaum

    Why would you want to populate a list of genders from a DB ?
    That's too much overhead for a 2-value list that's never going to change. You can hard-code "Male" and "Female" (or get it from a localized storage).

    Rotem

  • User profile image
    W3bbo

    Rotem Kirshenbaum wrote:
    

    Why would you want to populate a list of genders from a DB ?
    That's too much overhead for a 2-value list that's never going to change. You can hard-code "Male" and "Female" (or get it from a localized storage).

    Rotem


    ...what if you were developing a booking/reservations system for a sex-change clinic?

  • User profile image
    blowdart

    Rotem Kirshenbaum wrote:
    

    Why would you want to populate a list of genders from a DB ?
    That's too much overhead for a 2-value list that's never going to change. You can hard-code "Male" and "Female" (or get it from a localized storage).

    Rotem



    Because normlisation is a religous argument.

  • User profile image
    blowdart

    Ang3lFir3 wrote:
    
    Not if you were intending on being able to populate drop down lists or similar controls with the only possible values...without having to query the whole Individuals table....


    I could see that, if it wasn't at most a 3 row table, where the overhead of hitting the database would be a little obscene!

  • User profile image
    UlsterFry

    That's stupid, a seperate table for gender, and as for populating form fields, ever heard of enums?

  • User profile image
    blowdart

    UlsterFry wrote:
    That's stupid, a seperate table for gender, and as for populating form fields, ever heard of enums?


    Stupid is a little harsh. And what if, for example, I had a list of countries, you can hardly enum that ...


  • User profile image
    UlsterFry

    blowdart wrote:
    
    UlsterFry wrote:That's stupid, a seperate table for gender, and as for populating form fields, ever heard of enums?


    Stupid is a little harsh. And what if, for example, I had a list of countries, you can hardly enum that ...




    Well  I think it's stupid..  ..at most you will have 3 gender states (male,female,not given)

    Countries are a different matter because there are more of them and they can change name (or split/merge) ...take Czechoslovakia for example, or the balkan region.

    Of course perhaps in the future we might have a feminist uprising and they decide to drop the 'male' from female to create 'male', 'fe' and 'not given' states,  until then I'll save the database hits and stick with enums.

  • User profile image
    Ang3lFir3

    while there are many better ways to handle the particular example shown...... I was mearly pointing out the reasoning behind the original DB authors decision to normalize the field. For something like this I would most likely call it over engineering(though not by any means stupid)...... however say with a list of countries or states or sizes or almost anything that usually has more than 3 values I would usually in some way normalize the table.

    But that's just me.

  • User profile image
    UlsterFry

    Ang3lFir3 wrote:
    while there are many better ways to handle the particular example shown...... I was mearly pointing out the reasoning behind the original DB authors decision to normalize the field. For something like this I would most likely call it over engineering(though not by any means stupid)...... however say with a list of countries or states or sizes or almost anything that usually has more than 3 values I would usually in some way normalize the table.

    But that's just me.


    Over engineering is the word for it, the problem I have with this is that it sets a bad example, it's classic follow the theory text book stuff, when really, examples of best-practices should be incouraged.

  • User profile image
    blowdart

    Mind you I'm spending the day trying to work out how to restore an Oracle export. This is not making me happy Smiley


  • User profile image
    jsampsonPC

    I don't see a Bug Database!
    Other than that, cool website - I'm glad you found this Smiley

  • User profile image
    blowdart

    OK here's a thought

    You have tables to store user information, and groups that users belong to.  Each table has an identity field in them. Would you name it user_id or simply id?

  • User profile image
    W3bbo

    blowdart wrote:
    OK here's a thought

    You have tables to store user information, and groups that users belong to.  Each table has an identity field in them. Would you name it user_id or simply id?



    Before I named identity columns simply "ID", but now I'd call them "UserID" or "ProductID", it makes it easier to work with joins.

  • User profile image
    jsampsonPC

    blowdart wrote:
    OK here's a thought

    You have tables to store user information, and groups that users belong to.  Each table has an identity field in them. Would you name it user_id or simply id?


    UserID and GroupID Smiley

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.