Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

design strategy - objects or interfaces?

Status
Not open for further replies.

sharkhandler

Programmer
Feb 10, 2003
3
GB
Hi there,

We have just been given the task of rebuilding our web based ecommerce system from scratch using the .NET framework. One of our tasks has been the redesign of the various subsystems within the product. A major question is - what happens in the case of searching. A user could search on several things within our systems and we want to know the best way forward.

1. We have a Search object. This contains all the functionality required to handle searching, overloaded functions, maybe an inheritance hierarchy so that we can derive customer specific searching. This way a subsystem would simply create a new instance of the required object and invoke the specific function required.


eg:
Code:
		public class CustomerSpecificSearch extends GenericSearch

		
		public String SpecificSearchFunction (Param 1)

		public String specificSearchFunction(Param1, Param 2)

the advantage of this is that all the searching functionality is in one location, but it seem to me that you make quite a tight coupling between the calling object and the object that is created.



2. Each subsystem implements an interface I_Searchable. We have a search object that acts as a Manager object, in that it loads up the object to be and runs a search based on the provided interface. The advantage is that the search manager function can be relatively generic - it simply runs searches on the module loaded atrun time. The disadvantage is that should I_searchable change, we would have to make changes in multiple places (unless we sub the interface).


Personally, I'm tending towards a 50/ 50 mix of interfaces (for generic searching) and an inheritance hierarchy of the search manager (for client specific searching).

any ideas? as this design will be just as applicable to our reporting module.


Paul
 
An option is not to change the I_Searchable interface but to implement a new interface I_Searchable2 (for example).
The server then implements both of these interfaces, thereby catering for both the old and new clients.
The Big Viking
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top