$35
1. Source code
Download link:
For java: https://github.com/NewbieOrange/SUSTech-SQL-Project2-Public
For python: https://github.com/ziqin/SUSTech-CS307-Project2-Python
Interface Specification
We provide the interfaces code in two language (Java, Python). You can use either of them upon your preference. Notice
that due to the inherent differences between these two language, the Score Policy may also be different.
The structure of the interfaces is as follows. database folder stores connection information such as username, password, url, we only
provides PostgreSQL as the DBMS.
dto folder stores a set of data objects that will be accessed by interfaces. Your
implementation will use them as parameters or returned values.
service folder stores Service Interfaces, this is the folder you should pay special attention
to. There exist multiple .java file where the interface signatures are stored. You need to implement you own class to fit these signatures.
exception folder stores exceptions that you should throw if something went wrong. factory folder stores the ServiceFactory abstract class that you need to implement to
create your service instances.
Your Tasks
Implement the service and factory interfaces to pass the base testcases.
Design your (PostgreSQL) database to satisfy the requirements of interfaces.
Profile your implementation and find ways to speed it up.
(Optional) Find other ways to implement similar functionalities as our interfaces and compare (some of) them, are they better, worse or have different use cases.
Here is a reference implementation, it shows you how to implement one method of an interface.
To get a service working, you'll have to implement all its interfaces
The following code is just a guide, the code interacts with database will usually be written in the DAO layer
Additional requirements of interface
Java
All add*() functions with int as return value should return the (presumably auto-generated) ID.
All arguments are guaranteed to be non-null, unless marked as @Nullable. All return values (and their fields) should be non-null, unless explicitly documented otherwise. If a list/map is empty, put List.of()/Map.of() or equivalents instead of null.
Do NOT modify anything in the provided interfaces, or any of the framework code. Your implementation should throw java.lang.UnsupportedOperationException if a method is not actually implemented, so the tests can fail quickly.
Python
All add*() functions with return value of int should return the (presumably auto-generated) ID.
All arguments are guaranteed to follow the type hints. Arguments passed won't be None unless explicitly annotated with Optional .
For return types with type hints, return values (and their fields) should not be None , unless explicitly documented.
Use [] , {} , set() or their equivalents instead of None for empty container in return values.
Your implementation should raise NotImplementedError if a method is not actually implemented, so that tests can fail quickly.