Functions and edge cases
normaliseName(" Acme ") → "Acme"Define a function that trims a company name. Return a validation error for an empty result. Write down expected outputs before implementing it.
Next · Record identity →normaliseName(" Acme ") → "Acme"Define a function that trims a company name. Return a validation error for an empty result. Write down expected outputs before implementing it.
Next · Record identity →company = {id, name, niche}Give a company a stable identifier. When it changes its name, update the same ID. Two distinct companies may share a name.
Next · Searching and cost →scan: O(n) · lookup by indexed ID
A scan may inspect all 1,000 names. Build a map for frequent ID lookups. Substring searches still need a different strategy.
Next · Persistence and retries →PUT /companies/{id}A user saves again after losing the response. Two identical updates to the same ID should leave one record. Also test an interrupted write.
Next · Test and release →create → rename → reload → verify
Add a fictional company, rename it and reload. Verify the same ID and the new name. Tag a working Git version so later behaviour can be compared.
Next · Model →