Topic 1: Problem Solving

Slides:



Advertisements
Similar presentations
Summer Computing Workshop. Introduction to Variables Variables are used in every aspect of programming. They are used to store data the programmer needs.
Advertisements

Week 5: Loops 1.  Repetition is the ability to do something over and over again  With repetition in the mix, we can solve practically any problem that.
MOM! Phineas and Ferb are … Aims:
©Robomatter – Distribution or copying without permission is prohibited. 3B STEM Computer Science 1 ©Robomatter – Distribution or copying without permission.
More on Logic Today we look at the for loop and then put all of this together to look at some more complex forms of logic that a program will need The.
Visual Basic Games: Week 4 Recap Parallel structures Initialization Prepare for Memory Scoring Shuffling Homework: when ready, move on to next game/chapter.
1 FUNCTIONS - I Chapter 5 Functions help us write more complex programs.
CMP-MX21: Lecture 5 Repetitions Steve Hordley. Overview 1. Repetition using the do-while construct 2. Repetition using the while construct 3. Repetition.
Chess Strategies Component Skills Strategies Prototype Josh Waters, Ty Fenn, Tianyu Chen.
The Lovely Game of NIM. Version 1 - Classic NIM You will need seven objects, such as counters or blocks. It is a game for two players. Place the 7 counters.
GCSE Computing: Programming GCSE Programming Remembering Python.
More on Logic Today we look at the for loop and then put all of this together to look at some more complex forms of logic that a program will need The.
What will your answer be?
Communication skills How speaking and listening make life easier, more productive, and more fun!
AP CSP: Creating Functions & Top-Down Design
ECF Arbiter Seminar - Materials by CAA
Recap: If, elif, else If <True condition>:
Rapid Recall Activities
FLOWCHARTS Part 1.
Sequential Flexibility
Defining Rules and Levels of Rules (Chs. 11 & 12)
As the last CC-list represents Maximum Compatible Classes we conclude:
UNIT 2 – LESSON 6 ENCODE AN EXPERIENCE.
Mr Barton’s Maths Notes
Recursion CSC 202.
UNIT 3 – LESSON 5 Creating Functions.
Introduction to Programmng in Python
CHESS.
Volume: Working Backwards
CS 4700: Foundations of Artificial Intelligence
Procedural Abstraction Object-Oriented Code
Chapter 1 Program Development
Print slides for students reference
Subroutines Idea: useful code can be saved and re-used, with different data values Example: Our function to find the largest element of an array might.
Three Musketeers.
Three Musketeers GDC 2004.
OOP Paradigms There are four main aspects of Object-Orientated Programming Inheritance Polymorphism Abstraction Encapsulation We’ve seen Encapsulation.
4 Probability Lesson 4.8 Combinations and Probability.
Computational Thinking
Abstraction & Automation
Lesson Objectives Aims You should be able to:
Object oriented vs procedural programming
COMP 208/214/215/216 Lecture 3 Planning.
Coding Concepts (Sub- Programs)
Theory of Computation Turing Machines.
Alice Variables Pepper.
TRICKS & TREATS Each team rolls the die, lowest number goes first.
Computational Thinking for KS3
Coding Concepts (Basics)
Topic 1: Problem Solving
Open on the student drive
Problem Solving Designing Algorithms.
Games Workshop.
Christina Maggio Grades 10th -12th October 21, 2012
Year 11 Mock Exams Countdown to Monday 1st May 10 weeks in school
Strike it out.
Abstraction and Hierarchy
Algebra 8. Simultaneous Equations
Workshop for Programming And Systems Management Teachers
COMPUTATIONAL THINKING COMPUTATIONAL THINKING IN PROGRAMMING
Computational Thinking
Strategic Thinking There are two concepts that all chess players must understand from the start; strategy and tactics. Beginners often confuse the two.
Quiz: Computational Thinking
Mr Barton’s Maths Notes
Computational Thinking
ECE 352 Digital System Fundamentals
Snakes and Ladders Game with Science
2019 SAIMC Puzzle Challenge General Regulations
Understanding Computational Thinking
Lecture 6 - Recursion.
Presentation transcript:

Topic 1: Problem Solving Abstraction

Problem Solving: Abstraction When it comes to creating a solution for a problem, there may be times when there is too much information Data that isn’t needed for the solution Stripping away (or hiding) this information is known as abstraction Keeping only the key details/pieces of information needed to solve the problem There are multiple types of abstraction, that deal with removing different details Making the problem simpler to understand Making the solution easier to understand Problem Solving: Abstraction

