File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Seperate classes or just one big class

 
Hector Tenedero
Ranch Hand
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello and good day!

I would just like to ask if I should seperate CRUD operations into several classes or just make a one big class that would hold all methods?

To those who'll be able to provide help, I also kindly request you to please specify some pros and cons on the suggestions that you've given.



Thanks!
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33713
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hector,
Welcome to JavaRanch!

There are three common approaches:
1) One class per table - handling all CRUD operations
2) One class per type - one for queries, one for inserts etc.
3) One class per operation - one for each CRUD operation on each table

None of these are inherently better or worse. #3 is great if using a framework that takes care of connection management though.
 
Hector Tenedero
Ranch Hand
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jeanne! It really does help to have a good DB Design below the JDBC code.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic