0% found this document useful (0 votes)
21 views

Unit 1 Lesson 2 Why Programming Why Java Lesson Plan

Uploaded by

vandana.giri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Unit 1 Lesson 2 Why Programming Why Java Lesson Plan

Uploaded by

vandana.giri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Lesson Plan

Lesson 1.2: Why Programming? Why Java?

Overview
This lesson corresponds to the College Board topic 1.1 Why Programming? Why
Java? It introduces the Java programming language. By completing this lesson,
students learn how to compile Java source code into a class file and execute a
program. Students are given an opportunity to correct compiler errors in several
sample programs.

Note: If you wish to provide a URL/link for students to access this lesson, you
can replace “yourCustomCourseName” in the customized link below with the
name of your custom course that you created. However, Runestone will
automatically direct students who are logged in to your custom course from the
CSAwesome link. For instructions on how to set up a custom course, please see
https://www.csawesome.org/runestone-e-book.

Customized Link to Share:


https://runestone.academy/ns/books/published/csawesome/Unit1-Getting-
Started/topic-1-2-java-intro.html will redirect to your custom course link below
if students are logged in:
https://runestone.academy/ns/books/published/yourCustomCourseName/Unit1-
Getting-Started/topic-1-2-java-intro.html

Student Learning Objectives


ENDURING UNDERSTANDING

MOD-1 Some objects or concepts are so frequently represented that programmers can
draw upon existing code that has already been tested, enabling them to write
solutions more quickly and with a greater degree of confidence.

VAR-1 To find specific solutions to generalizable problems, programmers include

1
Lesson Plan
Lesson 1.2: Why Programming? Why Java?

variables in their code so that the same algorithm runs using different input values.

LEARNING OBJECTIVE ESSENTIAL KNOWLEDGE

MOD-1.A Call System class methods ➢ MOD-1.A.1 System.out.print and


to generate output to the console. System.out.println display information
on the computer monitor.
VAR-1.A Create string literals. ➢ MOD-1.A.2 System.out.println moves
the cursor to a new line after the
information has been displayed, while
System.out.print does not.
➢ VAR-1.A.1 A string literal is enclosed
in double quotes.

Materials and Resources

● Presentation system (LCD projector/Interactive whiteboard)


● 1.2. What is Java? in the CSAwesome E-book
● Snowperson handout (courtesy of Art Lopez)
● Slide deck (optional, adapted from Art Lopez)
● CSAwesome! Programming Solutions
● Optional: rubber ducks for Rubber Duck Debugging

Learning Activities

Estimated Length: 45 minutes

● Hook/Motivation (10 mins):


○ Divide students into pairs. Take one of the students in each pair out of the
class to tell them the secret that they will be giving instructions on how to

2
Lesson Plan
Lesson 1.2: Why Programming? Why Java?

draw a simple snowman. You may give them the following secret
snowperson handout.
○ Have the pairs sit back to back. One of the students should have paper and
a pencil or pen and be prepared to draw something simple. Do not tell the
drawing student what they will be drawing! The other student will give
that student instructions on how to draw a simple snowperson without
using body part or clothing words or the word snowperson (which is a
secret to the “draw-er”). The student drawing may not ask any questions
during the instructions.
○ Afterwards, have the “draw-er” show their picture. Ask the students
questions such as: Was the result a snowman? How exact did the
instructions need to be? Did the order of the instructions matter? What
kinds of problems occur because of the vagueness of the English
language?
○ Note this activity may take up to 30 minutes if you have extra time. If not,

you will need to ask the students to stop after 10 minutes.


● Experiences and Explorations (30 mins):
○ Direct Instruction: After the introductory activity, discuss the idea of a
programming language, Java source code, compiling into class files and
program execution. Link the intro activity to the “drawer” as the
“execution” of the program. The person giving the instructions is the
“source code”. How the “drawer” interprets those instructions is the
“compiler”.
■ keywords are words which Java understands, such as “public”,
“class” and “System” vs identifiers, which are words the
programmer creates such as ClassName or SecondClass.
■ Optional Slide deck.
○ Guided Practice: Lead the students through the Coding Exercises.

3
Lesson Plan
Lesson 1.2: Why Programming? Why Java?

■ Discuss that the main method is required to launch the program.


