summaryrefslogtreecommitdiff
path: root/docs/design.org
diff options
context:
space:
mode:
authorAdrien Hopkins <ahopk127@my.yorku.ca>2022-06-18 16:08:48 -0500
committerAdrien Hopkins <ahopk127@my.yorku.ca>2022-06-18 16:08:48 -0500
commit58481a9a61843b1e1c12695d22d6375369a2f63f (patch)
tree9cec81cd1e358c12ffc1d2ec716d4d462052bf2d /docs/design.org
parent42c7e596747873afeb572be551dd991986beb51c (diff)
Added big-picture info to the design document
Diffstat (limited to 'docs/design.org')
-rw-r--r--docs/design.org26
1 files changed, 25 insertions, 1 deletions
diff --git a/docs/design.org b/docs/design.org
index 8bd27e6..e1f3a88 100644
--- a/docs/design.org
+++ b/docs/design.org
@@ -1,12 +1,36 @@
#+TITLE: 7Units Design Document
#+SUBTITLE: For version 0.4.0-alpha.1
-#+DATE: 2022 May 18
+#+DATE: 2022 June 18
#+LaTeX_HEADER: \usepackage[a4paper, lmargin=25mm, rmargin=25mm, tmargin=25mm, bmargin=25mm]{geometry}
#+LaTeX_HEADER: \usepackage{xurl}
#+LaTeX: \newpage
* Introduction
7Units is a program that can convert between units. This document details the internal design of 7Units, intended to be used by current and future developers.
+* System Overview
+** Packages of 7Units
+ 7Units splits its code into three main packages:
+ - ~sevenUnits.unit~ :: The [[*Unit System Design][unit system]]
+ - ~sevenUnits.utils~ :: Extra classes that aid the unit system.
+ - ~sevenUnitsGUI~ :: The [[*Front-End Design][front end]] code
+ ~sevenUnits.unit~ depends on ~sevenUnits.utils~, while ~sevenUnitsGUI~ depends on both ~sevenUnits~ packages. There is only one class that isn't in any of these packages, ~sevenUnits.VersionInfo~.
+** Major Classes of 7Units
+ - [[*Unit Classes][sevenUnits.unit.Unit]] :: The class representing a unit
+ - [[*The Unit Database][sevenUnits.unit.UnitDatabase]] :: A class that stores collections of units, prefixes and dimensions.
+ - [[*The View][sevenUnitsGUI.View]] :: The class that handles interaction between the user and the program.
+ - [[*The Presenter][sevenUnitsGUI.Presenter]] :: The class that handles communication between the ~View~ and the unit system.
+** Process of Unit Conversion
+ 1. The ~View~ triggers a unit conversion method from the ~Presenter~.
+ 2. The ~Presenter~ gets raw input data from the ~View~'s public methods (from unit, to unit, from value).
+ 3. The ~Presenter~ uses the ~UnitDatabase~'s methods to convert the raw data from the ~View~ into actual units.
+ 4. The ~Presenter~ performs the unit conversion using the provided unit objects.
+ 5. The ~Presenter~ calls the ~View~'s methods to show the result of the conversion.
+** Process of Expression Conversion
+ 1. The ~View~ triggers a unit conversion method from the ~Presenter~.
+ 2. The ~Presenter~ gets raw input data from the ~View~'s public methods (unit conversion: from unit, to unit, from value; expression conversion: input expression, output expression).
+ 3. The ~Presenter~ uses the ~UnitDatabase~'s methods to parse the expressions, converting the input into a ~LinearUnitValue~ and the output into a ~Unit~.
+ 4. The ~Presenter~ converts the provided value into the provided unit.
+ 5. The ~Presenter~ calls the ~View~'s methods to show the result of the conversion.
* Unit System Design
Any code related to the backend unit system is stored in the ~sevenUnits.unit~ package.