Computational Thinking

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 46

COMPUTATIONAL

THINKING
COMPUTATIONAL
THINKING- is a set
of problem-solving
methods that
involve expressing
problems and their
solutions in ways
that computer
could also execute.
Computational thinking supports the
development of computer applications and
problem solving across all disciplines by:

Leveraging concepts and skills from computer


science and applying them to other contexts,
such as core academic disciplines (e.g. arts,
English language arts, math, science, social
studies) and everyday problem solving.
Complementing and enhancing your
existing high school curriculum.

Teaching students how to solve complex


problems in a variety of disciplines.

Leveraging the strength of computer


technology to solve real-world problems.
GROUP ACTIVITY
Instructions: Write a solution for the specific
problem.
Energy Consumption Analysis: You want to reduce your
electricity bill
Diet and Nutrition Planning: You aim to plan a balanced
diet based on your nutritional needs and dietary
preferences.
Emergency Preparedness and Evacuation Planning: You
want to create a family emergency plan for various
scenarious.
ELEMENTS OF
COMPUTATIONAL
THINKING
DECOMPOSITION
• It involves breaking down a complex problem
or system into smaller parts that are more
manageable and easier to understand.
Why is decomposition important?
If a problem is not decomposed, it is much harder
to solve. Dealing with many different stages all at
once is much more difficult than breaking a problem
down into a number of smaller problems and
solving each one, one at a time. Breaking the
problem down into smaller parts means that each
smaller problem can be examined in more detail.
Similarly, trying to understand how a complex
system works is easier using decomposition.
Example 1: Brushing our teeth
To decompose the problem of how to brush our
teeth, we would need to consider:

• which toothbrush to use


• how long to brush for
• how hard to press on our teeth
• what toothpaste to use
Example 2: Solving a crime
Imagine that a crime has been committed.
Solving a crime can be a very complex
problem as there are many things to
consider.
For example, a police officer would need to
know the answer to a series of smaller
problems:
what crime was committed
when the crime was committed
where the crime was committed
what evidence there is
if there were any witnesses
if there have recently been any similar crimes
The complex problem of the committed
crime has now been broken down into simpler
problems that can be examined individually, in
detail.
PRACTICE TEST (20 MINUTES)
Decomposing creating an app
Imagine that you want to create your first app.
This is a complex problem - there are lots of
things to consider.
Question
How would you decompose the task of creating
an app?
• what kind of app you want to create
• what your app will look like
• who the target audience for your app is
• what your graphics will look like
• what audio you will include
• what software you will use to build your app
• how the user will navigate your app
• how you will test your app
• where you will sell your app
PRACTICE TEST (20 MINUTES)

You want to bake a cake. How would you


decompose a task in baking a cake?
• what kind of cake we want to bake
• what ingredients we need and how much of
each
• how many people we want to bake the cake for
• how long we need to bake the cake for
• when we need to add each ingredient
• what equipment we need
ABSTRACTION
• It involves filtering out – essentially, ignoring -
the characteristics that we don't need in order to
concentrate on those that we do.
• Abstraction is the process of filtering out –
ignoring - the characteristics of patterns that we
don't need in order to concentrate on those that
we do. It is also the filtering out of specific details.
From this we create a representation (idea) of
what we are trying to solve.
Why is abstraction important?
Abstraction allows us to create a general idea
of what the problem is and how to solve it. The
process instructs us to remove all specific
detail, and any patterns that will not help us
solve our problem. This helps us form our idea
of the problem. This idea is known as a ‘model’.
How to ABSTRACT
Abstraction is the gathering of the general characteristics we
need and the filtering out of the details and characteristics
that we do not need.
When baking a cake, there are some general characteristics
between cakes.
Example:
• a cake needs ingredients
• each ingredient needs a specified quantity
• a cake needs timings
• When abstracting, we remove specific details and keep the
general relevant patterns.
GENERAL PATTERN SPECIFIC DETAILS
We need to know that a We don't need to know
cake has ingredients what those ingredients are
We need to know that We don’t need to know
each ingredient has a what that quantity is
specified quantity
We need to know that We don't need to know
each cake needs a how long the time is
specified time to bake
PATTERN RECOGNITION
It involves finding the similarities or patterns
among small, decomposed problems that can help
us solve more complex problems more efficiently.
It involves finding the similarities or patterns
among small, decomposed problems that can help
us solve more complex problems more efficiently.
Recognising Patterns
To find patterns in problems we look for things
that are the same (or very similar) in each
problem. It may turn out that no common
characteristics exist among problems, but we
should still look.
Patterns exist among different problems and
within individual problems. We need to look for
both.
Patterns within problems
Patterns may also exist within the smaller problems we
have decomposed to.
If we look at baking a cake, we can find patterns within
the smaller problems, too. For example, for ‘each cake will
need a precise quantity of specific ingredients’, each
ingredient needs:
identifying (naming)
a specific measurement
Once we know how to identify each ingredient and its
amount, we can apply that pattern to all ingredients. Again, all
that changes is the specifics.
PSEUDOCODE
Is a high level description of a computer program or
Algorithm that uses a mix of natural language and
informal programming language like syntax. It helps
the programmers plan and outline the logic of a
solution before translating it into a pecific
programming language.
Pseudocode for Going out for School
//Step 1: Wake up
SetAlarm(wakeUpTime)
WakeUp()

