Skip to content

Commit

Permalink
Update Documentations (#263)
Browse files Browse the repository at this point in the history
* Add list of params to functions in UG

* Add UML Diagrams to Docs

* Fix based on FY's comments

* Fix minor nits
  • Loading branch information
prokarius committed Nov 11, 2018
1 parent 30f43a5 commit d62077e
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 39 deletions.
22 changes: 20 additions & 2 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ image::deleteActivityDiagram.png[width="650"]
We used a less secure alternative due to the nature of the target audience. It is highly improbable for hackers to be targeting a bicycle shop.
// end::adminauthentication[]

// tag::returnfeature[]
=== Return a Loan feature

A LoanBook application that only allows users to do loans without being able to return them would not serve its purpose. When you take out a loan, it should automatically come with the feature of being returnable. This is the functionality for that.
Expand All @@ -519,13 +520,17 @@ A LoanBook application that only allows users to do loans without being able to

Returning a loan is done by setting the corresponding status of the loan to `LoanStatus.RETURNED`. Other than setting the enum to be returned, the cost of the loan will also be calculated and displayed to the user.

The steps that have to be done by LoanBook is as follows:
The steps that have to be done by LoanBook is as follows.

* Check the start and end time of the loan to ensure that the loan period is valid.
* Store the current time as the return time of the loan.
* Change the enum of `LoanStatus` to become `LoanStatus.RETURNED`.
* Calculate the cost of the loan and display it in the GUI as a suggestion for the user.

This is summarized in the following Activity Diagram:

image::ReturnFlow.png[width="450"]

These steps would change the given `Loan` object, and update the properties of the `Loan` object. The appropriate values stored within the `Loan` object would therefore change accordingly.

Given below is an example usage scenerio and how the internals of the Loan would behave:
Expand Down Expand Up @@ -556,6 +561,19 @@ The result is then displayed into the GUI for the user as the cost price of the
[NOTE]
It is possible for the LoanBook to have a loan that lasts for 0 minutes. This is because there may be some weird edge case where an object is loaned for less than a minute, which gets prorated down.

==== Sequence diagram

The sequence diagram has been split into 2 parts. +
First, the sequence diagram of command parsing:

image::ReturnSequence.png[width="600"]

{nbsp} +

Second, the sequence diagram of command execution:

image::ReturnSequenceLogic.png[width="600"]

{nbsp} +

==== Design considerations:
Expand All @@ -580,7 +598,6 @@ Currently, the `summary` command displays to the user the following statistics:

* Total number of ongoing loans
* Total number of loans ever taken out
* Total amount of time all bikes have been loaned for
* Total revenue from the loan service

This would give a very handy summary page as well as a printable audit page for the bicycle shop owners.
Expand Down Expand Up @@ -615,6 +632,7 @@ These are the proposed features you would be able to search based on:
As well, having to recalculate all the loans would be a bad idea when the LoanBook contains many loans. A proposed solution would be to cache the results of the main summary method, so that the LoanBook would only have to recalculate the numbers based on loans that have not been added to the final tally.

Another idea would be to display all the loans in a printable table, when the summary feature is called. Perhaps this would generate a pdf file which shows all the list of loans that the LoanBook is keeping track of. Users can then take use this as a more stringent auditing tool.
// end::returnfeature[]

=== Logging

Expand Down
Loading

0 comments on commit d62077e

Please sign in to comment.