My application needs to connect to a postgres database in AWS. I am able to make the connection and query the database, but I am not sure how to best design/organize my classes, so they are flexible for future changes and best for testing purposes.
Currently, I have a class called Database.class with methods for creating a database connection and querying the database. However, I am debating whether I should create a new package called database and split this class into multiple classes:
(1) Postgres.class - create the datasource and connection object (2) Table1.class - queries that reference "table1" (3) Table2.class - queries that reference "table2"
Are there any thoughts on the design?
Aucun commentaire:
Enregistrer un commentaire