Just what IS an Object, Anyway?
Making a distinction between the definition of an Object versus a Class is probably not a vital factor in one's OOP abilities. I believe, however, that if we're going to have and use terms, we should do so accurately in order to effectively communicate. I absolutely hate it when people misuse words in ignorance, such as when someone refers to a Cicada as a Locust (a locust is a grasshopper! a Cicada is a Cicada!), or a bat as a rodent (they're both mammals, but that's as close as it gets). For clarification's sake, then, following is what I have discovered to be the definition of an Object in a Coldfusion context.
When asked the question "what IS an object?", I nearly always respond with a description that includes the phrase "living and breathing". Here's why:
According to science, the basic checklist to use when determining if something is alive or not is:
Once you issue the command
Coldfusion takes what is a lifeless blueprint (the Frankenstein.cfc file) and breathes life into it, creating something that meets every one of these criteria!
In a nutshell then:
Object = living breathing instance of a CFC (Class)
Again, thinking of objects in this way may not make one a better or worse OO programmer, but it definitely doesn't hurt to have a finer understanding of what the terms truly represent, right?
If you missed the post "Just What IS a Class", it's the complement of this one and might make good prerequisite reading since it defines what an object IS NOT.
(this definition along with all the others I've collected over the past year can be found in my personal OO Lexicon)
When asked the question "what IS an object?", I nearly always respond with a description that includes the phrase "living and breathing". Here's why:
According to science, the basic checklist to use when determining if something is alive or not is:
- Can it Reproduce?
- Can it Obtain and use energy?
- Can it Grow, develop, and die?
- Can it Respond to the environment?
Once you issue the command
<CFSET objFrankenObject = CreateObject("component","model.Frankenstein") />
Coldfusion takes what is a lifeless blueprint (the Frankenstein.cfc file) and breathes life into it, creating something that meets every one of these criteria!
- Can this Creation reproduce? It certainly does have the potential, depending on how it was designed.
- Can it grow, develop, and die? Abso-frickin-lutely! It occupies a certain amount of ram, and I guarantee you that as soon as I call one of its setters and stuff a large structure into it that it will grow and then occupy MORE ram! If I <CFSET objFrankenObject = "", it'll be dead and gone.
- Can it respond to its environment? Of course; that is what it was created to do in the first place.
- Finally, can it use and obtain energy? Without spending too much effort in attempting to stretch the analogy into that realm...let's just say 'yes' since our server is plugged into an active outlet.
In a nutshell then:
Object = living breathing instance of a CFC (Class)
Again, thinking of objects in this way may not make one a better or worse OO programmer, but it definitely doesn't hurt to have a finer understanding of what the terms truly represent, right?
If you missed the post "Just What IS a Class", it's the complement of this one and might make good prerequisite reading since it defines what an object IS NOT.
(this definition along with all the others I've collected over the past year can be found in my personal OO Lexicon)
Subscription Options
You are not logged in, so your subscription status for this entry is unknown. You can login or register here.
No comments found.