//Step 2: Morning Routine


GetOutOfBed()
FreshenUp()
GetDressed()
//Step 3: Prepare School Bag
GatherBooksAndStationery()
CheckAssignments()

//Step 4: Have Breakfast


ConsumeBreakfast()

//Step 5: Check Schedule


ReviewSchoolSchedule()
//Step 6: Pack Lunch (if applicable)
PrepareLunch()
EnsureLuchMoney()
l

//Step 7: Weather Check


CheckWeather()
DressAppropriately()
//Step 8: Leave Home
PutOnOuterWear()
EnsureAllBagsHasAllItems()
LockHouseSecurely()
//Step 9: Travel to School
ChooseCommuteMode()
AllowSufficientTravelTime()

//Step 10: Arrive at School


FollowEntranceProcedure()
AttendMorningAssemblyOrGotoClass()

//Step 11: Class Participation


ActivelyEngageInClass()
//Step 12: Recess and Lunch
FollowSchoolScheduleForBreakfast()
EatLunchOrParticipateInActivities()

//Step 13: After School Activities (if applicable)


AttendExtraCurricularActivities()
StudySessions()

//Step 14: Return Home


UseSameCommuteMode()
FollowAfterSchoolRoutine()
//Step 15: Homework Study
CompleteAssignedHomework()
StudyForUpcomingAssesments()

//Step 16: Dinner and Relaxation


HaveDinner()
RelaxAndUnwind() //Step 18: Sleep
GoToBed()
//Step 17: Prepare for Bed
GetReadyForBed()
SetAlarmForNextDay()
ALGORITHM
Is a step by step procedure or set of rules designed to
perform a specific task or solve a particular problem. It
serves as a blueprint for a computer program, outlining
the sequence of operations to be executed to achieved
the desired result.
Algorithm for Going out School
• Wake up • Travel to school • Prepare for bed
• Morning Routine • Arrive a school • Sleep
• Prepare School bag • Class participation
• Have breakfast • Recess and lunch
• Check schedule • After school activity
• Pack lunch • Return home
• Weather check • Homework and study
• Leave home • Dinner and relaxation
FLOWCHART
Is a visual representation of a process or Algorithm,
using different shapes to represent different types of
steps or activities. It typically uses arrow to show the
flow of control or data within the process.
Basic Flowcharting Symbol
VARIABLES
Variables are used to store information to be referenced
and manipulated in a computer program.
CONTROL STRUCTURES IN JAVA
• If/Else/Else If
The if/else statement is the most basic of control structures,
but can also be considered the very basis of decision
making in programming.
While if can be used by itself, the most common use-
scenario is choosing between two paths with if/else:
if (count > 2) {
System.out.println("Count is higher than 2");
} else {
System.out.println("Count is lower or equal than 2");
}
JAVA VARIABLES
Variables are containers for storing data values.
• In Java, there are different types of variables, for example:
• String - stores text, such as "Hello". String values are
surrounded by double quotes
• int - stores integers (whole numbers), without decimals, such
as 123 or -123
• float - stores floating point numbers, with decimals, such as
19.99 or -19.99
• char - stores single characters, such as 'a' or 'B'. Char values
are surrounded by single quotes
• boolean - stores values with two states: true or false
FUNDAMENTAL CONTROL
STRUCTURES
1. SEQUENCE
2. SELECTION
3. LOOP
Example 1
int sum1 = 100 + 50; // 150 (100 + 50)
int sum2 = sum1 + 250; // 400 (150 + 250)
// 800 (400 + 400)
int sum3 = sum2 + sum2;

You might also like