1szheng / pe

0 stars 0 forks source link

Lifeline for commands should end at end of diagram #25

Open 1szheng opened 2 years ago

1szheng commented 2 years ago

The lifeline of the commands executed should end after its execution. There should be an X marker being placed at the end of its life.

image.png

nus-se-script commented 2 years ago

Team's Response

In Java Memory Management (JVM), as long as an item is being referenced, JVM considers the object alive. It is only when an object is no longer referenced and unreachable by code that the garbage collector removes it and reclaims the unused memory.

https://www.oracle.com/webfolder/technetwork/tutorials/obe/java/gc01/index.html.

From Oracle: "An in use object, or a referenced object, means that some part of your program still maintains a pointer to that object. An unused object, or unreferenced object, is no longer referenced by any part of your program."

In the InvMgr.java file, there is a reference being held by the object inputCommand to point to the DescCommand object. After inputCommand.execute(itemList, ui) completes, it will run the next line ui.showDivider(). At this point in time, inputCommand is still pointing to DescCommand object and hence, DescCommand object should not be considered end of life.

image.png

Items for the Tester to Verify

:question: Issue response

Team chose [response.Rejected]

Reason for disagreement: Since the developer has stated that the run method will process the next line ui.showDivider(), it is clear that the UI printing and other methods have been omitted for brevity.

In this case, since other methods that exists in run() but not in the diagram has been omitted, it should mean that readers should assume that the diagram provided is the full process of the run() method on a desc command, thus should not be referencing the DescCommand object at the end. This brings me to the point that, the reader should either:

  1. assume that the run() would have ended at the end of this diagram, thus the lifeline should end, or
  2. assume that the run() does not end, and the diagram is severely lacking in detail that is not detailed in the section.

In either cases, we may conclude that it is a typo of leaving out the end of lifeline cross, or typo to have left out the other methods that should be displayed within run().

image.png

image.png