180 likes | 701 Views
Functional Decomposition. Also known as top-down development Widely deemed to be a “good thing” Regard thing to be developed as a hierarchy State top level, and decomposing into smaller objects. Decomposition continues until code level. Scenario
E N D
Functional Decomposition • Also known as top-down development • Widely deemed to be a “good thing” • Regard thing to be developed as a hierarchy • State top level, and decomposing into smaller objects. • Decomposition continues until code level. Remember, Dilbert is real life
Scenario A car hire firm recently installed a terminal which is used to record the dates when cars are hired out and returned. When a car is taken out the reg. no. is keyed in prefixed by ‘[‘ and the date (no. of days since system commissioning) is automatically entered. For returns, no. is keyed in with a ‘]’ and date added. Remember, Dilbert is real life
Functional Requirements • Manager wants a system to: • display number of separate hire contracts • display the average number of days for which a car is hired. • Thus we need to: • Compute the information • Output it Remember, Dilbert is real life
Computation • Computation comprises three parts: • Count number of separate contracts (i.e. count the ‘[‘s). • Total the number of days for which cars are hired • Compute the average. • Now write the structured English... Remember, Dilbert is real life
BEGIN Initialise #contracts, total days = 0 Get 1st transaction WHILE not end of transactions DO IF car taken out THEN Inc #contracts total days = total days - taken out date ELSE total days = total days + return date Get next transaction Display #contracts IF #contracts <> 0 Display total days/#contracts END Remember, Dilbert is real life
Changed Requirements • Now amend the system so that it also displays the longest period of hire. Remember, Dilbert is real life
Changed Requirements #2 • Now produce two separate reports: • 1 for hire periods < 1 week • 1 for hire periods >= 1 week Remember, Dilbert is real life
Changed Requirements #3 • Now allow the system to run even when there are contracts outstanding. Remember, Dilbert is real life
What’s the problem here? • The system reflects designer’s interest in algorithms to compute efficiently the elapsed time. • What does the system design not reflect?… • …the user’s main concern - the real world of hire contracts. Remember, Dilbert is real life
Top Down • Is reasonable for describing things which are already fully understood • Is “natural” as it allows abstraction • When developer has a clear idea of the completed result in his mind, he can use top-down to describe on paper what is in his head. Remember, Dilbert is real life
The Myth • Many believe they are doing top-down development and doing it successfully: • They confuse the method of description with the method of development • Development was performed in some hidden way • Top-down phase only began when problem already solved Remember, Dilbert is real life
Well, so what? • A method must allow solution of problems to which developer does not already know the solution. • Top-down compels developer to make largest and most far reaching decisions at the start… • …when we know least about the problem. Remember, Dilbert is real life
Mistakes compounded • Each step is taken in the context generated by the previous step. A A1 A2 A3 Remember, Dilbert is real life
Start again? • If first step was ill-chosen, nothing can be done later to retrieve the error. • Either press on with a design we know is faulty… • …or go back to the beginning and start again. Remember, Dilbert is real life
A Solution? • Brooks states, the “…question, therefore, is not whether to build a pilot system and throw it away. You will do that… Hence plan to throw one away; you will anyhow.” • Jackson paraphrases this view as “once to do it, and once to do it properly”. Remember, Dilbert is real life
“The brilliant top-down developer is one who completes the development in his mind’s eye before committing himself to writing down even the top level of decomposition. Where developers are merely skilled and competent…the consequences of their early decisions emerge only at the end of the project: hence the appealing suggestion that it could all be done properly the second time around” Remember, Dilbert is real life
FD Methods • SSADM • YSM • IE • STRADIS • … • ... Remember, Dilbert is real life
No FD? • Jackson System Development (1983), or JSD does not use Functional Decomposition. • Neither did JSP (1975). Though you may not have noticed this. Remember, Dilbert is real life