From 58481a9a61843b1e1c12695d22d6375369a2f63f Mon Sep 17 00:00:00 2001 From: Adrien Hopkins Date: Sat, 18 Jun 2022 16:08:48 -0500 Subject: Added big-picture info to the design document --- docs/design.org | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'docs/design.org') 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. -- cgit v1.2.3