Abstracting the Problem This type of abstraction involves removing unnecessary information from the problem itself For example, if the problem involves calculating the number of computers needed in a lab, we may not need to know The tutor’s name The types of computer What programs the computers will be running If this information is included in the problem, we can hide it and only focus on the bits we need Problem Solving: Abstraction

Abstracting the Problem For example, take this problem: Casey is playing a game with her students in school. She has six boxes in front of her, each for a subject (Maths, Biology, Physics, Chemistry, Geography, and History). She asks one of her students to roll a die, and depending on the number picks a random question from one of the boxes (1  Maths, 2  Biology, 3  Physics, 4  Chemistry, 5  Geography, 6  History) and then asks the student that rolled the die that question. If they get it right, they earn a point. If they don’t, any student can answer the question (and earn a point if they get it right). In either case, the next student rolls the die and repeats the same steps. Problem Solving: Abstraction

Abstracting the Problem We can ‘cross out’ any unnecessary information (leaving only what we need to solve this problem) Casey is playing a game with her students in school. She has six boxes in front of her, each for a subject (Maths, Biology, Physics, Chemistry, Geography, and History). She asks one of her students to roll a die, and depending on the number picks a random question from one of the boxes (1  Maths, 2  Biology, 3  Physics, 4  Chemistry, 5  Geography, 6  History) and then asks the student that rolled the die that question. If they get it right, they earn a point. If they don’t, any student can answer the question (and earn a point if they get it right). In either case, the next student rolls the die and repeats the same steps. Problem Solving: Abstraction

Abstracting the Problem We can also use decomposition to abstract the problem Here we can take the problem itself And break it into steps With sub-steps as needed This then makes the problem easier to read Making a solution easier to make A student rolls a die Picks a question (based off die roll) Student asked that question If they get it right, they get a point Otherwise any other student can answer (and get the point) Move on to next student Repeat from point 1 Problem Solving: Abstraction

Problem Solving: Abstraction See if you can reduce the following problem to a more abstract form A student is working on creating a Checkers game. Once the game has the board set up, they need to repeat the user and the computer taking turns until one of them wins. Each turn, a player can move a piece diagonally. The game needs to consider crowning a piece if it reaches their opponents side, and letting pieces take other pieces (by jumping over them). A player wins when their opponent has no pieces left. Problem Solving: Abstraction

Abstracting the Solution The other form of abstraction comes into play when we have a solution, which comes into two places Abstracting the solution itself Abstracting the data in the solution Abstracting the data means taking the data from the ‘real world’ And thinking about it in more general terms Problem Solving: Abstraction

Abstracting the Solution For example, we have a cat Certain fur colour Tail length Eye colours We don’t need to know the details Only the general structure Also an example of information hiding Though more obvious on practice Used in public, private, protected Problem Solving: Abstraction

Abstracting the Solution When it comes to abstracting the solution, we tend to do that during implementation Can also prepare for it during the design of a solution There are ‘sub-types’ of abstraction here, but they all affect the code we enter for the solution These are Procedural Abstraction Functional Abstraction Data Abstraction Used in programming the solution (to make it easier to read) Problem Solving: Abstraction

Abstracting the Solution Procedural Abstraction involves breaking parts of a solution off into their own procedure Takes the ‘complexity’ away from the actual solution Means we don’t need to know how that part is done Only that it works as intended A very important part to any complex solution The procedure we make ends up not caring about the data used Only how it works We supply the data when we run this procedure Here register_user is the abstracted procedure Problem Solving: Abstraction

Abstracting the Solution Functional Abstraction works similarly Involves functions instead of procedures That means a value is expected after running the function When designing/implementing, we still don’t care how this function works As long as it does what we expect Here length_between_points is the abstracted function Problem Solving: Abstraction

Abstracting the Solution Finally, Data Abstraction comes back to what we were talking about earlier With the Cat When thinking about data (especially in the design), we don’t care how we represent this data For example, we need to represent ‘students’ in a program What information do we need for a ‘Student’ How do we store multiple ‘Students’ The solution doesn’t care how we do this It’s up for us to decide when programming Problem Solving: Abstraction

Other Forms of Abstraction There are other uses of abstraction as well Not just related to problems and solutions For example, high-level programming languages They are abstractions of the more complex low- level languages They make it easier to tell the computer to do something When using high-level languages, we don’t care how the computer does something We only tell it to do something Problem Solving: Abstraction