This is a discussion on How well observer behave in a deep domain model within the Software Patterns forums, part of the Testing category; Hi, My server compose from server objects which some of them only required to derived from specific interface In general ...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
How well observer behave in a deep domain model
Hi, My server compose from server objects which some of them only required to derived from specific interface In general my server know how to process a Command object The following is a simple description of my server The Server HAS a MessagingService The MessagingService HAS a Channle a Channel HAS a Processor a Processor HAS a Persister each channel know how to execute a Command of a specific type in general a channel process the command using a Processor and persist it using a Persister The problem which I faced is the need to pass information (for example the connection string of the data base) from the Server(the higher object in the hierarchy) to the persisted(the lowest in the hierarchy) currently I am passing IApplicationContext derived to each layer so each layer can pass it over to sub component which is create I am reluctant to do so cause I am feeling that though this is an interface it make my system somewhat less flexible cause all object s MUST know something about the Server (that is derived from IApplicatioContext) maybe a better wasy is to define an ILayerContext which each layer pass it to sub components? another problem that I have is that every type of Channel require a different set of properties hence the IApplicatioContext contains a collection of properties which can be accessed by each component(the component know the name of properties it needs) the collection is not type safe it is just a hash table contains information from the data base maybe a better way is to add factory method to the IApplicatioContext which create a concrete class and set it properties?! doing so how would I notify to the component that his properties were changed? My main aim is to be able to espcially replace the channel at run time. Thanks in advance |