How we Made a Trading Application using Clean Architecture

In the summer of 2020, I had the pleasure of taking CSC207 and working on a trading system in Java. To learn about how the project works, you can watch this video made by Ethan Lam, one of the group members. In this blog post, I will explain the code structure and some of the tools that were required to complete the project.

Code Structure

Figure 1: Clean Architecture Diagram

Here is some useful terminology that I will be referencing:

  • Entities: Classes that store information about themselves.
  • Use Cases: Classes that modify values inside Entities and control what is allowed to happen to an entity.
  • Controllers: Determine which actions the user is allowed to do and direct user input into use cases.
  • Presenters: Gather and format information so that it can be sent to the view.

We used packages to separate each layer. Each package reresents a layer of Clean Architecture. Here is how the file structure looks like:

Figure 2: Trading System File Structure

Graphical User Interface

We used the JavaFx library. One of the core advantages of JavaFx is the integration with the FX Markup Language (FXML). FXML files allow designers to create views through a drag-and-drop interface known as the Scene Builder (see Figure 3). These files are stored separately and are loaded by the view layer.

Figure 3: JavaFx Scene Builder

Multi-Language Support

Figure 4: Resource Files

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store