In this lesson, students are introduced to CodeHS and how Karel the Dog can be given a set of instructions to perform a simple task.
Students will be able to…
Write their first Karel program by typing out all of the Karel commands with proper syntax
Explain how giving commands to a computer is like giving commands to a dog
Students learn more about Karel and Karel’s world. Students learn about walls in Karel’s world, the directions Karel can face, and how to identify a location in Karel’s world using streets and avenues. In these exercises, students will begin to see the limitations of Karel’s commands. Students will need to apply Karel’s limited set of commands to new situations. For example, how can we make Karel turn right, even though Karel does not know a turnRight command?
Students will be able to…
This lesson introduces the run method, which is the place where the program starts running. Students will also learn to write full java program, instead of just writing commands. In the the program below, SquareKarel is the name of the class. When we say extend Karel, it means this is a Karel program like the ones we have already written.
public class SquareKarel extends Karel
{
public void run()
{
putBall();
move();
turnLeft();
}
Students will be able to…
Students will learn how they can create their own commands for Karel by calling and defining methods. Methods allow programmers to create and reuse new commands that make code more readable and scalable.
Students will be able to…
turnRight()
methodMethods are used to teach Karel a word or command. Using methods allows students to break down their programs into smaller pieces and make it easier to understand.
Students will be able to…
In this lesson, students learn about Top Down Design and Decomposition. Top Down Design is the process of breaking down a big problem into smaller parts.
Students will be able to:
In this lesson, students learn how to style their programs by including comments. Comments allow students to leave notes on their program that makes it easier for other to read. Comments are written in plain English.
Commenting Your Code Example:
/*
* multi-line comments
*/
// single line comments
Students will be able to…
In this lesson, students are introduced to Super Karel! Since commands like turnRight()
and turnAround()
are so commonly used, students shouldn’t have to define them in every single program. This is where SuperKarel comes in. SuperKarel is just like Karel, except SuperKarel already knows how to turnRight and turnAround, so students don’t have to define those methods anymore. To use SuperKarel instead of Karel, the class that students write extends SuperKarel instead of Karel:
public class MyProgram extends SuperKarel
{
}
Students will be able to…
In this lesson students learn how to use for loops in their programs. The for loop allows students to repeat a specific part of code a fixed number of times.
For loops are written like this:
for(int i = 0; i < 4; i++)
{
// Code to be repeated 4 times
}
Students will be able to…
In this lesson, students are introduced a new type of loop: while loops. While loops allow Karel to repeat code while a certain condition is true. While loops allow students to create general solutions to problems that will work on multiple Karel worlds, rather than just one.
Students will be able to…
In this lesson, students learn about the conditional statement “if”. Code within an “if statement” will only execute IF the condition is true.
if (frontIsClear()) {
// Code to be executed only if front is clear
}
Students will be able to…
In this lesson we take a look at more conditional statements, more specifically if/else statements. If/else statements let us do one thing if a condition is true, and something else otherwise.
We write if/else statements like this:
if(frontIsClear())
{
// code to execute if front is clear
}
else
{
// code to execute otherwise
}
Students will be able to…
* Explain the purpose of an If/Else statement
* Create If/Else statements to solve new types of problems
* Identify when an If/Else statement is appropriate to be used
In this lesson we take a look at control structures. Some control structures allow us to ask questions: if, if / else statements. Other control structures allow us to repeat code like for loops and while loops. Basically, control structures allow us to control the way the commands execute.
Students will be able to…
* Identify the different control structures we can use to modify the flow of control through a program
* Combine control structures to solve complicated problems
* Choose the proper control structure for a given problem
In this lesson, we review more lesson in Karel and get extra practice with control structures. Students will continue to see different ways that the if, if/else, while, and for loops affect their code and what Karel can do.
Students will be able to…
* Analyze a solution to a problem and explain why it works
* Use control structures to create general solutions that work on all Karel worlds
In this lesson, we review how student should indent their code to make it easier to read. Indenting helps to show the structure of the code.
Students will be able to…
* Explain why it is important to indent code
* Identify proper indentation
* Modify a program to have proper indentation
* Write programs with proper indentation
This lesson is a summative assessment of the unit’s learning objectives.
Assess student achievement of the learning goals of the unit