You are on page 1of 6

Detailed Lesson Plan in ICT

Ronald M. Escarez
BTLE - ICT 3

1. The learners demonstrate


the understanding of
commands.
Objective Content Standards
2. The learners demonstrate
the understanding of
functions.
Recognize and represent
Performance
commands and functions in
Standards
various forms and context.
Learning Define commands and
competencies functions.

Content

Subject matter/
Commands and functions
Lesson

Have you ever given someone


Before the lesson: directions on how to do
something like tying a shoe or
Procedures Yes, we do.
A. Presenting new solving a math problem? If
lesson you so, you’ve issued a
command.
You’ve commanded someone
to do specific action. Think of
a time you followed someone
Sometimes it’s easy,
else directions. Were they
sometimes it’s hard.
easy to follow? Did you get
too little or too much
direction?

At the end of the lesson the


B. Establishing a
student will be able to use
purpose for the
commands and functions to
lesson
perform operations.

During the lesson:

C. Presenting
To give good commands, you
examples/
need to think about how much
instances of the
information is needed.
new lesson
For example, if you
commanded a robot to take
out the recycling, would your
commands be different than
they’d be for a person? You
couldn’t use words the robot
doesn’t already know and
understand.
Robots or computers need
very specific instructions for
D. Discussing new you to get the right results. To
concepts and execute instructions in
practicing new programming we use
skills 1 commands - these are words
used to perform a specific
operation.
example:

moveForward() - used to tell


the robot to move forward.

turnLeft() - used to tell the


robot to turn to the left.

Take a look at our puzzle, we


are going to help Byte collect
the gem before we jump into
coding.
He needs to collect
What does Byte need to do?
the gem.
Visualize what Byte needs to
do to get the gem. Name and
number each step Byte will
take, including the step for
collecting the gem.
How many steps does Byte
6 steps.
need to take?
Use swift commands below to
tell Byte to move and collect
gem:

moveForward()
turnLeft()
collectGem()
1. moveForward()
You’ll need to write the 2. moveForward()
specific commands to move 3. turnLeft()
Byte across the puzzle and 4. moveForward()
collect gem. 5. moveForward()
6. collectGem()
Solve the puzzle: We will
now use a new command:

toggleSwitch()
1. Enter the commands to
move Byte across the puzzle
and to collect gem.
2. Continue entering
commands to move Byte to
the switch, then toggle it.

Every day, you perform a


range of tasks automatically
without thinking about what
you’re doing. Even simple
E. Discussing new
tasks like tying your shoe
concepts and
took time to automate. You
practicing new
learned to do it using a
skills 2
sequence of steps. To tie your
shoe, you do the following:

loop-swoop-pull
In programming, we call it
function

func tieMyShoe() {
loop swoop pull
}
In swift, we give function its
behavior by adding
commands inside the curly
braces.

After we define our function,


we can call it by name to run
its commands,

ex: tieMyShoe()
Let’s go back to our puzzle,
as you noticed there’s no
turnRight() command
available for us. If Byte needs
to turn right to reach a gem,
how can you make that
happen?

We sometimes have to solve


coding problems by
combining existing
commands to create a new
behavior. This process is
called composition.
Solve the puzzle:
1. moveForward()
2. moveForward()
1. Figure out how to turn
3. moveForward()
to the right using only
4. turnLeft()
the commands we’ve
5. turnLeft()
used before.
6. turnLeft()
2. Use composition to turn
7. moveForward()
Byte to the right when
8. moveForward()
needed.
9. moveForward()
3. Enter the commands to
10. collectGem()
collect the gem.
Solve the puzzle: Define and
use function to turn right:

In the previous puzzle, we


1. Func turnRight()
turned right only once so
{turnLeft()3x}
using three left turns wasn’t a
2. moveForward()
problem. But what if we need
3. turnLeft()
to turn right more than once?
4. moveForward()
It would be more efficient to
5. turnRight()
put all those left turns into a
F. Developing 6. moveForward()
turnRight() command that we
mastery 7. turnRight()
can run multiple times.
8. moveForward()
9. turnRight()
1. Define a function, and
10. moveForward()
enter a set of commands
11. turnLeft()
between { and } curly
12. moveForward()
braces to give it its
13. toggleSwitch()
behavior.
2. Use the commands to
move across and to
solve the puzzle.

Lead the pupils generalize the


G. Making We use functions if
lesson by answering the
generalizations and we want to define a
following questions.
abstractions about certain sets of
the lesson commands.
When do we use functions?
Imagine you own a robot,
H. Finding practical make 5 sets of commands you
applications of want your robot to perform.
concepts and skills Make sure to implement the
in daily living use of functions for repetitive
tasks.
func collectSwitch() {
moveforward()
collectGem()
moveForward()
toggleSwitch()
}

1. collectSwitch()
I. Evaluating Solve the puzzle shown on 2. moveForward()
learning the presentation. 3. turnLeft()
4. collectSwitch()
5. moveForward()
6. moveForward()
7. turnLeft()
8. collectSwitch()
9. moveForward()
10. turnLeft()
11. collectSwitch()

You might also like