The approach used in top down analysis and design is năm 2024

A common difficulty encountered when trying to solve a complex problem, is the tendency to focus on the details too soon. There are several critical disadvantages to this:

  1. Because we have not achieved an "overall" view of how the complete problem might be solved, we can spend a lot of energy developing a detailed partial solution that is not compatible with the complete system requirements.
  2. Without first having developed a "big picture" of the major problem components (and their solution requirements), detailed bits of early developed code may force unnecessarily awkward processing of code developed later on.
  3. Without decomposing the initial problem into simpler problems, it is unlikely that the resulting code will be created in coherent pieces that are easy to understand and maintain.

Although technically there are some differences, we will treat the terms "top-down problem analysis", "top-down design", and "functional decomposition" as being identical, within this material.

The product of top-down design is a sequence of successively more detailed algorithm modules (as demonstrated below). Each algorithm module performs a single task which, combined with other modules and basic tasks, provide the solution to a more general module or to the original problem.


Demonstrations of Top-Down Design

Example 1: Simple Linear Logic Most simple linear logic problems can be "decomposed" into 3 sub-problems:

General_Linear_Logic

Get Input Values [Perform Calculations] (using Input Values) DISPLAY Output

END


Example 2: Determining an employee's pay based on hours worked and pay rate (and using some company standard values for overtime). Notice that, in these examples, modules (elements which require further expansion) have been numbered for reference purposes.

Employee_Pay

  1. [Get_Employee_Pay_Values]
  2. [Calculate_Net_Pay]
    DISPLAY netPay
    
    END

1. Get_Employee_Pay_Values

  1. Get_Hours_Worked
  2. Get_Rate_of_Pay RETURN payValues (hoursWorked & rateOfPay)

2. Calculate_Net_Pay

  1. [Calculate_Gross_Pay]
  2. [Calculate_Total_Deductions]
    netPay = grossPay - deductions
    
    RETURN netPay

2.1 Calculate_Gross_Pay

  1. [Calculate Regular Pay]
  2. [Calculate Overtime Pay]
    grossPay = regularPay + overtimePay
    
    RETURN grossPay

2.2 Calculate_Total_Deductions

  1. [Calculate Income Tax Deduction]
  2. [Calculate Canada Pension Plan Deduction]
  3. [Calculate Union Dues Deduction]
  4. [Calculate Health Insurance Deduction]
    ADD all deductions to get totalDeductions
    
    RETURN totalDeductions

Example 3: Determine the total payroll (total of net pay) for all employees of some company. (Having solved a simple problem before, we can use the components of this simpler problem to solve this more complex one).

Determine_Payroll set totalPayroll to zero

  1. [Get_Employee_Pay_Values] (...first)
    WHILE not EOF
  2. \[Process\_One\_Employee (using payValues)\]
  3. \[Get\_Employee\_Pay\_Values\] (...next) ENDWHILE DISPLAY totalPayroll END

2. Process_One_Employee

  1. [Calculate_Net_Pay]
    ADD netPay to totalPayroll
    
    RETURN

Since the two sub-modules within this solution algorithm have already been developed, there is no need to repeat this analysis (although the module numbering would change).

What is the top

A "top–down" approach is where an executive decision maker or other top person makes the decisions of how something should be done. This approach is disseminated under their authority to lower levels in the hierarchy, who are, to a greater or lesser extent, bound by them.

What is the top

The top-down approach starts with an overall design and gradually drills down into smaller components, while the bottom-up approach starts with small components and gradually combines them to form a larger system. Depending on what type of application you are building, you have to decide which way would be best.

What is top down design and how does it help manage abstraction?

Top down program design is an approach to program design that starts with the general concept and repeatedly breaks it down into its component parts. In other words, it starts with the abstract and continually subdivides it until it reaches the specific. Consider creating the prime factorization of a number like 1540.