Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I am designing a small system with only 4 packages, 2 of which have only one class in (one of which is the GUI package). I am not sure whether all these packages should each have an interface class and an implementation class to enable other packages to access them, or should the package just have a boundary class.

I am not sure of the difference between a boundary and interface class - do they both need an implementation class? If I use an interface class, shoud it be a singleton?

Many thanks in advance for any advice :)
Posted

1 solution

You're trying to compare horses to saddles. Interface class is more technical; it is equivalent to .NET or COM interfaces; in C++ it is implemented as a class without data with only pure-virtual functions. While compile-types can be interface classes, during run time they are represented by run-time implementation classes.

Boundary classes are called so by their role. They might be user interfaces, system interfaces or device interfaces (for example). See http://en.wikipedia.org/wiki/Class_diagram#Boundaries[^] for more information.

I would suggest you avoid questions "what is the difference", as correct single answer is impossible. Ask about each thing separately and their relationships.

I would also note that your question kind of lacks subject. You should better associate design matter with you project; so you need to share your ultimate project goals and refer to your own suggestions. In contrast to mathematics and pure computer science, the art of code design is no way a mathematically strict subject; design principles does not have their win theoretical value; considering design principles abstracted from their application if fruitless and often leads to artificial and useless schematic.

—SA
 
Share this answer
 
v2
Comments
Jackie Lloyd 22-Jun-11 6:23am    
Thanks for that - has made things a lot clearer. I shall try not feel so compelled to look to design theory for the 'right' answer and will do what I think is right given the problem. I think that takes a bit more confidence as there is no right or wrong :)
Sergey Alexandrovich Kryukov 22-Jun-11 10:56am    
Agree with you here.
Thanks for accepting this answer.
Good luck, call again.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900