Skip to main content

Assignment 5 Prep Exercise: Designing a Service Layer for LibTrack

info

This exercise is designed to prepare you for the design task in Assignment 5. We will determine service boundaries using the actor heuristic and at least one of the other 3 service boundary heuristics from L18:

  1. Actor📌: Things used by different actors should be separate.
  2. Rate of Change: Things that change at different speeds should be separate.
  3. Interface Segregation: Clients that need different things should get different interfaces.
  4. Testability: Things that need independent testing should be separable.

LibTrack is a small command-line application for managing a public library. The following classes are already implemented and available for your services to use:

ClassResponsibility
BookRepositoryStores and retrieves books by ID, title, or author
PatronRepositoryStores and retrieves patron accounts
HoldRepositoryManages the ordered queue of holds on a given book
LoanRepositoryRecords active and historical loans (checkouts/checkins)
FineRepositoryStores and retrieves fines associated with patrons and loans

Data model notes:

  • Patron records in PatronRepository contain only basic account information (name, contact details, library card number). Fines, loans, and holds are stored exclusively in their respective repositories, linked to a patron by ID.
  • Patron account format is stable and unlikely to change. Loan policies (loan period, renewal limits) change every few years. The library plans to actively experiment with hold and fine policies (grace periods, fine rates, hold expiry, waiver rules).
  • Checking in a book includes assessing any overdue fine based on current fine policy.

LibTrack serves two distinct groups of users:

ActorGoalsKey Commands
The PatronBrowses the catalog, manages their holds, reviews their borrowing history, and manages their finessearch, hold, holds, history, my account, my fines, pay fine
The LibrarianHandles checkouts and returns, manages the catalog, looks up patron accounts, and manages finessearch, checkout, checkin, catalog add, catalog remove, patron lookup, patron fines, waive fine

Commands​

Patron Commands​

CommandDescription
search <title>Search the catalog by title or author (case-insensitive substring)
hold <book>Place a hold on a book for the current patron
holdsList the current patron's active holds
historyShow the current patron's borrowing history
my accountShow the current patron's account details and borrowing status
my finesShow all outstanding fines for the current patron
pay fine <fine>Pay an outstanding fine

Librarian Commands​

CommandDescription
search <title>Search the catalog by title or author (case-insensitive substring)
checkout <book> <patron>Check a book out to a patron and record the loan
checkin <book>Check a returned book back in, assess any overdue fine per current fine policy, and notify the next patron with a hold
catalog add <title> <author> <isbn>Add a new title to the catalog
catalog remove <book>Remove a title from the catalog
patron lookup <name>Look up a patron's account and current borrowing status
patron fines <name>View all outstanding fines for a patron
waive fine <fine>Waive an outstanding fine for a patron

Your Task​

Write ADR-001: Service Boundaries documenting how you would decompose LibTrack's service layer:

# ADR-001: Service Boundaries

## Context
[What is the situation? What forces are at play?]

## Decision
[What did you decide, and why? Reference specific heuristics.]

## Consequences
[What are the benefits and drawbacks of this decomposition?]

Your ADR should:

  • Name your services and state which commands each one owns
  • Justify each boundary using the actor heuristic and at least one other heuristic (rate of change, interface segregation, testability)
  • Discuss at least one tradeoff — something your decomposition handles well and something it makes harder
Actor-Aligned Services Required

Your service layer must have separate services aligned with the two actors, plus a separate Search service.