CFUN-04 Homepage
Central Location of ColdFusion Conference and Seminars
Home
Topics
Schedule
Sessions
Speakers
Directions
Spread The Word
Register Exhibitor Information Survey News Faq's blog Share cfun-04 photos




Professional Web Tools



















More Sponsors:












Speakers
   Charlie Arehart
   Jo Belyea-Doerrman
   Tim Buntel
   Raymond Camden
   Christian Cantrell
   Sandra Clark
   Joey Coleman
   Sean Corfield
   Robert Diamond
   Michael Dinowitz
   Steve Drucker
   David Epler
   Joseph Flanigan
   April Fleming
   Ben Forta
   Shlomy Gantz
   Mark Gorkin
   John Hamman
   Hal Helms
   Simon Horwith
   Larry Hull
   Jeff Houser
   Chafic Kazoun
   Matt Liotta
   Tom Muck
   Rey Muradaz
   Nate Nelson
   Samuel Neff
   Jeff Peters
   Bogdan Ripa
   Neil Ross
   Margarita Rozenfeld
   Stephen Shapiro
   Michael Smith
   Geoff Snowman
   Jeff Tapper
   Dave Watts


LINK TO CFUN & CFUN WILL LINK TO YOU!


Ben Forta




LouLex CFUG
Colder Fusion - Twin Cities ColdFusion User Group
SacCFUG - Sacramento, California ColdFusion Users Group
MMUG-Dublin UserGroup Meeting
 
1  |  2  |  3  | 4  | 5  | 6  | 7  | 8  | 9 | 10  | 11  | 12  | 13  | 14  | 15  | 16  | 17  | 18  | 19  | 20  | 21  | 22  | 23  | 24  | 25  | 26  |  27  | 28  | 29  | 30  | 31  | 32  | 33  | 34  | 35  | 36  | 37  | 38  | 39  | 40  | 41  | 42  | 43  | 44  | 45

Back To Interview list

In Michael Smith's third interview with Hal Helms, they discuss Hal's talk on "Variables and Conditions" at the CF Bootcamp track at CFUN-04.

Michael Smith: Why should a new CF programmer care about variables?

Hal Helms: Variables allow our programs to adapt to changes, to conditions that the programmer cannot know about precisely. They do so by providing a layer of adaptable abstraction rather than a hard-coded value.

MS: Hmmm...what exactly does that mean?

HH: Let me give you an example. Ready for a hard-coded value? Here it is: 42.

MS: 42? That's it?

HH: Not much use, is it? It's because I've provided no context for that value. A variable, on the other hand, has both a context and a constraint. The context is, typically, the descriptive name. In this case, the variable name is "meaningOfLife."

MS: But you might also have said, "productOfSixTimesSeven."

HH: Right, or "sumOfTwentyAndTwentyTwo." Variables express context -- and once we know the context, the value has meaning. Without that context, it's just a value; it doesn't do us much good.

MS: OK, you also said variables have constraints?

HH: Yes. The most obvious constraint is the data type of the value of a variable. Here, the value of "meaningOfLife" is an integer. Constraints help to ensure that the value of a variable has relevance to its context.

MS: But ColdFusion doesn't make distinctions between integers and floating numbers -- or even strings.

HH: It's true that ColdFusion doesn't require explicit typing. Some languages -- Java, for example -- require that before you use a variable you define its data type. ColdFusion doesn't require this, but it doesn't mean that there are no data types in ColdFusion; it's just that CF hides this from you. Still, you do have to be explicit at times, right? When you create a structure, for example, you need to tell ColdFusion that you're working with a structure, using the StructNew() function. The point is, even though ColdFusion is weakly-typed (it doesn't require you to explicitly declare variable types, usually), it doesn't do away with data types. And understanding both data types and variable scopes is important.

MS: Your talk is geared for the novice programmer. I can see that they need to understand ColdFusion scopes, but do they really need to understand about data types?

HH: Absolutely. I see a lot of programmers -- even fairly experienced programmers -- shy away from using so-called "complex variables" such as arrays and structures. That's really unfortunate because, despite the "complex" tag, these data types can make our lives as programmers a lot simpler. In the talk, we'll look at these and see (a)why to use them and (b)how to use them.

MS: I think scopes confuse a lot of new ColdFusion programmers.

HH: Yes, that's true. Part of the reason is that there are quite a lot of scopes: session, application, caller, attributes, server, client...

MS: Is there a way to sort out scopes and know when to use which scopes?

HH: Yes, there is. During the talk, I'll present a "scope matrix" that explains how to think about scopes. It's also very useful as a tool for deciding which scope to use in which context.

MS: Well, it sounds like a lot of good material, and not just for novice programmers.

HH: It's really foundational material. So anyone who wants a solid foundation -- or at least the start of a solid foundation -- should benefit.

MS: See you at CFUN.

| Home | Topics | Speakers | Directions | Spread the Word | Register |
© Copyright TeraTech Inc 2003
405 East Gude Drive Ste 207 Rockville MD 20850
301.424.3903  Fax 301.762.8185  www.teratech.com
Please send comments/questions to michael@teratech.com
For sponsorships or registration, please send comments/questions to liz-cfun04 (at) teratech.com