I have class object ServerUser. the serverUser be considered as shared part and it has two sub-class SSHUser and FTPUser. the SSHUser only provide support for SSH package and FtpUser for FTP package only. So should I place the sub-classes(ftpUser and sshUser) into the same package with serverUser or different package accoring to functions? any rules?
From my view, I think should place the sshUser and ftpUser to ssh module and ftp module due to the subclasses isn’t be shared, but it is really hard to navigate. place in one package is easier to navigate and keep code simplier? So which is better? any regular rules?
this quesion is similar with hwo to split packages for exception class and its’ subclasses when subclass not be shared ? all in one package or other styles?
It’s ultimately up to you – you have quite a lot of flexibility in terms of how you structure your code into packages.
Some options to consider:
server.sshpackage. In this way you treat theserver.sshalmost as if it was an independent module containing all SSH-specific functionality.There’s no significant technical reason to prefer one of the other, so it really depends on which you think will make your code base more manageable and easier to maintain.