Is it better to place connection method and arraylist object into one class or separate classes? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is it better to place connection method and arraylist object into one class or separate classes?

So i have a database of mysql with employee details. I need to create an arraylist of employees when my GUI application is running. Should i put connection method(read and write database), create arraylist object method and other methods into one class or 2 different classes? sorry question might be unclear, i myself not sure how to question it.

13th Jun 2018, 2:13 AM
Ferdinand Rosmi
Ferdinand Rosmi - avatar
14 Answers
+ 2
I prefer to separate this look at this tutorial https://dzone.com/articles/building-simple-data-access-layer-using-jdbc
13th Jun 2018, 12:33 PM
asa22
0
Please mind the difference between Java and JavaScript, not only that but you have not mentioned anything related to both languages.
13th Jun 2018, 4:07 AM
Eldar Bakerman
0
i dont think i write anything about javascript though?
13th Jun 2018, 4:22 AM
Ferdinand Rosmi
Ferdinand Rosmi - avatar
0
One of your tags is Java
13th Jun 2018, 12:37 PM
Eldar Bakerman
0
Also, programming as a tag is pretty stupid as this whole Q&A is about programming.
13th Jun 2018, 12:38 PM
Eldar Bakerman
0
well the question is about java of course the tag is java... of course its programming, this Q&A have questions about html. HTML is not a programming language
13th Jun 2018, 12:43 PM
Ferdinand Rosmi
Ferdinand Rosmi - avatar
0
SoloLearn is a programming place, putting such tag is useless.
13th Jun 2018, 12:43 PM
Eldar Bakerman
0
And it talks about SQL, I don't see any word about Java.
13th Jun 2018, 12:45 PM
Eldar Bakerman
0
the question is about classes design of database mysql and the programming language which is java in this case. classes design mostly used in ood programming language only. Not all programming languages are ood, so i specifically put java tag
13th Jun 2018, 12:50 PM
Ferdinand Rosmi
Ferdinand Rosmi - avatar
0
thanks for the reference asa22
13th Jun 2018, 12:56 PM
Ferdinand Rosmi
Ferdinand Rosmi - avatar
0
Do you mean OOP?
13th Jun 2018, 12:57 PM
Eldar Bakerman
0
oh yeah OOP
13th Jun 2018, 12:58 PM
Ferdinand Rosmi
Ferdinand Rosmi - avatar
0
I still suggest removing the programming tag
13th Jun 2018, 1:00 PM
Eldar Bakerman