No matter how big your program is, there has to be a main()
method to get the ball rolling.
■ Discuss a string literal and the necessity of enclosing what you
LITERALLY want to be printed inside the double quotes.
■ Semicolons: In the English language, we end sentences with
periods, question marks and exclamation points. Java “sentences”
end with a semicolon ;
■ Curly braces: Java must know where blocks of code begin and end.
Open and close curly braces are delimiters that indicate to Java
“start here” and “stop here”. If you have students who took CSP,
compare these to what was used in that language.
■ Allow students to make changes to the original words inside the
println in the 1st coding exercise.
■ After completing the Coding Exercises through Activity 1-2-2, have
students think/pair/share what kinds of obstacles they ran into
while rearranging code. Were any errors created at any point in
time? What do you notice about how the curly braces are indented?
■ 1.2.2 Compiler Errors: Have students read about syntax errors and
debugging. In effect, syntax errors represent grammar errors in the
use of the programming language.
■ After completing the compiler error practice, ask students for
questions about what other kinds of errors they can think of that
might cause a syntax error. Common examples are misspelled
variable names, missing semicolons, improperly matched
parentheses, quotes and curly braces.
■ Optional: some teachers provide rubber ducks for each pair of
students that they can name and use as a soundboard when
debugging their programs. See rubber duck debugging and the
video of the story behind it.
■ Go over 1.2.3 Comments.
■ Have students work in pairs to complete the
Debugging Challenge in 1.2.4.

4
Lesson Plan
Lesson 1.2: Why Programming? Why Java?

● Rethink, Reflect, and/or Revise (5 mins):


○ 1.2.5 Summary Ask students to review the Summary section on the
Runestone site. From the summary section, have students choose ONE
that they feel the most comfortable with so far and share with another
student. Repeat with the ONE that they are most UNCOMFORTABLE with
and share as well.

Check for Understanding


● Interactive Exercises: 1-2-1, 1-2-2
● Coding Exercises: Activecode Activities; Debugging Challenge
● Common Misconceptions:
○ Students have trouble with understanding compiler errors that do not
point directly to the problem. For example, if a closing quote is left off a
String literal, the compiler error “unclosed String literal” points to the
beginning quote and students do not know where to place the closing
quote.
○ If a closing curly brace is missing, the “reached end of file while parsing”
error message does not point to the problem.
○ Students struggle in the beginning with the difference between print() and
println().
● Personal Progress Check (College Board): The College Board AP Classroom
provides a quiz bank and Personal Progress Checks. You may create a formative
assessment quiz for topic 1.1 in the AP Classroom. Review the results in class to
identify and address any student misunderstandings.

Differentiation: More Practice


● MathTutorDVD.com provides a short video on how to use the tab and
newline escape sequences.

5
Lesson Plan
Lesson 1.2: Why Programming? Why Java?

Differentiation: Enrichment
● Show students the use of an “escape sequence”. An escape sequence always
begins with a backslash and is followed by a letter which means something
“special” to Java. The escape sequence “\n” indicates for Java to move to the
“nextline”. Try placing an escape sequence inside a println(), such as:
System.out.println(“Hello\nthere”);

Background Knowledge
● A nice resource website for many Java questions can be found at Geeks for
Geeks. Here is a page relating to How to become a better Java programmer.

Teaching Tips
● CSP → CS A Tips
○ In CSP, the pseudocode provided for a println() statement would have been
DISPLAY(expression)
○ Students who have had Scratch would remember the command:

● The more students feel free to experiment with code, the better.
● Debugging tip: Only concentrate on fixing ONE error at a time and re-
compiling. Sometimes 3 errors could have been generated because of 1 missing
semicolon or a misplaced double quote.
● Use these Teaching Tips to help students with good programming style.

Teacher Professional Development Reflection

6
Lesson Plan
Lesson 1.2: Why Programming? Why Java?

After reviewing this lesson plan in the professional development, complete the form
found here to provide feedback on the lesson, materials provided, etc.

Attributions

“11 - Learn Java - Insert New Lines and Tabs into Screen Output.” 11 - Learn Java - Insert New
Lines and Tabs into Screen Output - Java Programming - Vol 1 - Variables & Core
Concepts - Math Tutor Public Gallery,
videos.mathtutordvd.com/detail/videos/java-programming---vol-
1---variables-core-concepts/video/r4kuDIcAte8/11---learn-java---
insert-new-lines-and-tabs-into-screen-output?
autoStart=true&page=CA8QAQ.
“How Do I Become a Good Java Programmer?” GeeksforGeeks, 25 Sept. 2018,
www.geeksforgeeks.org/how-do-i-become-a-good-java-programmer/.
“Java Programming Language.” GeeksforGeeks, www.geeksforgeeks.org/java/.
“Lay out What Good Programming Style Consists of for Your Class to Encourage Good Style and
Make Debugging Easier.” Csteachingtips.org, 9 July 2015, csteachingtips.org/tip/lay-out-
what-good-programming-style-consists-your-class-encourage-good-style-and-make-
debugging.

You might also like