   Structure of library
  I'm doing a little refactoring at the moment, because I don't like how my libraries are structured. There's no problem with their respective roles, the problem is mainly the point of access. At the moment each library is effectively encapsulated in a class, which is a Singleton (oh noes!). The thing is, I want to hide my members from everyone, whilst really only providing one point of access to them. And preferably one instance - you see, it is effectively a "mega-class" at the moment, albeit a very small one. That too can/should change.Does anybody have a suggestion?   
  library comprised set of singleton classeslibrary provides access 1 interface singleton?check out com aggregationKuphryn   ;  why are you imposing singletons on the user of the library?   ;Quote:Original post by phantomwhy are you imposing singletons on the user of the library?Quote:Original post by _goatThe thing is, I want to hide my members from everyone, whilst really only providing one point of access to them. And preferably one instance - you see, it is effectively a "mega-class" at the moment, albeit a very small one.;  Libraries that do not use singletons generally have to be "started" by using some type of "init" or "startup" static function which create a set hidden static/global data types that subsequent API calls use. They tend to require a static "shutdown" or "close" functions to cleanup the stuff they made during execution. Personnally I dont see this as being less "imposing" than using a singleton but you can do whatever you want.  Documentation is the most important "structure" of any library.  If you use a singleton explain why and how to use it.  Its your library, you have a much more intimate view of the code than any other programmer that uses the library, design the best way you see fit. Also, in general, singletons can easily be refactored to non-singleton classes.However, about 90% of the singletons I have seen are not thread safe.http://www.oaklib.org/docs/oak/singleton.html.   