Skip to content
Questions
Definition
Once the problem has been decomposed, the next step is to determine how each component will be solved. This involves specifying the methods, functions, and procedures needed to address each subproblem.
Worked Example
Worked Example: Library Book Reservation System
ComponentPurposeExample routine
User identificationConfirm who is making reservationgetUserName()
Book selectionFind the target book recordgetBookISBN(bookTitle)
Availability checkingEnsure copies are in stockcheckAvailability(ISBN)
Collection locationLet user choose pickup branchselectLocation()
Reservation confirmationSave reservation and confirmconfirmReservation(userID, ISBN, location)
pseudocode
function getUserName():
    if userIsSignedIn() then
        return getNameFromDatabase()
    else
        promptLoginOrRegister()
        return null
    end if
end function

function getBookISBN(bookTitle):
    bookRecord = searchDatabase(bookTitle)
    return bookRecord.ISBN
end function

function checkAvailability(ISBN):
    stockCount = queryDatabase("SELECT stock FROM books WHERE isbn = " + ISBN)
    return stockCount > 0
end function

function selectLocation():
    displayMenu(["Main Branch", "North Branch", "East Branch"])
    return getUserSelection()
end function

procedure confirmReservation(userID, ISBN, location):
    writeToDatabase(userID, ISBN, location, currentDate())
    displayConfirmation()
end procedure