Unit 0 Introduction: About This Course¶
Unit 1 Inheritance and Polymorphism¶
- 1.1. Getting Started
- 1.1.1. Introducing LightBot
- 1.1.2. From LightBot to Micro Worlds
- 1.1.3. Self Check: Micro-Worlds
- 1.1.4. A Bit More LightBot
- 1.1.5. Textually Representing Programs
- 1.1.6. Self-Check: Turning Micro-Worlds into Code
- 1.1.7. What Does LightBot Say About Programming?
- 1.1.8. A Programmable LightBot in Java
- 1.1.9. Syntax Practice 1a
- 1.1.10. Creating New Objects
- 1.1.11. Calling Methods on an Object
- 1.1.12. Putting it All Together
- 1.1.13. A Word on Making Code Easy to Read
- 1.1.14. Syntax Practice 1b
- 1.1.15. Programming Practice 1
- 1.1.16. Check Your Understanding
- 1.2. Unit 1 Lab 1 Placeholder
- 1.3. Inheritance and Polymorphism: Subclasses and Methods
- 1.3.1. The Jeroos of Santong Island
- 1.3.2. Class Hierarchy and Inheritance
- 1.3.3. Summarizing: What is Inheritance?
- 1.3.4. Syntax Practice 2a: Jeroo Methods
- 1.3.5. Problem Solving and Algorithms
- 1.3.6. Creating and Using Jeroo Methods
- 1.3.7. What is Polymorphism?
- 1.3.8. Syntax Practice 2b: Subclass Constructors
- 1.3.9. Syntax Practice 2c: More Subclass Constructors
- 1.3.10. Programming Practice 2
- 1.3.11. Check Your Understanding
- 1.4. Unit 1 Lab 2 Placeholder
Unit 2 Conditionals and Software Testing¶
- 2.1. Conditional and Repeating Actions
- 2.1.1. Selection
- 2.1.2. Conditions Using Sensor Methods
- 2.1.3. An Overview of Conditional Statements
- 2.1.4. Java’s Syntax for the If-Then-Else Structure
- 2.1.5. Syntax Practice 3a: If-Then-Else
- 2.1.6. Creating Optional Statements With If-then
- 2.1.7. Java’s Syntax for the If-then Structure
- 2.1.8. Syntax Practice 3b: If-Then
- 2.1.9. Java’s Syntax for the Multi-way Selection Structure (a cascaded if)
- 2.1.10. Syntax Practice 3c: Multi-way If
- 2.1.11. Compound Conditions
- 2.1.12. Syntax Practice 3d: Compound Conditions
- 2.1.13. Repeating Actions
- 2.1.14. Generic Repetition Structures
- 2.1.15. Java’s Syntax for the While Loop
- 2.1.16. Syntax Practice 3e: While Loops
- 2.1.17. Programming Practice 3
- 2.1.18. Check Your Understanding
- 2.2. Unit 2 Lab 1 Placeholder
- 2.3. Software Testing
- 2.3.1. What Is Software Testing?
- 2.3.2. Writing Your First Software Test
- 2.3.3. Check Your Understanding: Software Testing Concepts
- 2.3.4. More About Methods
- 2.3.5. Check Your Understanding: Method Signatures
- 2.3.6. Check Your Understanding: Methods with Parameters
- 2.3.7. Good Habits for Conditionals
- 2.3.8. A Different Type of Complex If-Statement
- 2.3.9. Short Circuit Evaluation
- 2.3.10. Check Your Understanding: Logical Equivalence
- 2.3.11. Syntax Practice 4a: Compound Conditionals
- 2.3.12. Syntax Practice 4b: Conditionals and Relational Operators
- 2.3.13. Programming Practice 4
- 2.3.14. Module Review
- 2.4. Unit 2 Lab 2 Placeholder
Unit 3 Variables and For-each Loops¶
- 3.1. Variables, Fields, and Parameters
- 3.1.1. Variables
- 3.1.2. Check Your Understanding: Variables
- 3.1.3. Fields Versus Local Variables
- 3.1.4. Changing Private Variables: Mutator Methods
- 3.1.5. Check your Understanding: Scope
- 3.1.6. Accessor Methods
- 3.1.7. Check Your Understanding: Fields, Getters and Setters
- 3.1.8. Syntax Practice 5a: Fields and Accessors
- 3.1.9. The Return Keyword
- 3.1.10. Check your Understanding: Typed Methods and Return Statements
- 3.1.11. Syntax Practice 5b: Mutators and Return Statements
- 3.1.12. Using Fields in Testing
- 3.1.13. Programming Practice 5a
- 3.1.14. Programming Practice 5b
- 3.2. Unit 3 Lab 1 Placeholder
- 3.3. Pictures and For-each Loops
- 3.4. Unit 4 Lab 2 Placeholder
Unit 4 More Lists, Loops, Arrays and Grouping¶
- 4.1. Aggregation, Strings and More Loops
- 4.1.1. Object-Oriented Design: Aggregation, Composition, and Delegation
- 4.1.2. Strings and Characters
- 4.1.3. Check Your Understanding: Strings
- 4.1.4. Counter-controlled Loops
- 4.1.5. Check Your Understanding: Counter Controlled Loops
- 4.1.6. Tips on Random Numbers
- 4.1.7. Check Your Understanding: Random Numbers
- 4.1.8. Method Overriding
- 4.1.9. Check Your Understanding: Method Overriding
- 4.1.10. Syntax Practice 7a: For Loops and OO Design
- 4.1.11. Syntax Practice 7b: toString and Returning Values
- 4.1.12. Programming Practice 7a
- 4.1.13. Programming Practice 7b
- 4.2. Unit 4 Lab 1 Placeholder
- 4.3. Grouping Objects Using Lists, Nested For Loops, and Looping Idioms
- 4.3.1. Collections of Objects
- 4.3.2. Interfaces
- 4.3.3. Check Your Understanding: Interfaces
- 4.3.4. Syntax Practice 8a: Strings
- 4.3.5. The List Interface
- 4.3.6. Generics
- 4.3.7. ArrayList
- 4.3.8. Check Your Understanding: ArrayLists
- 4.3.9. Syntax Practice 8b: Lists
- 4.3.10. Nested For Loops
- 4.3.11. Check Your Understanding: Nested For Loops
- 4.3.12. Syntax Practice 8c: Nested Loops
- 4.3.13. Check Your Understanding
- 4.3.14. Programming Practice 8a
- 4.3.15. Programming Practice 8b
- 4.3.16. Modeling the Contents of a Library
- 4.3.17. Looping Idioms
- 4.3.18. Check Your Understanding: Loop Idioms
- 4.3.19. Syntax Practice 9a: Loop Idioms
- 4.3.20. Generics Revisited
- 4.3.21. Check Your Understanding: Generics
- 4.3.22. Syntax Practice 9b: Generics
- 4.3.23. The Null Keyword
- 4.3.24. Diagnosing a Null Pointer Exception
- 4.3.25. Check Your Understanding: Null
- 4.3.26. Programming Practice 9a: Loop Idioms
- 4.3.27. Programming Practice 9b: Loops and Generics
- 4.4. Unit 4 Lab 2 Placeholder
Unit 5 More Loops and Arrays¶
- 5.1. Arrays
- 5.1.1. Creating An Array
- 5.1.2. Accessing Items in Arrays
- 5.1.3. Setting Items in an Array
- 5.1.4. Arrays Compared to Lists (or ArrayList)
- 5.1.5. Putting It All Together
- 5.1.6. Check Your Understanding: Arrays
- 5.1.7. Syntax Practice 10a
- 5.1.8. Iterating Over Arrays
- 5.1.9. Check Your Understanding: Iterating with Arrays
- 5.1.10. Syntax Practice 10b
- 5.1.11. Initializing Array Contents
- 5.1.12. Printing Arrays
- 5.1.13. Copying Array Variables
- 5.1.14. Naming Array Variables
- 5.1.15. Writing Test Assertions Involving Arrays
- 5.1.16. Applying Arrays in a Problem
- 5.1.17. Syntax Practice 10c
- 5.1.18. Check Your Understanding
- 5.1.19. Programming Practice 10a
- 5.1.20. Programming Practice 10b
- 5.2. Unit 5 Lab 1 Placeholder
- 5.3. Multi-dimensional Arrays
- 5.3.1. Dimensions in an Array
- 5.3.2. Check Your Understanding: 2D Arrays
- 5.3.3. Syntax Practice: 2D Array Basics
- 5.3.4. Iterating through a 2D Array
- 5.3.5. Check Your Understanding: Iterating with 2D Arrays
- 5.3.6. Syntax Practice: Looping Over 2D Arrays
- 5.3.7. Multi-Dimensional Arrays
- 5.3.8. Syntax Practice: 3D Arrays
- 5.3.9. But Can You Have Multi-dimensional Lists?
- 5.3.10. Integer Division and Modulus
- 5.3.11. Check Your Understanding: Modulus
- 5.3.12. Syntax Practice: Modulus
- 5.3.13. Programming Practice: Multi-dimensional Arrays
- 5.3.14. Programming Practice: Mod
- 5.4. Unit 5 Lab 2 Placeholder
Unit 6 Multi-Dimensional Arrays, File I/O and Sets¶
- 6.1. Variable Scoping, Input, Output, and Exceptions
- 6.1.1. Variable Scoping
- 6.1.2. Summarizing Scope Concepts
- 6.1.3. Check Your Understanding: Scope
- 6.1.4. Syntax Practice: Scoping
- 6.1.5. Java Input and Output
- 6.1.6. Output Using PrintWriters
- 6.1.7. Check Your Understanding: Output
- 6.1.8. Input Using Scanners
- 6.1.9. A Complete Input Example
- 6.1.10. Check Your Understanding: Input
- 6.1.11. A Complete Input/Output Example
- 6.1.12. Testing I/O-based Operations
- 6.1.13. Check Your Understanding: Testing
- 6.1.14. The Main Method
- 6.1.15. Check Your Understanding: Main Methods
- 6.1.16. The Static Keyword
- 6.1.17. Check Your Understanding: The Static Keyword
- 6.1.18. Errors
- 6.1.19. Throwing Exceptions
- 6.1.20. Check Your Understanding: Throwing Exceptions
- 6.1.21. Syntax Practice: Throwing Exceptions
- 6.1.22. Try/Catch Blocks
- 6.1.23. Check Your Understanding: Try/Catch Blocks
- 6.1.24. Syntax Practice: Try-Catch Blocks
- 6.2. Unit 6 Lab 1 Placeholder
- 6.3. Maps and Sets
- 6.3.1. The Map and Set Interfaces
- 6.3.2. The Map Interface
- 6.3.3. Syntax Practice: Making Maps
- 6.3.4. Adding and Accessing Pairs in a Map
- 6.3.5. Syntax Practice: Adding to Maps
- 6.3.6. Checking for and Removing Pairs in a Map
- 6.3.7. A Visual Summary of Using Map and HashMap
- 6.3.8. Syntax Practice: Map Contains and Remove
- 6.3.9. Looping Over Map Contents
- 6.3.10. Check Your Understanding: Maps
- 6.3.11. The Set Interface
- 6.3.12. Syntax Practice: Making A Set
- 6.3.13. Adding Values to a Set
- 6.3.14. Syntax Practice: Adding to a Set
- 6.3.15. Checking Values in a Set
- 6.3.16. Syntax Practice: Set Contains
- 6.3.17. Removing Values from a Set
- 6.3.18. Syntax Practice: Set Remove
- 6.3.19. Looping Over Sets
- 6.3.20. Check Your Understanding: Sets
- 6.3.21. Programming Practice: Maps
- 6.4. Unit 6 Lab 2 Placeholder
Unit 7 Testing and Exceptions¶
- 7.1. Revisit Java Unit Testing
- 7.2. More on Exceptions
- 7.2.1. Objectives
- 7.2.2. Interactive: Exception Handling [9:31]
- 7.2.3. Reflecting on Checked and Runtime(Unchecked) Exceptions
- 7.2.4. Checkpoint 1
- 7.2.5. Interactive: Exception Handling with try, catch, and finally [7:16]
- 7.2.6. Handling the Exception Later on with throws
- 7.2.7. Exception Handling Examples - Basic to Complex
- 7.2.8. Implementing and Testing Exceptions
- 7.2.9. Checkpoint 2
- 7.3. Objects, Enums, and UML Diagrams
- 7.4. More on Polymorphism
- 7.4.1. Objectives
- 7.4.2. Interactive: Polymorphism Measurable Interface [7:23]
- 7.4.3. Checkpoint 1
- 7.4.4. Programming Practice: Polymorphism 1
- 7.4.5. Interactive: Polymorphism Computer Superclass [12:09]
- 7.4.6. Checkpoint 2
- 7.4.7. Interactive: Polymorphism Integer Example [7:40]
- 7.4.8. Checkpoint 3
- 7.4.9. Programming Practice: Polymorphism 2
- 7.5. Unit 7 Lab 1 Placeholder
- 7.6. Style and Documentation
- 7.7. Bags
- 7.7.1. Objectives
- 7.7.2. Introduction to Bags
- 7.7.3. Documentation of Bag Interface methods
- 7.7.4. Interactive: Documentation of Bag Interface Methods [7:28]
- 7.7.5. Interactive: Using Bags [4:34]
- 7.7.6. Checkpoint 1
- 7.7.7. Programming Practice: ArrayBags
- 7.7.8. Array Implementation of Bags
- 7.7.9. Checkpoint 2
- 7.7.10. Demo More bag method implementation
- 7.7.11. Checkpoint 3
- 7.7.12. Methods that Remove and Design Improvement Lesson and Demo
- 7.7.13. Checkpoint 4
- 7.7.14. Interactive: Array resizing description and coding Demo [14:47]
- 7.7.15. Tradeoffs of using an array implementation for a bag
- 7.7.16. Programming Practice: The Bag Interface
- 7.8. Unit 7 Lab 2 Placeholder
- 7.9. Unit 7 Lab 3 Placeholder
Unit 8 Linked Lists, Bags, Stacks, and Efficiency¶
- 8.1. Linked Chains (Pointers)
- 8.2. Linked Bags
- 8.2.1. Objectives
- 8.2.2. Interactive: Introduction to Linked Bags [4:10]
- 8.2.3. Interactive: LinkedBag add() and toArray() [12:45]
- 8.2.4. Checkpoint 1
- 8.2.5. Interactive: ExLinkedBagJUnit Demonstration [7:14]
- 8.2.6. Interactive: LinkedBag getFrequencyOf() and contains() [14:00]
- 8.2.7. Checkpoint 2
- 8.2.8. Interactive: LinkedBag Removing an item [13:44]
- 8.2.9. Checkpoint 3
- 8.2.10. Wrapping up Bags
- 8.2.11. Programming Practice: LinkedBags
- 8.3. Unit 8 Program 1 Placeholder
- 8.4. Efficiency
- 8.5. Stacks
- 8.5.1. Objectives
- 8.5.2. Introduction to Stacks [11:32]
- 8.5.3. Checkpoint 1
- 8.5.4. StackIntroVideoMemory Example [6:25]
- 8.5.5. Checkpoint 2
- 8.5.6. Stacks Array-Based Design [4:57]
- 8.5.7. Checkpoint 3
- 8.5.8. Stacks Array Implementation
- 8.5.9. Stacks Linked Chain Implementation [12:50]
- 8.5.10. Checkpoint 4
- 8.5.11. Programming Practice: LinkedStacks
- 8.6. Unit 8 Lab 1 Placeholder
- 8.7. Unit 8 Lab 2 Placeholder
Unit 9 Recursion and Software Design¶
- 9.1. Recursion
- 9.1.1. Objectives
- 9.1.2. Introduction to Recursion
- 9.1.3. Checkpoint 1
- 9.1.4. Interactive: More Recursion : Factorial Examples [12:36]
- 9.1.5. Programming Practice: Recursion 1
- 9.1.6. Interactive: Recursion on Arrays: Display an Array
- 9.1.7. Checkpoint 2
- 9.1.8. Interactive: Recursion on Arrays: Display the Middle of an Array [9:53]
- 9.1.9. Checkpoint 3
- 9.1.10. Programming Practice: Recursion 2
- 9.1.11. Interactive: Recursion on Linked Chains [7:41]
- 9.1.12. Interactive: Tower of Hanoi [11:44]
- 9.1.13. Checkpoint 4
- 9.1.14. Interactive: Recursion Wrap Up [8:28]
- 9.1.15. Programming Practice: Recursion 3
- 9.1.16. Forward Flow Tracing Exercises
- 9.1.17. Backward Flow Tracing Exercises
- 9.1.18. Find Error Tracing Exercises
- 9.1.19. Two Recursive Calls Tracing Exercises
- 9.1.20. How Many Times Tracing Exercises
- 9.1.21. Harder Tracing Exercises
- 9.2. Software Design and MVC
- 9.2.1. Objectives
- 9.2.2. Interactive: Introduction to Software Design [9:30]
- 9.2.3. Functional and non-functional requirements
- 9.2.4. Checkpoint 1
- 9.2.5. Identifying classes, fields, and methods
- 9.2.6. Design Activity: Case Study e-Commerce solution (online storefront) for ABC Ltd
- 9.2.7. Identifying relationships, hierarchies, and opportunities for reuse
- 9.2.8. Design Activity: Determine Relationships between Classes
- 9.2.9. Checkpoint 2
- 9.2.10. Intro to Design Patterns and MVC
- 9.2.11. Interactive: MVC and Observer Video [11:00]
- 9.2.12. MVC Example AddressBook
- 9.2.13. Design Review: Case Study - e-Commerce solution (online storefront) for ABC Ltd.
- 9.2.14. Design Review: Case Study - Vending Machine
- 9.3. Unit 9 Program 1 Placeholder
Unit 10 Queues and Generics¶
- 10.1. More on Generics
- 10.2. Queues
- 10.2.1. Objectives
- 10.2.2. Interactive: Introduction to Queues [8:50]
- 10.2.3. Checkpoint 1
- 10.2.4. Programming Practice: Queues 1
- 10.2.5. Interactive: Linked Queues Intro and Enqueue [11:29]
- 10.2.6. Checkpoint 2
- 10.2.7. Interactive: Linked Queues Removing and More (Dequeue and Other Methods) [8:41]
- 10.2.8. Checkpoint 3
- 10.2.9. Interactive: Introduction to Deque [13:51]
- 10.2.10. Checkpoint 4
- 10.2.11. Interactive: Deque Removing and Wrap Up [9:02]
- 10.2.12. Checkpoint 5
- 10.2.13. Interactive: ArrayQueue: Array Implementation of Queues [11:08]
- 10.2.14. Checkpoint 6
- 10.2.15. Interactive: ArrayQueue: One Unused Location [7:11]
- 10.2.16. Checkpoint 7
- 10.2.17. Interactive: ArrayQueue: Ensure Capacity [14:06]
- 10.2.18. Checkpoint 8
- 10.2.19. Interactive: ArrayQueue WrapUp [6:59]
- 10.2.20. Programming Practice: Queues 2
- 10.3. Unit 10 Lab 1 Placeholder
Unit 11 Lists and Iterators¶
- 11.1. Lists
- 11.1.1. Overview & Objectives
- 11.1.2. Introduction to Lists [13:41]
- 11.1.3. Checkpoint 1
- 11.1.4. Interactive: LinkedList Add() Implementation [10:21]
- 11.1.5. Checkpoint 2
- 11.1.6. Interactive: Tracing Add() with Debugger [13:33]
- 11.1.7. Interactive: LinkedList Remove() [18:09]
- 11.1.8. Checkpoint 3
- 11.1.9. Programming Practice: Lists 1
- 11.1.10. Interactive: LinkedList Details and Options [10:19]
- 11.1.11. Checkpoint 4
- 11.1.12. Interactive: An Array Implementation of a List [15:48]
- 11.1.13. Programming Practice: Lists 2
- 11.2. Unit 11 Lab 1 Placeholder
- 11.3. Iterators
- 11.3.1. Objectives
- 11.3.2. Introduction to Iterators [13:14]
- 11.3.3. Checkpoint 1
- 11.3.4. Programming Using the Iterable Interface [4:36]
- 11.3.5. Checkpoint 2
- 11.3.6. Programming Using Iterators [18:02]
- 11.3.7. Checkpoint 3
- 11.3.8. Iterator Design Decisions [8:21]
- 11.3.9. Inner Iterator for ex11.3-Iterator
- 11.3.10. Programming Practice: Iterators
- 11.4. Unit 11 Lab 2 Placeholder
Unit 12 Comparing, Sorting and Binary Search¶
- 12.1. Comparing and Sorting
- 12.1.1. Objectives
- 12.1.2. Introduction to Ordering, Comparing, and Sorting [13:39]
- 12.1.3. Checkpoint 1
- 12.1.4. Interactive: Introduction to Sorting [12:51]
- 12.1.5. Checkpoint 2
- 12.1.6. Interactive: Selection Sort [12:36]
- 12.1.7. Checkpoint 3
- 12.1.8. Insertion Sort with an Array
- 12.1.9. Checkpoint 4
- 12.1.10. Insertion Sort with a Linked Chain [16:50]
- 12.1.11. Checkpoint 5
- 12.1.12. Programming Practice: Insertion Sort
- 12.1.13. Introduction to Comparators [11:22]
- 12.1.14. Programming Practice: Comparators
- 12.2. Binary Search
- 12.3. Unit 12 Program 1 Placeholder
Unit 13 Reference¶
- 13.1. Downloading and Setting up your lab in Eclipse
- 13.2. Importing and Using Downloaded Examples in Eclipse
- 13.3. Writing JUnit Tests with student.TestCase
- 13.3.1. Use JUnit
- 13.3.2. Run a JUnit Test
- 13.3.3. Naming Conventions
- 13.3.4. Instance Variables
- 13.3.5. setUp Method
- 13.3.6. tearDown Method (Optional)
- 13.3.7. Code coverage
- 13.3.8. Testing Exceptions
- 13.3.9. General Unit Testing Tips
- 13.3.10. Testing methods by passing null params
- 13.3.11. I/O Testing Tips
- 13.4. Java I/O tutorial
- 13.4.1. Files and Stream-based Input and Output
- 13.4.2. Basic Input and Output Concepts
- 13.4.3. Opening a Stream for Output
- 13.4.4. Writing to an Output Stream
- 13.4.5. Closing a Stream
- 13.4.6. A Complete Output Example
- 13.4.7. Output with System.out
- 13.4.8. Opening a Stream for Input
- 13.4.9. Reading from an Input Stream
- 13.4.10. A Complete Input Example
- 13.4.11. A Complete Input/Output Example
- 13.4.12. Testing I/O-based Operations
- 13.4.13. Dealing with Exceptions
- 13.5. Commenting guidelines
- 13.6. Tips on Random Numbers