www.ShoppingPodder.com

Leading Computer Shopping,
News and information


Part of the Identityscape.com network...

getxfactor.com jmoodmusic.com smartbusinesschoices.com mintdepot.com lowfaresalways.com evangelicalview.com shoppingpodder.com soproudlywehail.com webnews.ws currenthumor.com

 

 

Pattern best practices and speed of the software
   Shopping Podder - the Best of Computer Postings! Forum Index -> Computer - Object  
View previous topic :: View next topic  
Author Message
Lothar Behrens
Guest






PostPosted: Mon Nov 10, 2008 9:47 pm    Post subject: Pattern best practices and speed of the software Reply with quote

Hi,

I am developing a functionality to extract the meta model of a
database.

My current implementation - a first attempt - is too slow. Therefore I
search for a better way.

My solution:

Make the code extensible without modifying existing code: Visitor
pattern to separate the objects from it's operations.

Using generic container to avoid coubling of the meta object model
into my database classes.

Copying the container as a result from the database class into the
meta object model (in the visitor).

This allows me to map different representations of the same data (data
mapper pattern, not separated into it's own class, directly used in
the visitor).

But this is a bit slow I think, because I do copy each property in a
list of properties for a list of tables for sample.

The code is like this pseudo code:

The database function:

database::getTables(...)

SQLTables(...)

mylist = new list()

while hasRows()

property.add('tablename‘, tableBoundparam)
property.add('schemaname‘, schemaBoundparam)
property.add('typename‘, typeBoundparam)
....

mylist.add(property)

end while

return mylist

end

The visitor function:

visitor::visit(IDatabaseTableModel model)

// db is an instance of the database, passed before all the accept's

list mylist = db.getTables()

while (mylist.hasMoreElements())
parameter = mylist.getNextElement()

stringTableName = parameter.get('tablename‘)
stringTableSchema = parameter.get('schemaname‘)
stringTableType = parameter.get('typename‘)

...

model.addTable(stringTableName, stringTableSchema, stringTableType)

end while

end

To speed that up, I thougt to keep the internal structure of the
container the same as the internal
structure of the container inside of the model
(ImplDatabaseTableModel) and add a function to pass
a reference of the container given from getTables().

That would not be the best solution, because I can missuse it with
rubbish in the container - or
simply by doing it wrong.

Using a container and a IDatabaseTableEntry and a container keeps the
requirement of passing
the IDatabaseTableEntry objects element by element - still too slow.

But building a IDatabaseTableModel instance inside of database is too
much coubling. I get much
more speed, because I have only one loop to fill IDatabaseTableModel
and then pass around the
reference to it until it arrives the caller of
model.accept(theOpertation).

A first step would surely be a IDatabaseTableEntry solution.

How could I gain more speed but keep something 'designed well' ?

Thanks

Lothar
Back to top
Display posts from previous:   
   Shopping Podder - the Best of Computer Postings! Forum Index -> Computer - Object  
Page 1 of 1
All times are GMT

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum