tags:

views:

38

answers:

4

I've written a abstract base class TCPIP sever in its own namespace/library. Currently I have the derived class (more specific TCPIP server; with DataHandler) in the .exe project of the solution.

I'm almost 100% certain this is how I will go, but part of me wants to put the derived class in the base class project. What are some good reasons for/against this?

+1  A: 

"Why do I need the base class library"?

Usually because you want to use it in multiple projects.

If this is the case, do you need to use the derived class in other projects?

Mark H
I won't be able to re-use the derived class object, it will be too specific in implementaion. But part of me still wants to store it with the base class... I guess mostly so that its easier to find later and use as a (I know this is a poor choice of words ->) template. I think the cleaner and proper way is to put it in the .exe namespace... I was just wondering what others thought.
Jess
A: 

My reasoning in favor of this approach is that if I put the dervied class in the .exe namespace, I will have access to all those classes (e.g. data queue). However, if I put the derived class in base project, I'd have to grant access to all the classes in the .exe namespace in order to use just one of them (using DotExeNamespace;).

Jess
+1  A: 

If you plan on having other exe's use the your derived class its helpful if it there and not in the exe.

Conrad Frix
+2  A: 

I believe YAGNI, KISS and The Rule Of Three apply here. If you don't have immediate plans to try to reuse the derived class, then keep it in the application namespace. If you find later there is a second project/application that can use something like your derived class then keep to your plan and use it as a "template" to create another similar derived class by cut and paste.

If you find a third occasion to do this again, then you can take a look and see if there is a reasonably useful subclass sitting in there. Don't get distracted trying to spot reusable abstractions too early.

Arnold Spence