From charlesreid1

No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 17: Line 17:
==Section 1.1: Intro to Java==
==Section 1.1: Intro to Java==


===Definitions===
===1.1 Definitions===


* Algorithm  
* Algorithm  
Line 30: Line 30:
* Java Runtime Environment (JRE)
* Java Runtime Environment (JRE)


===Material===
===1.1 Material===


Things to cover:
Things to cover:
Line 39: Line 39:


1995: Oracle: "Java: A simple, object-oriented, network-savvy, interpreted, robust, secure, architecture-netural, portable, high-performance, multithreaded, dynamic language."
1995: Oracle: "Java: A simple, object-oriented, network-savvy, interpreted, robust, secure, architecture-netural, portable, high-performance, multithreaded, dynamic language."
===Life Skills===
Life skills track:
* Pay attention and FOCUS
* RTFM
* Follow directions and read carefully
* Whether it's your compiler, or your instructor, or your fellow students - pay attention to what's being said
* Skill will pay off when you start to compile your Java programs


==Section 1.2: Java==
==Section 1.2: Java==


===Materials===
===1.2 Material===


Class
Class
Line 71: Line 62:
==Section 1.3: Syntax Errors==
==Section 1.3: Syntax Errors==


===Material===
===1.3 Material===


Different types of errors:
Different types of errors:
Line 80: Line 71:
==Section 1.4: Procedural Decomposition==
==Section 1.4: Procedural Decomposition==


===Materials===
===1.4 Definitions===
 
* Decomposition
* Iterative enhancement
* Static method
* Method call
* Flow control
 
===1.4 Material===


