October 21, 2005
I was chatting with Michael Dinowitz tonight about one of my pet peeves. He suggested I post something on cf-talk. I thought I'd post it here first, just to start a discussion.
Memory is not persistent. That means application scope is not about persistence. Wikipedia defines persistence as:
...the characteristic of data that outlives the execution of the program that created it: which is achieved in practice by storing the data in non-volatile storage such as a file system or a relational database. Without this capability data structures only exist in memory, and will be lost when a program exits. Persistence allows, for example, a program to be restarted and reloaded with the data structures from a previous invocation of the program.
ColdFusion documentation and developers seem to have a history of misusing "persistence" to mean storing data in application or server scope (or even session scope). If ColdFusion developers want to be taken more seriously, we need to stop misusing terminology and start speaking the same language as the rest of IT...
Like I say, this is one of my pet peeves!
Comments
So by definition, the CLIENT scope provides persistence?
Posted By Carlos / Posted At
10/21/05 2:00 AM
Yes, actually client scope is persistent since it is either a cookie on the user's computer or a registry entry on the server or a database entry.
That doesn't make client scope a Good Thing(tm) tho'...
Posted By Sean Corfield / Posted At
10/21/05 2:29 AM
So what is the correct terminology to describe the session, application or server scopes in contrast with the request, variables, url or form scopes? the latter exist only for a single page request, but the former _____ for multiple page requests.
Posted By Ryan Guill / Posted At
10/21/05 8:43 AM
I think many developers -- especially those of us who grew up with CGI -- consider the execution of a request equivalent to the execution of a program. So if application scope variables outlive the execution of a request, they are "persistent."
Posted By Patrick McElhaney / Posted At
10/21/05 8:49 AM
The devil is in the details?
I'm with Patrick on this one.
The application and session scope are persistent between page requests. Data in there exists after the program (AKA page / request) stops executing.
Posted By Jeff / Posted At
10/21/05 9:05 AM
I think, historically speaking, that the session and application scopes are called "persistant" scopes is because they stick arround for longer than any one request. Thus, with the statless nature of HTTP, session and application scopes are clearly less volitile than, for instance, the request or variables scope. That would make them "more" presistant than some alternatives, but "less" persistant than the file system or database.
Clearly, even the databae and file systems are not exactly non volitile. I have had numerous hard drives die on me... and when that happens, well I suppose the data on there is pretty volitle.
Posted By Doug Hughes / Posted At
10/21/05 10:14 AM
So some are using 'persistence' in an absolute, 'boolean' sense (data either is or isn't persistent), while others are using the term in an comparative sense, (datum A is more persistent than datum B).
Surely though, if the Wikipedia definition is accepted, then Server, Application and Session scope clearly cannot be classed as persistent as they do not survive a re-start of the application (i.e. CF Server) that created them?
Doug, I don't think to qualify as 'non-volatile' a storage medium has to be immune to acts of god... (even when the acts of god you refer to are visited upon us rather more frequently than many other events covered by the expression) ;)
Posted By Roger Lancefield / Posted At
10/21/05 10:30 AM
I have a related pet peeve, when people call it "caching" when referring to singletons (which exist in memory across requests).
Posted By Dave Ross / Posted At
10/21/05 1:56 PM
I find it interesting that you're using Wikipedia as an authoratative refernece :). At any rate, here's another definition, from the Borland JBuilder Developer's Guide (http://www.informit.com/articles/article.asp?p=100598) "This object mapping requires that an entity bean be responsible for inserting, updating, selecting, and removing data within the data source. This process of managing the communication between the component and the data source is called persistence. In other words, persistence is this process of writing the information to an external data source. As you discovered in Chapter 21, "An Architectural Overview of Enterprise JavaBeans," we defined two types of entity beans. Using the first entity type, the container manages all the persistence itself. This entity type is called container managed persistence (CMP). The other type informs the container that you, the developer, are required to manage all the manipulation to your given data source. This type is called bean managed persistence (BMP)."
So in this definition persistance is a process, not a characteristic.
Posted By jim collins / Posted At
10/21/05 2:08 PM
From the same Wikipedia article:
"When first introduced, the idea was that persistence should be an intrinsic property of the data, in constrast with the traditional approach where data is read and written to disk using imperative verbs in a programming language. This emphasis has largely disappeared, resulting in the use of persist as a transitive verb: On completion, the program persists the data."
Posted By Patrick McElhaney / Posted At
10/21/05 2:42 PM
Jim, yes, persistence is a process - the acting of persisting something (data). Persistent data is stored in non-volatile things like databases.
The term for session, application and server scopes is most accurately "shared scopes". Shared between requests, users and applications (respectively). If you stop the server instance, you lose the data in those shared scopes therefore it is not persistent (pretty much by definition).
Posted By Sean Corfield / Posted At
10/21/05 2:46 PM
Okay, which is it: A process or a "characteristic of data"?
If persistence is a process, and client variables are peristent, does that mean client variables are a process?
Posted By Patrick McElhaney / Posted At
10/21/05 2:56 PM
Patrick, are you trying to be deliberately obtuse? :)
The persistence process involved in client variables is handled automatically inside ColdFusion.
It is a characteristic of data that data can be persistent. The process of actually persisting that data is called persistence.
Posted By Sean Corfield / Posted At
10/21/05 3:01 PM
"Patrick, are you trying to be deliberately obtuse? :)"
Um, no, not deliberately. You asked for a discussion. And it's Friday. Not a good combination. :)
Posted By Patrick McElhaney / Posted At
10/21/05 3:59 PM
The term to use for stored data in a memory scope should probably be "cached".
Posted By Michael Dinowitz / Posted At
10/22/05 9:45 PM
Persistance = data that "persists" in the event memory is flushed (aka restart, axe hits the server etc)
Cache = .. its so diluted these days its anyones guess (some argue db/file is legitimate for cache definition others say memory)..
Memorization = data stored in memory only (aka application/session/server)
Posted By Scott Barnes / Posted At
10/28/05 8:06 PM
Post Your Comments
Hosting provided by