Overview
Doctor on Call is a desktop address book application designed to facilitate doctors to manage patient information. It aims to reduce the inefficient communication between doctors and patients.The programming language used is Java.
Summary of Contributions
-
Code contributed: [the link to the RepoSense report page]
-
Major enhancement: added login/register/logout feature to the address book
-
What it does: This featrue allows users to register and login using an account, and also allows the user to logout from the system.
-
Justification: This feature is implemented to ensure authentication.
-
-
Other contributions:
-
Project management:
-
Set up the organization and main repository for the project group
-
-
Documentation:
-
Created and wrote the group’s AboutUs and ContactUs page
-
-
Community:
-
Reviewed the Pull requests of other students
-
-
Tools:
-
Utilized Java Properties file to store account information
-
-
Contributions to the User Guide:
Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users. |
Login to the system : login
Allow the user to login to the system
Format: login username password
Login is required in order to use the address book |
Examples:
-
login Admin Admin123
Logged in as Admin if the account and password are correct.
Register a new account: register
Allow the user to register a new account in the system
Format: register username password
The password should contain at least one lowercase letter, one uppercase letter and one digit |
Examples:
-
register Doe Doe12345
A new account is registered if the username chosen has not been registered before.
Logout from the system : logout
Allow the user to logout from the system
Format: logout
Examples:
-
logout
The user will be logged out.
Contributions to the Developer Guide:
Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project. |
Login/Register/Logout Feature
Current Implementation
The login/register/logout mechanism is facilitated by AccountManager
, it implements the following operations:
-
AccountManager()
— The constructor for the classAccountManager
. -
getLoginStatus()
— Returns the login status to the caller. -
getCurrentAccount()
— Returns the username of the account currently using the application. -
accountCommandHandler(String)
— Handles the user input, checks if there is a match for username and password match if the user’s command islogin
, trys to regster a new account if the user’s command isregister
, returns a string to indicate the outcome. -
loadAccounts()
— Loads all the account information from local storage. -
storeAccounts()
— Stores all the account information to local storage. -
logout()
— Logs the user out of the system. -
setLoginStatus(boolean)
-- Sets the login status according to the parameter. -
register(String, String)
— Creates a new account for user. -
weakPassword(String)
— Check if the password contains at least one lowercase letter, one uppercase letter and one digit. -
doesNotContainDigit(String)
— Check if the string contains digit, works as a utility function for weakPassword(String).
Given below is an example usage scenario and how the login/register/logout mechanism behaves at each step.
Step 1. The user launches the application. The AccountManager
will be initialized, loadAccounts
will be called to load all the accounts to a HashMap
from local storage, the HashMap
is used to keep track of all the account information.
Step2. The user executes register Doe Doe123
command to register a new account with username Doe and password Doe123. The new username and the corresponding password will be temporarily put into the HashMap
.
Step3. The user executes login Doe Doe123
command to login to the system, if the login is successful, setLoginStatus
will be called to set the login status accordingly, and the user will then be able to start using the addressbook.
Step4. The user executes some other commands.
Step5. The user executes logout
command, setLoginStatus
will be called to set the login status accordingly, and the user will be directed back to the login page.
Step6. The user terminates the program, storeAccounts
will be called to store all the account information in the HashMap to the local storage.
The following sequence diagram shows how the login/register/logout mechanism works:
The following activity diagram explains the behaviour of the system during the execution of login/register/logout command.
Design Considerations
Aspect: Data structure to keep account information during runtime
-
Alternative 1 (current choice): Use a HashMap to keep the username password pairs.
-
Pros: Higher performance, O(1) for most of the operations.
-
Cons: Larger memory overhead.
-
-
Alternative 2: Use a TreeMap to keep the username password pairs.
-
Pros: Lower performance, O(log(n)) for most of the operations.
-
Cons: Less memory overhead.
-
HashMap is used because memory is not a serious issue for this program as the program is not memory consuming in nature.
Aspect: File format to keep account information in local storage
-
Alternative 1 (current choice): Use a Java Properties file to store the username password pairs .
-
Pros: High readability, easy to implement as it only requires java.util package to work, small in file size.
-
Cons: Does not support hierarchical data structure well.
-
-
Alternative 2: Use a JSON file to store the username password pairs .
-
Pros: Key-vaule pair format, similar to HashMap.
-
Cons: Large in file size.
-
-
Alternative 3: Use a CSV file to store the username password pairs.
-
Pros: Small in file size.
-
Cons: Complicated to convert to/from HashMap.
-
-
Alternative 4: Use a XML file to store the username password pairs
-
Pros: Compatible with HashMap.
-
Cons: Large in file size.
-
Instructions for Manual Testing
Given below are instructions to test the app manually.
These instructions only provide a starting point for testers to work on; testers are expected to do more exploratory testing. |
Login/Register/Logout Feature
The username password pair: Admin Admin123 is registered by default for testing purpose. (This is only valid for the user who has cloned our project repository and starts the application using IDE. For the standalone jar file there is no such default account, and user will have to register a new account before starting to use the application.)
|
-
Login
-
Prerequisites: The user has not logged in to the system.
-
Test case:
login Admin Admin321
Expected: An error message:Invalid username or password, please try again
is displayed on the screen. -
Test case:
login Admin Admin123
Expected: Login succeed. -
Other incorrect login commands to try:
login
,login Admin Admin123 Admin123
Expected: Helping message is displayed on the screen.
-
-
Register
-
Prerequisites: The user has not logged in to the system.
-
Test case:
register newuser 12345
Expected: An error message:The password should contain at least one lowercase letter, one uppercase letter, and one digit
is displayed on the screen. -
Test case:
register Admin Password123
Expected: An error message:The username has already been registered, please try a new username
is displayed on the screen. -
Test case:
register newuser New123
Expected: Registration succeed. -
Other incorrect register commands to try:
register
,register Admin Admin123 Admin123
Expected: Helping message is displayed on the screen.
-
-
Logout
-
Prerequisites: The user has already logged in to the system.
-
Test case:
logout
Expected: The user is directed back to the login page. -
Other incorrect logout commands to try:
logout123
Expected: Helping message is displayed on the screen.
-