Decomposing complexity:
Decomposing complexity:
Line 107: Line 106:
* Flow control allows you to abstract away detail
* Flow control allows you to abstract away detail
* Example runtime error
* Example runtime error
===Definitions===
* Decomposition
* Iterative enhancement
* Static method
* Method call
* Flow control
===Life Skills===
Life skills track:
* Cover non-word representations of programs
(Give them a crypto puzzle, but we haven't introduced any crypto or codes just yet)


==Section 1.5 : Case Study with DrawFig==
==Section 1.5 : Case Study with DrawFig==


===Material===
===1.5 Material===


Modularization of drawing program
Modularization of drawing program
Line 134: Line 118:


==Chapter 1 Summary==
==Chapter 1 Summary==
Worksheet: definitions from book on one side (quiz material)
Source code for a procedural program (fizz baz foo bar buzz bam) on the other
There are N bugs, find the N bugs (self-work)
Discuss the program flow with a partner (group work)
How do we represent this program in a clear and concise way?
Transform foo bar into get ready for school - proper names can help clarify understanding
Lecture: broken up into 1.5 parts
* Broad brush-stroke over chapter 1
* Memorize definitions
* Know XYZ for quiz
* Spend a majority of time on in-class exercises
* FOCUS: KNOW HOW TO RUN/SET UP HELLO WORLD
* FOCUS: KNOW DEFINITIONS
* FOCUS: KNOW FUNCTIONS AND PROGRAM FLOW
* FOCUS: KNOW ERRORS/EXCEPTIONS
Quiz/exam/assessment material:
* Hello world, basics, public static void main, syntax
* Definitions matchup
* Functions questions
* Program flow questions
* Exceptions: spot the bug... spot logical errors... spot syntax errors...
Need to make beginnings of class difficult, to send the message that they can't let it slide


===Deliverables===
===Deliverables===
Line 190: Line 143:
* Spotting the error
* Spotting the error
* Red herring: error, plus (unclear) compiler output
* Red herring: error, plus (unclear) compiler output
===Life Skills===
Life skills track:
* Pay attention to details, FOCUS, RTFM, read/follow directions and pay attention to what's being said (instructor, compiler, fellow students)
Section 1.4:
* Drawing and graphical representation of programs
* Non-word representations of programs
===Chapter 1 Notes===
Worksheet:
* Definitions form book on one side (definitions are quiz material)
Source code:
* (procedural programming) program source code on the other (foo bar fizz buzz baz)
In-class worksheets:
* Hand out some source code
* N bugs, find N bugs (self-work)
* Discuss program flow with partner (group work)
* How to represent this program in a clear and concise way?
* If we transform improper names to proper names, may add some sensibility (transform foo bar fizz buzz baz into get ready for school)
Lecture material:
* 1.5 parts, broad brush-stroke over chapter 1, create expectations that they know definitions and material from the book
* EXCLUSIVELY FOCUS ON MATERIAL FROM THE BOOK - they should have no doubt about where material is going to come from
* Majority of time spent on in-class exercises, looking at source code, etc.
Quiz/exam/assessment material:
* Hello world, basics, public static void main, syntax
* Definitions matchup
* Functions questions
* Program flow questions
* Exceptions: spot the bug... spot logical errors... spot syntax errors...
At the beginning: the class will not be "hard," but it will be a lot of work. You need to be reading, memorize definitions, do your homework, etc. Don't let it slide.


==Chapter 1 Code==
==Chapter 1 Code==
Line 195: Line 186:
===Lecture Code===
===Lecture Code===


Exceptions code
Fake rocket code - DrawFig
* Ascii draw a rocket
* From Reges and Stepp
* No patterns/functions until next section
* Cover exceptions
* Tie in with the Java API, let them know it exists and where it is, we'll talk more about it and how to use it in the future
* Tie in with the Java API, let them know it exists and where it is, we'll talk more about it and how to use it in the future


ASCII rocket code
Real rocket code - Vertical (solve a basic equation)
* From Reges and Stepp (no patterns/functions til next section)
 
Real rocket code - Vertical code (solve a basic equation)
* Good to keep math at the forefront. Just throwing it out there.
* Good to keep math at the forefront. Just throwing it out there.


Line 212: Line 204:
* Submitting: Deliverables, what to turn in, what NOT to turn in, what format, how, when, with what
* Submitting: Deliverables, what to turn in, what NOT to turn in, what format, how, when, with what


===Homework Code===
==Chapter 1 Homework==
 
===HW Summary===
 
(Recommended) Self-check problems: #5, #7, #8, #9, #15, #18, #20, #21, #23, #25, #30
 
(Required) Exercises: #5, #9, #14
 
(Required) Projects: #1


(What homework problems?)
===HW Detailed===


Projects:
* Spelling out different letters, one per line, using ascii art


==Chapter 1 Goodies==
==Chapter 1 Goodies==
Line 221: Line 223:
===Profiles===
===Profiles===


Profiles:
* James Gosling - Oracle, tech companies, open source vs. enterprise, hackers vs suits
* James Gosling - Oracle, tech companies, open source vs. enterprise, hackers vs suits
* Grace Hopper
* Grace Hopper
===Quotes===
{{Quote|
A great example of this principle is the Linux operating system, which contains millions of lines of code. It started out as a simple program Linus Torvalds used to explore the Intel 80386 chip. According to Larry Greenfield in The Linux Users' Guide, "One of Linus's earlier projects was a program that would switch between printing AAAA and BBBB. This later evolved into Linux.
- Think Java
}}


===Puzzle 1===
===Puzzle 1===


How the puzzles work: you follow along throughout the course of the quarter, each puzzle leads to the next
How the puzzles work:
* Follow along, we'll cover material you need after the fact
* If you can figure the puzzle out ahead of time, can get extra credit
* If you are having trouble getting started, prior puzzles may provide hints
 
Puzzle 1:
* No points, getting them started
 
Java program encoded with Caesar cipher


Puzzle 1 will be a ROT cipher/Caesar cipher
[[Puzzles/Crypto Level 1/Puzzle 1]]
* Encodes a quote from class, and a secret word: "the secret word is xyz"


=Flags=
=Flags=


{{CSC142Flag}}
{{CSC142Flag}}

Latest revision as of 19:19, 15 September 2016

Chapter 1: Intro to Java

Sections:

1.1 Basic computing concepts

1.2 And now, Java

1.3 Program errors

1.4 Procedural decomposition

1.5 Case study: DrawFigs

Note: the first chapter is definitions-heavy.

Section 1.1: Intro to Java

1.1 Definitions

  • Algorithm
  • Program
  • Hardware ("Hardware: the part of the computer that you can kick")
  • Software
  • Digital
  • Binary
  • Program execution
  • Compiler
  • Java Virtual Machine (JVM)
  • Java Runtime Environment (JRE)

1.1 Material

Things to cover:

  • Java class libraries (standard library)
  • Java programming environment
  • Java Hello World program
  • Console window/command line

1995: Oracle: "Java: A simple, object-oriented, network-savvy, interpreted, robust, secure, architecture-netural, portable, high-performance, multithreaded, dynamic language."

Section 1.2: Java

1.2 Material

Class

  • Every program, all Java code, lives in a class
  • Class header
  • Class methods
  • Statements
  • String literals
  • System.out.println
  • Escape sequences
  • print vs println

Complex example: draw figures

  • ASCII diamond, X, rocket

Code comments, white space, readability:

  • Comments

Section 1.3: Syntax Errors

1.3 Material

Different types of errors:

  • Where the errors happen - the normal process - (code) --> (compiler) --> (bytecode)
  • Errors at compiler level - syntax errors - book lists common syntax errors
  • Errors at code level - bugs - errors in the logic of the program (wrong idea, or right idea but implemented wrong)

Section 1.4: Procedural Decomposition

1.4 Definitions

  • Decomposition
  • Iterative enhancement
  • Static method
  • Method call
  • Flow control

1.4 Material

Decomposing complexity:

  • Decomposition concept: split into functions, tasks, subtasks

C is very verb-oriented, action-oriented

Java is very noun-oriented, object-oriented

Procedural programming:

  • Function-based, action-based programming
  • How to decompose task of baking a cake
  • Static methods (help serve function of.......... functions)

Object oriented programming version:

  • c = new Cake(); c.make()
  • Encapsulating complexity of the object
  • Example in book: drawBox, drawTopX, drawBottX

Flow control

  • How control changes with function calls
  • Objects: with OOP it becomes more complicated to follow the flow of the program
  • Procedural programs and interpreted languages: you just start at the top and go from there
  • Objects: "when is this code actually used?" (have to dive in to see)
  • Learning to follow program flow control
  • Flow control allows you to abstract away detail
  • Example runtime error

Section 1.5 : Case Study with DrawFig

1.5 Material

Modularization of drawing program

  • Breaking into pieces - not just the box, or the x, or the rocket
  • but breaking down into common components, common to all parts of the program
  • Take hello world program...
  • Modularize it, make it reusable...

Chapter 1 Summary

Deliverables

Intro to Java

  • Know how to set up and run hello world
  • How does it work, role of compliler vs editor
  • JRE vs JVM vs JDK
  • Public static void main
  • EEverything is a class
  • Filename = class name
  • Correct syntax, protected keywords

Definitions

  • algorithm, program, hardware/software, digital, binary, program execution, compiler, JVM, JDK, JRE, class header, class methods, statements, string literals, system.out.println, escape chars, print vs println, exception, decomposition, flow control, iterative enhancement, static method

Functions and program flow

  • How to follow the flow of a program through multiple (nested) function calls
  • When to use a static method or static class
  • How to follow a nested program
  • How to break up a task into less complex parts, with reusability
  • Translate between procedure and function

Errors and logical problems

  • Spotting the error
  • Red herring: error, plus (unclear) compiler output

Life Skills

Life skills track:

  • Pay attention to details, FOCUS, RTFM, read/follow directions and pay attention to what's being said (instructor, compiler, fellow students)

Section 1.4:

  • Drawing and graphical representation of programs
  • Non-word representations of programs

Chapter 1 Notes

Worksheet:

  • Definitions form book on one side (definitions are quiz material)

Source code:

  • (procedural programming) program source code on the other (foo bar fizz buzz baz)

In-class worksheets:

  • Hand out some source code
  • N bugs, find N bugs (self-work)
  • Discuss program flow with partner (group work)
  • How to represent this program in a clear and concise way?
  • If we transform improper names to proper names, may add some sensibility (transform foo bar fizz buzz baz into get ready for school)

Lecture material:

  • 1.5 parts, broad brush-stroke over chapter 1, create expectations that they know definitions and material from the book
  • EXCLUSIVELY FOCUS ON MATERIAL FROM THE BOOK - they should have no doubt about where material is going to come from
  • Majority of time spent on in-class exercises, looking at source code, etc.

Quiz/exam/assessment material:

  • Hello world, basics, public static void main, syntax
  • Definitions matchup
  • Functions questions
  • Program flow questions
  • Exceptions: spot the bug... spot logical errors... spot syntax errors...

At the beginning: the class will not be "hard," but it will be a lot of work. You need to be reading, memorize definitions, do your homework, etc. Don't let it slide.

Chapter 1 Code

Lecture Code

Fake rocket code - DrawFig

  • Ascii draw a rocket
  • From Reges and Stepp
  • No patterns/functions until next section
  • Cover exceptions
  • Tie in with the Java API, let them know it exists and where it is, we'll talk more about it and how to use it in the future

Real rocket code - Vertical (solve a basic equation)

  • Good to keep math at the forefront. Just throwing it out there.

Worksheet Code

Density code, DensityConversion code

  • Description: write a program that prints a physical property of your choice for ten different chemical compounds (in metric units). Write another program that prints the physical property of your choice (in English units).
  • Example: Look up densitiy, (g/cm3). Program to print 10 densities, in g/cm3. Then, program to convert to lb/ft3, and print 10 densities, in lb/ft3.
  • Specifications: Your program must print a banner or header that states the physical property. Your program must print the (correct) units of the physical property.
  • Submitting: Deliverables, what to turn in, what NOT to turn in, what format, how, when, with what

Chapter 1 Homework

HW Summary

(Recommended) Self-check problems: #5, #7, #8, #9, #15, #18, #20, #21, #23, #25, #30

(Required) Exercises: #5, #9, #14

(Required) Projects: #1

HW Detailed

Projects:

  • Spelling out different letters, one per line, using ascii art

Chapter 1 Goodies

Profiles

Profiles:

  • James Gosling - Oracle, tech companies, open source vs. enterprise, hackers vs suits
  • Grace Hopper

Quotes


A great example of this principle is the Linux operating system, which contains millions of lines of code. It started out as a simple program Linus Torvalds used to explore the Intel 80386 chip. According to Larry Greenfield in The Linux Users' Guide, "One of Linus's earlier projects was a program that would switch between printing AAAA and BBBB. This later evolved into Linux.

- Think Java


Puzzle 1

How the puzzles work:

  • Follow along, we'll cover material you need after the fact
  • If you can figure the puzzle out ahead of time, can get extra credit
  • If you are having trouble getting started, prior puzzles may provide hints

Puzzle 1:

  • No points, getting them started

Java program encoded with Caesar cipher

Puzzles/Crypto Level 1/Puzzle 1

Flags