Presentation is loading. Please wait.

Presentation is loading. Please wait.

Algorithms and Problem Solving-1 Algorithms and Problem Solving Mainly based on Chapter 6: “Problem Solving and Algorithm Design” from the Book: “Computer.

Similar presentations


Presentation on theme: "Algorithms and Problem Solving-1 Algorithms and Problem Solving Mainly based on Chapter 6: “Problem Solving and Algorithm Design” from the Book: “Computer."— Presentation transcript:

1 Algorithms and Problem Solving-1 Algorithms and Problem Solving Mainly based on Chapter 6: “Problem Solving and Algorithm Design” from the Book: “Computer Science Illuminated” by Nell Dale and John Lewis.

2 Algorithms and Problem Solving-2 A Computer Example Problem –Create an address list that includes each person’s name, address, telephone number, and e-mail address –This list should then be printed in alphabetical order –The names to be included in the list are on scraps of paper and business cards

3 Algorithms and Problem Solving-3 A Computer Example

4 Algorithms and Problem Solving-4 A Computer Example

5 Algorithms and Problem Solving-5 A Computer Example

6 Algorithms and Problem Solving-6 A Computer Example

7 Algorithms and Problem Solving-7 Testing the Algorithm The process itself must be tested Testing at the algorithm development phase involves looking at each level of the top-down design

8 Algorithms and Problem Solving-8 Testing the Algorithm Desk checking: sit at a desk with a pencil and paper and work through the design Walk-through: Manual simulation of the design by the team members –Take sample data values and simulate the design using the sample data Inspection: The design is handed out in advance, and one person (not the designer) reads the design line by line while the others point out errors

9 Algorithms and Problem Solving-9 Object-Oriented Design Methodology Four stages to the decomposition process –Brainstorming –Filtering –Scenarios –Responsibility algorithms

10 Algorithms and Problem Solving-10 CRC Cards

11 Algorithms and Problem Solving-11 Brainstorming A group problem-solving technique that involves the spontaneous contribution of ideas from all members of the group –All ideas are potential good ideas –Think fast and furiously first, and ponder later –A little humor can be a powerful force Brainstorming is designed to produce a list of candidate classes

12 Algorithms and Problem Solving-12 Filtering Determine which are the core classes in the problem solution There may be two classes in the list that have many common attributes and behaviors There may be classes that really don’t belong in the problem solution

13 Algorithms and Problem Solving-13 Scenarios Assign responsibilities to each class There are two types of responsibilities –What a class must know about itself (knowledge) –What a class must be able to do (behavior) Encapsulation is the bundling of data and actions in such a way that the logical properties of the data and actions are separated from the implementation details

14 Algorithms and Problem Solving-14 Responsibility Algorithms The algorithms must be written for the responsibilities –Knowledge responsibilities usually just return the contents of one of an object’s variables –Action responsibilities are a little more complicated, often involving calculations

15 Algorithms and Problem Solving-15 Computer Example Let’s repeat the problem-solving process for creating an address list Brainstorming and filtering –Circling the nouns and underlining the verbs Page 171

16 Computer Example First pass at a list of classes

17 Computer Example Filtered list

18 Algorithms and Problem Solving-18 CRC Cards

19 Algorithms and Problem Solving-19 Responsibility Algorithms


Download ppt "Algorithms and Problem Solving-1 Algorithms and Problem Solving Mainly based on Chapter 6: “Problem Solving and Algorithm Design” from the Book: “Computer."

Similar presentations


Ads by Google