Re: instanciate an interface - alternatives?

From: Adi Schwarz (adolf.schwarz.news.01-04_at_gmx.at)
Date: 01/30/04


Date: Fri, 30 Jan 2004 00:04:50 +0100

Ashton wrote:
>
>>I want to write a class that stores and manages certain objects. This
>>objects have to implement an interface called "SelfLoadable", that means
>>they can manage to load their information (from a file, database,
>>internet,...) themselves by providing a key that identifies the object
>>(e.g. primary key).
>
> Here's a theory that I've used in the past and like.
>
> Since a key identifies an object, a key should be able to recreate the
> object if it's not in cache.

Since I want to stay as general as possible (with the cached objects as
well as with the used keys) I do not really like that suggestion - but
it is a very interesting approach.

My solution if you are interested: I have to tell the ObjectCache
instance anyway wich type of Objects it will cache - so I call the
Constructor with

new ObjectCache(new someSpecialKindOfObjectImpelmentingSelfLoadable);

The ObjectCache stores this (blank = unloaded) object as some kind of
pattern, and if it has to create a new obj it just clones this pattern
and calls the load(key) function.

Sometimes it is really good just to take a break and have a meal ...

greets,
-as



Relevant Pages

  • Re: java code
    ... cache, which should be periodically updated from the database). ... stores the random numbers and gets updated in a daily batch cycle. ...
    (comp.lang.java.programmer)
  • Re: Need Advice on Linux vs. Windows for a Database-Driven Web Application
    ... We recently hired sales reps in several cities in the US ... > and Canada to maintain our displays in stores and to take orders from ... > in a database that we could access from the Head Office. ... No question - the Linux based one. ...
    (comp.programming)
  • Re: Max Exchage DB size in SBS
    ... private) rather than total. ... The stores grow as necessary to house their content, ... the database will grow by 100mb. ... becomes "slack" in the database. ...
    (microsoft.public.backoffice.smallbiz2000)
  • Re: Multi phase processing
    ... I writing a perl/mysql backend to a website, ... number of pages of input, then, at the end, stores all the info on the ... all of which is taken from some data tables on the database. ... approach completely and use a decent session module that lets you ...
    (comp.lang.perl.misc)
  • Re: opinions on store and mailbox limits
    ... database store being a btree database. ... enumeration of the mailbox items. ... By splitting the stores we have lessend the problems we now ... "Exchange Storage Guy" wrote in message ...
    (microsoft.public.exchange.admin)