Overview
ForumBook is a desktop forum application which allows students to exchange information of the courses offered by their school. The user interacts with it using a CLI, and it has a GUI created with JavaFX. It is written in OOP fashion.
Summary of contributions
-
Code contributed: [Functional code]
-
Main feature implemented:: A underlying storage system that powers the application and manager classes that provide APIs for other developers to manipulate application database in a robust way.
-
What it does: Takes care of data storage, data encryption, and provide APIs for accessing the data.
-
IStorage
: A interface that defines a storage that handles read/write to storage device/service -
IEncryptor
: A interface that defines a encryptor who knows an algorithm to encrypt/decrypt data -
SimpleEncryptor
: A concrete implementation ofIEncryptor
, it uses a simple and insecure 'OR' encryption for demoing the ability of data encryption in this application -
JsonFileStorage
: A concrete implementation ofIStorage
, it takes anIEntryptor
(or by default it usesSimpleEncryptor
) and use it to write encrypted json data to hard disk / read encrypted json data from hard disk -
BaseEntityStorage
: A base class for all types of entity storage, it uses generics to define the underlyingList
and a flag to keep track of whether this storage has been modified. -
[Entity]Storage
: Storage classes who extendBaseEntityStorage
eg:UserStorage
-
RunningId
: Singleton that handles Id generating, this mimics an auto-increment primary key field in a relational database, but a much simplified implementation. -
StorageMapping
: Singleton that maps class to file path, avoid magic numbers(strings). -
IForumBookStorage
: A interface, it defines a manager class that controls the loading/committing/accessing of data. -
I[Entity]Repository
: Entity repository interfaces that define the APIs of manipulating application data -
[Entity]Repository
: Concrete implementations ofI[Entity]Repository
-
IUnitOfWork
: A interface, it defines a wrapper that groups one or more operations into a single transaction, ensure data consistency -
UnitOfWork
: A concrete implementation ofIUnitOfWork
-
SampleDataGenerator
: A helper class to generate sample data after a fresh copy of this application is started
-
-
Justification: This structure enables the application to manage multiple entities in a robust way.
-
Highlights: This design takes data consistency and potential future storage possibilities(eg:store everything in a server) into account. Unit of work pattern ensures that even if one of a series of operation fails, the whole set of operation will not be saved, our data is always in a good shape.
-
-
Minor feature implemented: Added a
Context
class that manages user login status and provide API for other commands to check login status. -
Other contributions:
-
Project management:
-
Managed releases
v1.1
-v1.2
(2 releases) on GitHub
-
-
Documentation:
-
Community:
-
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. |
Security
All data including user credential and application data are encrypted on your disk. You don’t need to worry about other people who have access to your computer steal your information.
FAQ
Q: How do I transfer my data to another Computer?
A: Install the app in the other computer and overwrite the empty data file it creates with the file that contains the data of your previous Forum Book folder.`
Q: What if I forget my password?
A: Ask an admin to help, he/she has the privilege to reset your password.
Q: How do I uninstall this application?
A: Just delete the folder containing this application, it does not touch any other part of your computer.
Q: What if I want change my password?
A: Ask an admin to help, he/she has the privilege to change your password. Alternatively, User can delete their account and re-create with your desired Password.
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. |
Storage component
The Storage
component,
-
can save
UserPref
objects in json format and read it back. -
can save the Forum Book data in encrypted json format and read it back.
Storage
Design Consideration
As the basis of the whole program, storage should be robust, efficient and stable at all the time. Data consistency and multi-thread access should be specially taken care of.
Overview
ForumBook’s storage consists of six(6) parts.
-
User
-
Stores user information like username, password, email etc.
-
-
Announcement
-
Stores announcement set by admin, multiple announcements can be saved in the storage.
-
-
Module
-
Stores module information like module name, code etc.
-
-
ForumThread
-
Stores threads posted by users
-
-
Comment
-
Stores comments under threads
-
-
RunningId
-
Used for generating auto incremented ID, each the above entity has a unique ID
-
These components are stored separately in six files for performance, see below for detailed process of loading and saving.
Storage Structure
To avoid unnecessary disk IO, each part of the storage is saved in a file located in forumData
directory.
All data manipulation must be done within an IUnitOfWork
where developer has to commit if the data
should be persistent on disk, or rollback if the exception is thrown somewhere during the transaction.
IStorage
defines interface to access file systems, this handles how our program actually get/read data.
By default, we have JsonFileStorage
which stores and reads data from local hard disk. More storage options
can be achieved by implementing this interface. eg: FtpStorage
.
IEncryptor
defines interface to encrypt application data, it should be injected to IStorage
providing a encryption/
decryption layer just before data writes and just after data reads. By default, JsonFileStorage
uses SimpleEncryptor
which is a simple 'OR' encryptor. A more secure encryption algorithm can be achieved by implementing IEncryptor
interface.
IForumBookStorage
defines interface to access data entities
I*Repository
defines interface to how we can manipulate different entities.
Each entity is managed by a repository, eg: IUserRepository
*Storage
is a thin wrapper for the List
containing data objects, it keeps track of whether the underling list
has been modified so that it can save some unnecessary disk IO if nothing changed when a commit()
is issued.
Data are saved in encrypted Json format, the encryption algorithm is provided by IEncryptor
RunningId
does not work as the other entities do, it has its own logic to make sure IDs are not repeated.
Data Encryption
Data encryption is done in a transparent layer.
All data in this application is encrypted.
A very simple, naive, and insecure encryption is implemented in SimpleEncryptor
, this is only for demoing the ability of
encrypting data in this application. However, a more secure algorithm can be easily added into the app by
implementing the IEncryptor
interface and provide it into IStorage
.