• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sub packages

 
Charles Sexton
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While coding it is better to use sub packages for large appications? An example is that right now I am coding a client-server app and the gui has four dialogs and two abstract table models, that is six classes. Would it be good idea to add two sub packages one for dialogs and another for table models?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34218
341
Eclipse IDE Java VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your example isn't a large application so either way is fine. For a larger application, you should absolutely split them up as you described. Or if you expect your application to grow. Or if you want to practice designing for larger applications.

In fact, you might even need more packages as the application grows. For example, suppose you had 100 table models. You might consider com.myapp.component.model at that point.
 
Charles Sexton
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:Your example isn't a large application so either way is fine. For a larger application, you should absolutely split them up as you described. Or if you expect your application to grow. Or if you want to practice designing for larger applications.

In fact, you might even need more packages as the application grows. For example, suppose you had 100 table models. You might consider com.myapp.component.model at that point.


Thank You, I will write code as if I was doing it for a large application and plus just like you said it allows for the application to grow in the future. I also think that it is much easier to navigate through classes as well.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic