Thanks for clearing that up for me Roberto.
Vasya Pupkin wrote:It will be stupid to have separate code for the database when you already coded it for multi-user environment.
Depending on how it was designed, there wouldn't need to be a separate implementation of the database class. The decorator design
pattern could be used for example. One class, the Database class would do all the general database stuff, then a 'decorator class', called ConcurrentDatabase, would implement the locking mechanism before calling the corresponding method on the Database class. eg:
Obviously this would require that there already be an instance of DatabaseImpl to give to ConcurrentDatabaseImpl, but this would allow you to swap in any locking implementation at runtime or locking could be disabled altogether at runtime.
I guess there isn't much between this method and using a façade to call locking procedures. Unless anyone can give me a good reason why this would be a bad design..?