Decomposition
Announcements
Modular Design
Separation of Concerns 4
Separation of Concerns A design principle: Isolate different parts of a program that address different concerns 4
Separation of Concerns A design principle: Isolate different parts of a program that address different concerns A modular component can be developed and tested independently 4
Separation of Concerns A design principle: Isolate different parts of a program that address different concerns A modular component can be developed and tested independently Hog Game Game Player Hog Simulator Commentary Strategies 4
Separation of Concerns A design principle: Isolate different parts of a program that address different concerns A modular component can be developed and tested independently Hog Game Game Player Hog Simulator Commentary Strategies • Game rules 4
Separation of Concerns A design principle: Isolate different parts of a program that address different concerns A modular component can be developed and tested independently Hog Game Game Player Hog Simulator Commentary Strategies • Game rules • Ordering of events 4
Separation of Concerns A design principle: Isolate different parts of a program that address different concerns A modular component can be developed and tested independently Hog Game Game Player Hog Simulator Commentary Strategies • Game rules • Ordering of events • State tracking to determine the winner 4
Separation of Concerns A design principle: Isolate different parts of a program that address different concerns A modular component can be developed and tested independently Hog Game Game Player Hog Simulator Commentary Strategies • Game rules • Event descriptions • Ordering of events • State tracking to determine the winner 4
Separation of Concerns A design principle: Isolate different parts of a program that address different concerns A modular component can be developed and tested independently Hog Game Game Player Hog Simulator Commentary Strategies • Game rules • Event descriptions • Ordering of events • State tracking to generate commentary • State tracking to determine the winner 4
Separation of Concerns A design principle: Isolate different parts of a program that address different concerns A modular component can be developed and tested independently Hog Game Game Player Hog Simulator Commentary Strategies • Game rules • Event descriptions • Decision rules • Ordering of events • State tracking to generate commentary • State tracking to determine the winner 4
Separation of Concerns A design principle: Isolate different parts of a program that address different concerns A modular component can be developed and tested independently Hog Game Game Player Hog Simulator Commentary Strategies • Game rules • Event descriptions • Decision rules • Ordering of events • State tracking to • Strategy parameters generate commentary (e.g., margins & • State tracking to number of dice) determine the winner 4
Separation of Concerns A design principle: Isolate different parts of a program that address different concerns A modular component can be developed and tested independently Hog Game Game Player Hog Simulator Commentary Strategies • Game rules • Event descriptions • Decision rules • Ordering of events • State tracking to • Strategy parameters generate commentary (e.g., margins & • State tracking to number of dice) determine the winner 4
Separation of Concerns A design principle: Isolate different parts of a program that address different concerns A modular component can be developed and tested independently Hog Game Game Player Hog Simulator Commentary Strategies • Game rules • Event descriptions • Decision rules • Ordering of events • State tracking to • Strategy parameters generate commentary (e.g., margins & • State tracking to number of dice) determine the winner Ants Game Tunnel Ants Actions Simulator Structure 4
Separation of Concerns A design principle: Isolate different parts of a program that address different concerns A modular component can be developed and tested independently Hog Game Game Player Hog Simulator Commentary Strategies • Game rules • Event descriptions • Decision rules • Ordering of events • State tracking to • Strategy parameters generate commentary (e.g., margins & • State tracking to number of dice) determine the winner Ants Game Tunnel Ants Actions Simulator Structure • Order of actions 4
Separation of Concerns A design principle: Isolate different parts of a program that address different concerns A modular component can be developed and tested independently Hog Game Game Player Hog Simulator Commentary Strategies • Game rules • Event descriptions • Decision rules • Ordering of events • State tracking to • Strategy parameters generate commentary (e.g., margins & • State tracking to number of dice) determine the winner Ants Game Tunnel Ants Actions Simulator Structure • Order of actions • Food tracking 4
Separation of Concerns A design principle: Isolate different parts of a program that address different concerns A modular component can be developed and tested independently Hog Game Game Player Hog Simulator Commentary Strategies • Game rules • Event descriptions • Decision rules • Ordering of events • State tracking to • Strategy parameters generate commentary (e.g., margins & • State tracking to number of dice) determine the winner Ants Game Tunnel Ants Actions Simulator Structure • Order of actions • Food tracking • Game ending conditions 4
Separation of Concerns A design principle: Isolate different parts of a program that address different concerns A modular component can be developed and tested independently Hog Game Game Player Hog Simulator Commentary Strategies • Game rules • Event descriptions • Decision rules • Ordering of events • State tracking to • Strategy parameters generate commentary (e.g., margins & • State tracking to number of dice) determine the winner Ants Game Tunnel Ants Actions Simulator Structure • Order of actions • Characteristics of different • Food tracking ants & bees • Game ending conditions 4
Separation of Concerns A design principle: Isolate different parts of a program that address different concerns A modular component can be developed and tested independently Hog Game Game Player Hog Simulator Commentary Strategies • Game rules • Event descriptions • Decision rules • Ordering of events • State tracking to • Strategy parameters generate commentary (e.g., margins & • State tracking to number of dice) determine the winner Ants Game Tunnel Ants Actions Simulator Structure • Order of actions • Characteristics • Entrances & exits of different • Food tracking ants & bees • Game ending conditions 4
Separation of Concerns A design principle: Isolate different parts of a program that address different concerns A modular component can be developed and tested independently Hog Game Game Player Hog Simulator Commentary Strategies • Game rules • Event descriptions • Decision rules • Ordering of events • State tracking to • Strategy parameters generate commentary (e.g., margins & • State tracking to number of dice) determine the winner Ants Game Tunnel Ants Actions Simulator Structure • Order of actions • Characteristics • Entrances & exits of different • Food tracking • Locations of insects ants & bees • Game ending conditions 4
Example: Restaurant Search
Restaurant Search Data Given the following data, look up a restaurant by name and show related restaurants. 6
Restaurant Search Data Given the following data, look up a restaurant by name and show related restaurants. {"business_id": "gclB3ED6uk6viWlolSb_uA", "name": "Cafe 3", "stars": 2.0, "price": 1, ...} 6
Restaurant Search Data Given the following data, look up a restaurant by name and show related restaurants. {"business_id": "gclB3ED6uk6viWlolSb_uA", "name": "Cafe 3", "stars": 2.0, "price": 1, ...} {"business_id": "WXKx2I2SEzBpeUGtDMCS8A", "name": "La Cascada Taqueria", "stars": 3.0, "price": 2} 6
Restaurant Search Data Given the following data, look up a restaurant by name and show related restaurants. {"business_id": "gclB3ED6uk6viWlolSb_uA", "name": "Cafe 3", "stars": 2.0, "price": 1, ...} {"business_id": "WXKx2I2SEzBpeUGtDMCS8A", "name": "La Cascada Taqueria", "stars": 3.0, "price": 2} ... 6
Recommend
More recommend