TopDown Design and Modular Development The process of

  • Slides: 39
Download presentation
Top-Down Design and Modular Development

Top-Down Design and Modular Development

The process of developing methods for objects is mostly a process of developing algorithms;

The process of developing methods for objects is mostly a process of developing algorithms; each method is an algorithm.

Divide and conquer • It is easier to solve small problems than it is

Divide and conquer • It is easier to solve small problems than it is to solve big ones. • Designers solve a problem by breaking an algorithm into parts that are more manageable. • Parts are solved individually; the smaller solutions are assembled into a big solution. • This process is called decomposition, divide and conquer, or more commonly…top-down design.

Example: Payroll

Example: Payroll

Example: Payroll

Example: Payroll

Modular implementation • The process of top-down design leads to modular implementation. • The

Modular implementation • The process of top-down design leads to modular implementation. • The parts, or modules that make up a complete solution to a problem are implemented individually. • Then combined to form a complete solution

Advantages of modular implementation • More manageable projects – Smaller tasks are easier to

Advantages of modular implementation • More manageable projects – Smaller tasks are easier to understand – Less demanding of resources • Faster: Can have different people work on different modules at the same time • Easier to ensure correctness: – Easier to isolate the cause of an error – Error will be localized to a module…easier to fix. • Reusability: Solutions to smaller problems are more likely to be useful elsewhere than solutions to bigger problems.

Reusable modules

Reusable modules

Reusable code • Computer programs contain many small tasks that must be performed in

Reusable code • Computer programs contain many small tasks that must be performed in many other programs. • Example: username/password • Reusable code makes programming easier and more efficient; you need develop a solution to a problem only once. • Over time you build libraries of software modules for different tasks.

Skating • Michelle Kwan • Sasha Cohen • Kennedy

Skating • Michelle Kwan • Sasha Cohen • Kennedy

The program development cycle

The program development cycle

Program Development Cycle Software developers base many of their techniques on traditional approaches to

Program Development Cycle Software developers base many of their techniques on traditional approaches to mathematical problem solving. One such approach is based on how engineers solve problems.

Program Development Cycle Engineers must: • • Design a solution to a problem Implement

Program Development Cycle Engineers must: • • Design a solution to a problem Implement the solution Test the solution Fix any errors in the solution

Program Development Cycle This approach can be used in computer programming: • Design a

Program Development Cycle This approach can be used in computer programming: • Design a solution to a problem (design a program) • implement the solution (code the program ) • Test the solution (test the program) • Fix the solution (debug the program)

Program Development Cycle Once the software is working, improvements can be designed into the

Program Development Cycle Once the software is working, improvements can be designed into the system. This leads back to design, creating a four-phase cycle.

Program Development Cycle

Program Development Cycle

Program Development Cycle Many different techniques are used to design methods in new software.

Program Development Cycle Many different techniques are used to design methods in new software. Top-down development and modular design are most common. Tools include flowcharts, pseudo-code, storyboards, and Universal Modeling Language (UML).

Program Development Cycle In the design phase of object-oriented programming, objects must be chosen

Program Development Cycle In the design phase of object-oriented programming, objects must be chosen from libraries, or the properties and methods for new objects must be described.

Program Development Cycle

Program Development Cycle

Program Development Cycle The program development cycle’s code phase includes translating a software design

Program Development Cycle The program development cycle’s code phase includes translating a software design into a particular language, and then entering that language on the computer.

Program Development Cycle

Program Development Cycle

Program Development Cycle Testing can be rather complicated: Does the new method do what

Program Development Cycle Testing can be rather complicated: Does the new method do what it is supposed to do? This is known as a test for correctness. Tests for correctness measure whether the program meets the original specifications.

Program Development Cycle Testing can be rather complicated: Is the method reasonably efficient? How

Program Development Cycle Testing can be rather complicated: Is the method reasonably efficient? How much time does it take for the method to complete its task, and how much space does it use?

Program Development Cycle Testing can be rather complicated: Does the method have any undesirable

Program Development Cycle Testing can be rather complicated: Does the method have any undesirable side effects? How does one program affects the performance of another program, or one method affects another method?

Program Development Cycle Programmers perform unit tests and integration tests. A unit test checks

Program Development Cycle Programmers perform unit tests and integration tests. A unit test checks to see if a method works as expected all by itself. An integration test checks to see if a method works in combination with other methods.

Program Development Cycle

Program Development Cycle

Program Development Cycle The causes of any problems discovered during testing need to be

Program Development Cycle The causes of any problems discovered during testing need to be isolated. Here unit tests are most helpful. Once you know the cause, you can develop a plan for fixing the problem, modify the necessary methods, and then test again.

Program Development Cycle

Program Development Cycle

An Alice Development Cycle

An Alice Development Cycle

Working with primitive methods in Alice

Working with primitive methods in Alice

Two types of methods • Alice objects have two types of methods – User-defined

Two types of methods • Alice objects have two types of methods – User-defined methods – Primitive methods • Primitive methods are built-in methods that are an inherent part of an Alice object. • User-defined methods are written by people who use Alice. They can be edited.

Tutorial on primitive methods • Start Alice • Open a new world with the

Tutorial on primitive methods • Start Alice • Open a new world with the snow template • Find the penguin in the animals folder of the objects gallery.