Introducing the new feature

After getting to know the code more, it seems that the most important functional change is to replace the current status (fragment):

@XmlRootElement 
public class Book { 
 
  private final String title; 
  private final String author; 
  private int status; //<- this attribute 
  private int id; 

And replace it with a collection of them (fragment):

@XmlRootElement 
public class Book { 
  private int[] statuses; 
  // ... 

This might seem to work (after changing all access to the field to the array, for example), but this also prompts a functional requirement.

The Alexandria software should be able to store books and lend them to users who have the power to return them. The user can also query the system for books, by author, book title, status, and ID.

The PO confirms that searching books via status has now changed now, it also allows  searching for any previous status.

This change is getting bigger and bigger. Whenever we feel that the time for removing this legacy code has come, we start applying the legacy code algorithm.

We have also detected a primitive obsession and feature envy smell: storing the status as an integer (primitive obsession) and then actuating on another object's state (feature envy). We will add this to the following to-do list:

  • Dependency injection in BooksEndpoint for books
  • Change status for statuses
  • Remove the primitive obsession with status (optional)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.165.62