diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 64e1f0ed2b..dd0360d86c 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -4,9 +4,55 @@ {list here sources of all reused/adapted ideas, code, documentation, and third-party libraries -- include links to the original source as well} +Reference to AB-3 Developer Guide +* [Source URL](https://se-education.org/addressbook-level3/DeveloperGuide.html#documentation-logging-testing-configuration-dev-ops) +* Used as template to structure this DeveloperGuide +* Reference to AB-3 diagrams code + +Reference to AB-3 diagrams code +* [Source URL](https://github.com/se-edu/addressbook-level3/tree/master/docs/diagrams) +* Used as reference to understand PlantUML syntax + + ## Design & implementation {Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.} +### Categorising the different books by their genres +This functionality enables the categorization of books into distinct groups based on their genres, facilitating better +organization and tracking. The implementation of this feature involves interactions across multiple classes within the +system. +#### Overview +The process of categorizing books by genre is a multi-step operation that involves the following classes: +1. `BookDetails`: This class contains methods that handle the categorization of books. +2. `Book`: Individual book objects are updated with their respective genres directly in this class. +3. `Parser`: This class is responsible for parsing the input command to extract the specific index and genre. + +#### Detailed Workflow +Below is an example usage: +Here’s a step-by-step guide on how the feature works: +Step 1: The user initiates the process by inputting a command like `set-genre 1 Fantasy`. Here, the `Parser` class plays +a crucial role as it interprets the command and segregates it into a manageable array. The first part of this array holds +the command `set-genre`, which indicates the action to be executed. + +Step 2: The second segment of the input string is then further dissected into two components, which are the index (`1`) +and the genre (`Fantasy`). This step is essential for identifying the specific book and the genre it needs to be +associated with. + +Step 3: With the index and genre clearly identified, these parameters are passed to the `setBookGenreByIndex` method +within the `BookDetails` class. This method is then responsible for assigning the specified genre to the book located at +the given index. + +#### Implementation and Rationale +The decision to involve multiple classes in this operation is driven by the principles of object-oriented programming, +which emphasize modularity, encapsulation, and separation of concerns. By distributing responsibilities across different +classes, the system remains flexible, with each class focusing on a specific aspect of the functionality. + +* The `BookDetails` class is central to managing book attributes and behaviors, making it the logical location for methods +* that categorize books. +* The `Book` class represents individual books, and it is here that genre information is ultimately stored, aligning with +* the principle that objects should manage their own state. +* The `Parser` class abstracts the complexity of command interpretation, ensuring that user inputs are correctly understood +* and acted upon by the system. ## Product scope