Yes, this is akin to magic numbers (which are bad). There is no way to tell that servertype 1 means "production" or even that it doesn't refer to something like web, file, or print server.

It would have even been better just to make the column a string type and just put "production" and such in there, I think in this case. In general I'd probably put it in another table and have it refer to that if it can change, but for a simple application, I probably wouldn't bother.

-Sam


Jim Cassata wrote, On 2/20/2007 12:13 PM:
while on the "subject" of best practice, I have a question re CFC practice.
In the days I made my app, I have a table (simplified) that lists IT servers. 
Looks kinda like this:

serverid | servername | servertype |
    1         |    win01      |        1        |
    3         |    win09      |        2        |
    2         |    win06      |        3        |

Now server type was just 1=production, 2=dev, 3=test.
And as such no servertype table was ever made, I just had the cfml convert the 
number to name in the cfm pages, like this:

Server Type: <cfswitch... </cfswitch>

Is this a bad practice? am wondering if this way of handling information is too much 
"putting business logic into presentation layer"  Might I find out in Flex that 
I can't display the server type text after retrieving a query result?


Thanks all, enjoying the dialog very much!

Jim C


----- Original Message ----
From: Marc <[EMAIL PROTECTED]>
To: [email protected]
Sent: Tuesday, February 20, 2007 10:55:26 AM
Subject: RE: [CFCDEV] CFC best practice (was ROI;)

I am smack in the middle of the Head First OOA&D book right now, reading it
rather closely (but not doing the exercises yet... Shame on me!).

I can say this book is definitely one to have, although I don't 100% agree
with their approach to discovering requirements. I'd say I actually agree to
only about 50% of their requirements gathering approach...  But it could be
that they took their particular route in order not to turn the book into a
Head First Project Management book of some sort. ;)
The actual process of working through what constitutes a class and when and
where you might consider creating new classes or not is actually presented
very well; it's definitely one that I welcome, right next to my Head First
Design Patterns, Head First HTML/CSS/XHTML, Head First Java, and Head First
JSP and Servlets! :)

Marc

    >   Behalf Of Peter Bell
    >   Sent: Tuesday, February 20, 2007 10:31 AM
    >   To: [email protected]
    >   Subject: Re: [CFCDEV] CFC best practice (was ROI;)
> > Head first design patterns much easier than GoF and > also includes basics from polymorphism on up. While I'd > assumed OOA&D book would be the basics, my experience > was that it was more intermediate, although I was in a > rush when I skimmed it and haven't had a chance to get > back to it yet for a proper read. It even says > somewhere that it is for people who can already do OO > programming and is moving you to next level to help > with analysis and design . . . > > Best Wishes,
    >   Peter



You are subscribed to cfcdev. To unsubscribe, please follow the instructions at 
http://www.cfczone.org/listserv.cfm

CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]






You are subscribed to cfcdev. To unsubscribe, please follow the instructions at 
http://www.cfczone.org/listserv.cfm

CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]






You are subscribed to cfcdev. To unsubscribe, please follow the instructions at 
http://www.cfczone.org/listserv.cfm

CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]

Reply via email to