Building Good Solutions David Millard

Slides:



Advertisements
Similar presentations
Comp1004: Object Oriented Design II Designing Applications Based on BlueJ Chapter 13.
Advertisements

Tutorial #6 PseudoCode (reprise)
How To Make Crepes By Clara Holz. Clara HolzCrepe Powerpoint Gather Your Ingredients get together all of your ingredients Ingredients: -1 cup flour -2.
FOOD 5th and 7th grade. Meals and meal time The Great Britain X the Czech Republic  Breakfast  Snack  Lunch  Snack  Dinner.
 Draft timetable has the same times as this semester: - ◦ Monday 9:00 am to 12:00 noon, 1:00 pm to 3:00 pm. ◦ Tuesday 9:00 am to 12:00 noon, 1:00 pm.
Programming Fundamentals (750113) Ch1. Problem Solving
Transition Words Cake Recipe.
How to read a recipe – the basics!. HOW TO READ A RECIPE Baking and cooking are two very different kitchen skills. Generally speaking, you bake cakes,
Polly put the kettle on Polly put the kettle on Polly put the kettle on We’ll all have tea.
CS001 Introduction to Programming Day 5 Sujana Jyothi
Match the picture and the words. Write what you need to make toast. Put the sentences into a right order. White a minute. It’s ready. Put it in the toaster.
Imperative. We use imperatives for such as telling people what to do giving instructions and advice making suggestions.
A PowerPoint about Algorithm’s. What is an algorithm?  a process or set of rules to be followed in calculations or other problem-solving operations,
Tea traditions in England
A PowerPoint about Algorithm’s. What is an algorithm? A list Of cammands / instructions to do a tasks.
‘How to make perfect English tea’ Ewa Pacykowska.
How Do You Do It?. In this unit, you will learn how to: understand short and simple procedures in the form of monologues and dialogues read short and.
For this unit, you will develop a new swimming / leisure business. 2. You will need to think of a name & concept for the business. 3. Over the.
Language Course for Practical Training Course Outline 1. Who is who in hotel and catering 2. Working at the reception of a hotel 3. Working in a bar 4.
Top-Down Design Damian Gordon. Top-Down Design Top-Down Design (also known as stepwise design) is breaking down a problem into steps. In Top-down Design.
How to make a Perfect Cup of Tea Supplies Kettle Ceramic tea-pot Large ceramic mug and spoon Microwave oven.
A PowerPoint about Algorithm’s. What is an algorithm? A step by step process of instruction.
PROCEDURE TEXT Presented and Created by : Rimawarni Pradina.
On Monday in our class we made delicious food from the Caribbean.
Learn about the system life cycle Plan the outline of your project
Primary 4 Making Food Revision:
Sequence Damian Gordon. Pseudocode When we write programs, we assume that the computer executes the program starting at the beginning and working its.
Mug Tea bag Kettle Milk Sugar (only if you like it in your tea) A spoon Biscuits A plate for the biscuits.
Las clases de Sra. Schwarz Realidades 1. Sra. Schwarz breakfast.
BRITISH TYPICAL FOOD ENGLISH BREAKFAST FISH and CHIPS JACKET POTATOES SCONES JELLY APPLE PIE PANCAKES LEMON CURD.
PI “I am the Tea Expert” Management Case Study of My Cup of Tea Organising Business Activities in the Most Effective Way PI & MSC.
Computer Control Using computers to do tasks. What are Computers used for? ringing your alarm clock. microwaving your breakfast checking for text messages.
Pseudocode Skill Area Materials Prepared by Dhimas Ruswanto, BMm.
PROCEDURE TEXT. Learn carefully.  Teabag  Coffee mix  Fried rice  Cake  Chili  Powder  Sugar  Pan  spoon  Cut it into pieces  Boil water 
Sequences, Modules and Variables David Millard
Comp1004: Programming in Java II Computational Thinking.
Requirements capture: Using UML Use Cases David Millard and Yvonne Howard {dem,
HOW TO MAKE A GOOD CUP OF TEA SKW 3061 ENGLISH WORKPLACE MISS GURMINDERJEET KAUR MOHAMAD SHAZRYL B. MOHD SHUKOR B01SPS13F
Algorithms 1: Sequences and Modules Yvonne Howard & Rikki Prince
Control Structures: Conditionals, If/Else and Loops David Millard
BOILED EGGS © PDST Home Economics. BOILING IS COOKING FOOD IN FAST BUBBLING WATER IN A SAUCEPAN.
Module Three Food and Beverage Taking Orders. Task presenting Order of serving western food: starter/appetizer (头盘 / 开胃菜 ) soup( 汤类 ) main course ( 主菜.
鲁教版英语五四制七年级下册 主讲教师:孙囡 所在单位:蓬莱市村里集中学
Guess the theme o k e n g l i s h m t r a d b y c q w f u.
Meals and Meal Times in Britain.
The 5 Parts of a Recipe Obj. F2.01 Remember recipe parts & resources.
Food, Meals and Cooking..
The 5 Parts of a Recipe Obj. F2.01 Remember recipe parts & resources.
TOPIC: ORDERING FOOD IN A RESTAURANT
VOCABULARIES WITH THEIR PICTURES
USERS’ PERCEPTIONS OF THE E-MENU PROTOTYPE ON E-MENU FEATURES
Uses English creatively and innovatively
STATE SPACE REPRESENTATION
First, Grill the Bread.
Algorithms Today we will look at: what the word algorithm means
Algorithms Y10 Introduction.
Comp1202: Building Better Programs
Fall foods Part II.
Programming Fundamentals (750113) Ch1. Problem Solving
Programming Fundamentals (750113) Ch1. Problem Solving
British Food.
Breakfast foods.
VOCABULARIES WITH THEIR PICTURES
Programming Fundamentals (750113) Ch1. Problem Solving
Warm up Traditional dishes in Vietnam Sticky rice.
Programming Fundamentals (750113) Ch1. Problem Solving
Recipes.
Process Paragraph Page 7 -Activity 3 - Q1 and Q2
The 5 Parts of a Recipe Remember recipe parts & resources.
What do British people like to eat
Presentation transcript:

Building Good Solutions David Millard

Overview From Problem to Algorithm Identifying Modules ▫What is good modularisation ▫Noun Verb Parsing ▫Stepwise Refinement Do we have the right modules? ▫Coupling ▫Cohesion ▫Generalisation

From Problem to Algorithm We have looked at writing algorithms ▫Characteristics of an algorithm ▫Thinking systematically ▫Decomposing a problem into modules ▫Using Pseudocode But where do you start? How can you tell if you have the right modules?

Cohesive – all about boiling the water Cohesive – all about boiling the water Features of Good Modularisation 1 Cohesion ▫A Cohesive Module does one thing Boil Water in Kettle Empty Kettle Fill Kettle with Water Switch Kettle on Wait until Kettle Boils

Not Cohesive – mixes using the teapot into the process Not Cohesive – mixes using the teapot into the process Cohesive – all about boiling the water Cohesive – all about boiling the water Features of Good Modularisation 1 Cohesion ▫A Cohesive Module does one thing Boil Water in Kettle Empty Kettle Fill Kettle with Water Switch Kettle on Wait until Kettle Boils Boil Water in Kettle Empty Kettle Fill Kettle with Water Switch Kettle on Wait until Kettle Boils Pour Water into Teapot

Well Coupled – all parameters are needed Well Coupled – all parameters are needed Features of Good Modularisation 2 Coupling ▫Modules are well coupled when only the required data is passed between them (as parameters) Make Tea in Pot (min) Put Tea in Pot Put Boiling Water in Pot Wait min Minutes

Well Coupled – all parameters are needed Well Coupled – all parameters are needed Features of Good Modularisation 2 Coupling ▫Modules are well coupled when only the required data is passed between them (as parameters) Make Tea in Pot (min) Put Tea in Pot Put Boiling Water in Pot Wait min Minutes Not Well Coupled – temp variable is not used Not Well Coupled – temp variable is not used Make Tea in Pot (min, temp) Put Tea in Pot Put Boiling Water in Pot Wait min Minutes

Features of Good Modularisation 3 Generalisation ▫Modules that can be reused in different contexts through clever use of parameters Not Well Generalised – only makes sugar tea in a cup Not Well Generalised – only makes sugar tea in a cup Add Ingredients to Cup Put Milk in Cup Pour Tea in Cup Put 1 Sugar Lump in Cup Stir Tea in Cup

Well Generalised– can make tea in any receptical Well Generalised– can make tea in any receptical Features of Good Modularisation 3 Generalisation ▫Modules that can be reused in different contexts through clever use of parameters Not Well Generalised – only makes sugar tea in a cup Not Well Generalised – only makes sugar tea in a cup Add Ingredients to Cup (lumps, recep) Put Milk in recep Pour Tea in recep Put lumps Sugar Lump in recep Stir Tea in recep Add Ingredients to Cup Put Milk in Cup Pour Tea in Cup Put 1 Sugar Lump in Cup Stir Tea in Cup

A Problem A café wants to build an automated system to provide breakfasts. The robot waiter greets people before taking their order by name. Customers can order different combinations of ingredients for their meal, and also ask for one drink. The system then cooks the breakfast. It must be able to fry sausages, bacon, eggs and mushrooms; toast bread, waffles and muffins; and pour their orange juice or coffee. The waiter then serves the breakfast.

Noun Phrase Parsing In order to find the key objects and actions ▫search through the problem definition and ▫extract all the noun phrases Noun phrases are phrases which describe, individuate or pick-out things in the world ▫for example "customer" individuates an entity which will be represented in the system Don't worry about whether or not the noun phrases should be part of the final solution, just meticulously list the noun phrases.

A Problem A café wants to build an automated system to provide breakfasts. The robot waiter greets people before taking their order by name. Customers can order different combinations of ingredients for their meal, and also ask for one drink. The system then cooks the breakfast. It must be able to fry sausages, bacon, eggs and mushrooms; toast bread, waffles and muffins; and pour their orange juice or coffee. The waiter then serves the breakfast.

A Problem A café wants to build an automated system to provide breakfasts. The robot waiter greets people before taking their order by name. Customers can order different combinations of ingredients for their meal, and also ask for one drink. The system then cooks the breakfast. It must be able to fry sausages, bacon, eggs and mushrooms; toast bread, waffles and muffins; and pour their orange juice or coffee. The waiter then serves the breakfast.

In order to find the common processes, look for verb phrases: ▫those which describe "doing things", ▫for example ”cooks" is a process which summarises part of the process Don't worry about whether or not the verb phrases describe final processes of the system, or whether or not one subsumes the description of the other, just list them. Verb Phrase Parsing

A Problem A café wants to build an automated system to provide breakfasts. The robot waiter greets people before taking their order by name. Customers can order different combinations of ingredients for their meal, and also ask for one drink. The system then cooks the breakfast. It must be able to fry sausages, bacon, eggs and mushrooms; toast bread, waffles and muffins; and pour their orange juice or coffee. The waiter then serves the breakfast.

A Problem A café wants to build an automated system to provide breakfasts. The robot waiter greets people before taking their order by name. Customers can order different combinations of ingredients for their meal, and also ask for one drink. The system then cooks the breakfast. It must be able to fry sausages, bacon, eggs and mushrooms; toast bread, waffles and muffins; and pour their orange juice or coffee. The waiter then serves the breakfast.

Most often, the requirements will be from a domain of discourse or "mini-world" -- a given requirements specification will be in the language of a particular work practice, such as hospitality. Given this, you can: ▫remove synonyms (noun-phrases which mean the same thing in the domain of discourse). ▫ignore pronouns and articles such as "the", because they refer to an object/noun-phrase in the context of the rest of the sentences. Tidy up the Lists

A Problem A café wants to build an automated system to provide breakfasts. The robot waiter greets people before taking their order by name. Customers can order different combinations of ingredients for their meal, and also ask for one drink. The system then cooks the breakfast. It must be able to fry sausages, bacon, eggs and mushrooms; toast bread, waffles and muffins; and pour their orange juice or coffee. The waiter then serves the breakfast.

A Problem A café wants to build an automated system to provide breakfasts. The robot waiter greets people before taking their order by name. Customers can order different combinations of ingredients for their meal, and also ask for one drink. The system then cooks the breakfast. It must be able to fry sausages, bacon, eggs and mushrooms; toast bread, waffles and muffins; and pour their orange juice or coffee. The waiter then serves the breakfast.

Look for Noun Verb pairs ▫Cook Breakfast ▫Fry Sausage The processes may be described at different levels of detail ▫E.g. Fry Sausage is part of Cook Breakfast Figure out which noun verb pairs are parts of another But Beware! ▫Sometimes there will be a high level phrase (Cook Breakfast) ▫But sometimes there wont be  Invent one by grouping together the lower level phrases Sketch Processes

What are the Noun Verb Phrases? A café wants to build an automated system to provide breakfasts. The robot waiter greets people before taking their order by name. Customers can order different combinations of ingredients for their meal, and also ask for one drink. The system then cooks the breakfast. It must be able to fry sausages, bacon, eggs and mushrooms; toast bread, waffles and muffins; and pour their orange juice or coffee. The waiter then serves the breakfast.

This process of understanding a problem is called Stepwise Refinement We take the problem and: ▫decompose (break-down) ▫elaborate (add an appropriate level of detail) However it is an iterative process involving much re- writing So the last step is to revise the design ▫(revisiting any of the previous steps as necessary) ▫This will continue until we are happy that we have a working design Stepwise Refinement

Remember the way in which we judge modularisation: ▫Cohesion – do the modules do one thing? ▫Coupling – do the modules pass parameters appropriately? ▫Generalisation – have similar processes been combined where possible (and parameters used to get variations of behaviour)? Stepwise Refinement

Summary From Problem to Solution ▫Identifying Modules Noun Verb Parsing ▫Identifying Noun Verb Phrases ▫Looking for Synonyms ▫Identify Holes (Missing Phrases) Stepwise Refinement – Revise for: ▫Cohesion ▫Coupling ▫Generalisation

Worked Example…

Provide Breakfast Greet People Take Order Cook Breakfast Fry Egg Fry Sausage Fry Bacon Fry Mushroom Toast Bread Toast Waffle Toast Muffin Pour Juice Pour Coffee Serve Breakfast ?

? Provide Breakfast Greet People Take Order Cook Breakfast Fry Egg Fry Sausage Fry Bacon Fry Mushroom Toast Bread Toast Waffle Toast Muffin Pour Juice Pour Coffee Serve Breakfast Provide Breakfast Cook BreakfastTake OrderGreet PeopleServe Breakfast

Provide Breakfast Greet People Take Order Cook Breakfast Fry Egg Fry Sausage Fry Bacon Fry Mushroom Toast Bread Toast Waffle Toast Muffin Pour Juice Pour Coffee Serve Breakfast Cook Breakfast Take OrderGreet People Serve BreakfastServe Customer ? Provide Breakfast

Greet People Take Order Cook Breakfast Fry Egg Fry Sausage Fry Bacon Fry Mushroom Toast Bread Toast Waffle Toast Muffin Pour Juice Pour Coffee Serve Breakfast Cook Breakfast Take OrderGreet People Serve BreakfastServe Customer Fry Egg Fry Sausage Fry Bacon Fry Mushroom Toast Bread Toast Waffle Toast Muffin ? Provide Breakfast

Greet People Take Order Cook Breakfast Fry Egg Fry Sausage Fry Bacon Fry Mushroom Toast Bread Toast Waffle Toast Muffin Pour Juice Pour Coffee Serve Breakfast Cook Breakfast Take OrderGreet People Serve BreakfastServe Customer Fry (X)Toast (X) Generalisation: like Coupling and Cohesion this is a sign of good modularisation ? Provide Breakfast

? Greet People Take Order Cook Breakfast Fry Egg Fry Sausage Fry Bacon Fry Mushroom Toast Bread Toast Waffle Toast Muffin Pour Juice Pour Coffee Serve Breakfast Cook Breakfast Take OrderGreet People Serve BreakfastServe Customer Fry (X)Toast (X) Pour Juice Pour Coffee Provide Breakfast

Greet People Take Order Cook Breakfast Fry Egg Fry Sausage Fry Bacon Fry Mushroom Toast Bread Toast Waffle Toast Muffin Pour Juice Pour Coffee Serve Breakfast Cook Breakfast Take OrderGreet People Serve BreakfastServe Customer Fry (X)Toast (X) Pour (X) Make Coffee ? Provide Breakfast

Greet People Take Order Cook Breakfast Fry Egg Fry Sausage Fry Bacon Fry Mushroom Toast Bread Toast Waffle Toast Muffin Pour Juice Pour Coffee Serve Breakfast Cook Breakfast Take OrderGreet People Serve BreakfastServe Customer Fry (X)Toast (X) Pour (X) Make Coffee Put Food on Plate Give Food to Customer Provide Breakfast

This process is called Stepwise Refinement We take the problem and: ▫decompose (break-down) ▫elaborate (add an appropriate level of detail) However it is an iterative process involving much re-writing So the last step is to revise the design ▫(revisiting any of the previous steps as necessary) ▫This will continue until we are happy that we have a working design Stepwise Refinement

Take OrderGreet People Serve BreakfastServe Customer Fry (X)Toast (X) Pour (X) Cook Breakfast Make Coffee Put Food on Plate Give Food to Customer Cohesion: Should Cook Breakfast include Make Coffee? Provide Breakfast

Take OrderGreet People Serve BreakfastServe Customer Pour (X) Give Food to Customer Cohesion: Should Cook Breakfast include Make Coffee? Prepare Breakfast Cook Breakfast Make Coffee Put Food on Plate Provide Breakfast Fry (X)Toast (X)

Remember the way in which we judge modularisation: ▫Cohesion – do the modules do one thing? ▫Coupling – do the modules pass parameters appropriately? ▫Generalisation – have similar processes been combined where possible (and parameters used to get variations of behaviour)? Stepwise Refinement

Summary From Problem to Solution ▫Identifying Modules Noun Verb Parsing ▫Identifying Noun Verb Phrases ▫Looking for Synonyms ▫Identify Holes (Missing Phrases) Stepwise Refinement – Revise for: ▫Cohesion ▫Coupling ▫Generalisation