| Sequencing rule | Why it matters |
|---|---|
| Respect dependencies | Some tasks require earlier outputs (e.g. ISBN before stock check) |
| Parallelise where possible | Independent tasks can run simultaneously |
| Validate input early | Prevents invalid data flowing through later stages |
| Authenticate before privileged actions | Protects security and user-specific operations |
// Sequential steps (dependencies exist)
procedure makeReservation():
// Step 1: User must sign in first
userID = authenticateUser()
if userID is null then
print("Please sign in")
return
end if
// Step 2: Get book details
bookTitle = input("Enter book title: ")
ISBN = getBookISBN(bookTitle)
// Step 3: Check availability (depends on ISBN)
if NOT checkAvailability(ISBN) then
print("Book not available")
return
end if
// Step 4: Select location (depends on book being available)
location = selectLocation()
// Step 5: Confirm (depends on all previous steps)
confirmReservation(userID, ISBN, location)
end procedure
| Step order | Dependency reason |
|---|---|
| User auth → Book selection | Must know who is reserving before creating reservation |
| Book selection → Availability check | Need ISBN/book first to check stock |
| Availability check → Location | Only ask for pickup location if book is available |
| Location → Confirmation | Final record requires all previous values |
• Checking availability before selecting a book fails
• Confirming before authentication creates security risks