A quick question about class design. I’m fairly new to Software Development and wondered how people structure their classes.
By that I mean, for example, if you have an interface and a number of small classes that inherit that interface, would you put group them all into a single source file or split them and have one class per file?
Thanks.
In general, it is a good practice to place such classes to one namespace, and distribution between different files depends on language. In Java you place them to one package (i.e. directory), but placing then into one file (as inner classes, for example) is a bad practice. In C# it is considered OK to put classes into one file if they are not too big and too complex. I guess C++ takes the same approach.
And, of course, don’t forget about semantics of classes. If your classes have different meanings, put them to different files.