CSE Roadmap

Common tier · about 4 hours · 8 parts

Part 6 of 8 · 3 min read

Discovering components

Three ways to find the first drawing.

A context is a large block. Inside it are smaller parts. FSA calls them components, and says that deciding their size is one of the hardest jobs of an architect. Too small, and the parts talk to each other too much. Too large, and the parts couple inside, which makes testing and deployment difficult.

FSA says no single method is right, and presents three.

Method How it works Fits best
Actors and actions List the kinds of user and what each can do. Map actions to components General use; formal, up-front design
Event storming List the events that happen in the system. Build components around handlers for them Messaging systems; DDD; microservices
Workflow List roles and their workflows. Build components around the activities Systems without DDD or messages

The case study in FSA is an online auction called Going, Going, Gone. The three actors are the bidder, the auctioneer and the system itself, for actions that nobody triggers by hand. The actions are:

  • Bidder: view the live video, view the live bids, place a bid.
  • Auctioneer: enter live bids, receive online bids, mark an item sold.
  • System: start the auction, take payment, track bidder activity.

The first design gives six components: a video streamer, a bid streamer, a bid capture, a bid tracker, an auction session and a payment. The first design puts the capture of bids from the auctioneer and from the bidders into one component, because functionally the job is the same.

Then comes the second step, which is the useful one: check the draft against the architecture characteristics from Level 0. The auctioneer is one person and the bidders are thousands. The bidders need scalability and elasticity. The auctioneer does not, but needs very high reliability and availability, because a dropped connection for the auctioneer ruins the whole auction, while for one bidder it only loses one customer. So FSA splits the capture into two components, one for bids from bidders and one for the auctioneer.

Component

A component is a building block of a system with a clear job, such as "bid capture". It is larger than a class and smaller than the whole system.

Example: in a shop, "stock reservation" is a component, made of several classes.

A worked example (made up). A ticket site has the actors fan, venue staff and system. A fan's actions are search, buy and refund. Staff actions are scan tickets at the gate and set prices. The system sends reminders. First draft: Search, Buying, Refunds, Gate Scanning, Pricing and Reminders. Characteristics check: gate scanning must work with a bad network at the venue and answer in under a second, while pricing can be slow. So Gate Scanning is a different kind of part from the rest and may need its own deployment.

Check yourself: 1. Which discovery method fits a team that uses events and DDD? 2. Why did the auction design split the bid capture in two? 3. In the made-up ticket example, which component stands apart and why?