0

I have coursework to do and I am still not sure about some planning parts of my project. So, let me explain, I’ve got a SQL file (a big database with dummy data) and my task is to setup and connect to the database and write Java code and satisfy a few requirements which will check if my connection with the database is valid. The database consists of tables such as customers, payments, orders, products, etc. My task is to do some calculations with those tables, also the focus is on coding, not on queries. Here is what I came up with: (let’s focus on the payment table and calculations) I have 5 classes: Main class, MySQLAccess class and one class for each table(payment, orders, customers).

Class diagram

Please have a look at the diagram above

My biggest concern is where and when should I populate my lists, in the test classes, or in the main class when the app is run, also do i need Main class or it could be control class.

Please feel free to submit any reasonable suggestion - class diagram changes

Shadow
  • 33,525
  • 10
  • 51
  • 64
  • 3
    Don't ask big airy hypotheticals here. And a rose by any other name would smell as sweet. Basically, do you want to write your program or obsess over the names you're going to give streets in the town your building? – Elliott Frisch Apr 22 '20 at 00:11
  • Hi, thanks for the comment. I wrote the code that I described above, but now I'm struggling because I dont know where to create the object MySQLAccess, should I populate the Lists in the main method or in each test class separately. I don't know what is the better practice. – curiousStudents Apr 22 '20 at 00:24
  • DRY principle says don't repeat yourself. But tests are not your main program. Why is my opinion more important than yours (or anyone elses)? If that is your question, you should edit your question to ask that. Because you didn't. – Elliott Frisch Apr 22 '20 at 00:35
  • Methods that return ResultSet look like trouble. See https://stackoverflow.com/q/25493837/217324 – Nathan Hughes Apr 22 '20 at 01:00

0 Answers0