Taking my last post to the next level
Category domino
This is a perfect example of what I enjoy about blogging. My next post was going to describe how you'd go about taking the approach I outlined in my last post to the next level, but Chad already did exactly that. Actually, he took it even further than I was going to by porting the whole thing to Java as well. This happens all the time: somebody comes up with something they think might be useful, tells the world about it, and the next day (or sometimes within minutes), somebody else shows how it can be made even more useful. And what I think is so cool about this is that, even if this is done more for competitive reasons than collaborative - 'cause let's face it, occasionally one of our fellow bloggers is just showing off - everybody still benefits. Whether the contribution is made purely out of a desire to further the pursuit of increasingly elegant code, or out of an author's desire to stroke their own ego, the result is still a contribution. It's the scientific process at work in the world of software, and I think that rocks.
In my previous post, the initialization of class members was postponed until any member of the class was accessed, at which point all members would be initialized. But a better approach - the one Chad describes - is to initialize each member separately as it is needed by defining a dependency hierarchy. For example, if a handle on the current database is requested, the current session must be initialized as well. But if only the session is needed, there's no need to initialize the database, document, etc. This keeps the memory usage as lean as possible, while still making commonly needed objects accessible with leaner code. Good stuff. He also created a handy NotesDocumentExtended class... check it out.
This is a perfect example of what I enjoy about blogging. My next post was going to describe how you'd go about taking the approach I outlined in my last post to the next level, but Chad already did exactly that. Actually, he took it even further than I was going to by porting the whole thing to Java as well. This happens all the time: somebody comes up with something they think might be useful, tells the world about it, and the next day (or sometimes within minutes), somebody else shows how it can be made even more useful. And what I think is so cool about this is that, even if this is done more for competitive reasons than collaborative - 'cause let's face it, occasionally one of our fellow bloggers is just showing off - everybody still benefits. Whether the contribution is made purely out of a desire to further the pursuit of increasingly elegant code, or out of an author's desire to stroke their own ego, the result is still a contribution. It's the scientific process at work in the world of software, and I think that rocks.
In my previous post, the initialization of class members was postponed until any member of the class was accessed, at which point all members would be initialized. But a better approach - the one Chad describes - is to initialize each member separately as it is needed by defining a dependency hierarchy. For example, if a handle on the current database is requested, the current session must be initialized as well. But if only the session is needed, there's no need to initialize the database, document, etc. This keeps the memory usage as lean as possible, while still making commonly needed objects accessible with leaner code. Good stuff. He also created a handy NotesDocumentExtended class... check it out.

Comments
Posted by Julian Robichaux At 11:08:43 PM On 01/17/2006 | - Website - |
Posted by Tim Tripcony At 01:08:13 AM On 01/18/2006 | - Website - |