CSC 142
From charlesreid1
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
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)
1995: Oracle: "Java: A simple, object-oriented, network-savvy, interpreted, robust, secure, architecture-netural, portable, high-performance, multithreaded, dynamic language."
Things to cover:
- Java class libraries (standard library)
- Java programming environment
- Java Hello World program
- Eclipse editor ("Why can't Java programmers see well?" "Because of the Eclipse.")
- Console window/command line
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
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
Profiles:
- James Gosling - Oracle, tech companies, open source vs. enterprise, hackers vs suits
Section 1.3: Syntax Errors
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)
Pofiles:
- Grace Hopper
Section 1.4: Procedural Decomposition
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
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)