In this structure, the program is split into three modules. The view module controls the visual layer and takes input from the UI. The model module stores and processes the income and expense data, and returns totals and percentages. Finally, the controller module interfaces between the model and view modules by calling public methods from the other two modules. Each is contained in an immediately invoked function expression (IIFE) that limits each other module’s access to functions and variables. This maintains a separation of concerns between modules, and allows for easier maintenance and debugging.
The Finished Product
The final project is now available on my Github page.