Session Details
Week 1,
Session 3 — Thu Mar 10
Reading
-
Big Java, §2.8–2.10
-
First two pages of this intro to UML Class Diagrams
-
Big Java, §3.1–3.8, Pay particular attention to §3.8
HW Due
-
HW 2
Topics
-
Unit tests with JUnit
-
Object references
-
Object-Oriented Encapsulation
-
Implementing Classes in Java
- Fields, Constructors, Methods
- Implementing an Interface
- Documented Stubs
- Test-first Programming, JUnit tests
Resources
-
Slides
Outline
-
[5] Questions
-
[5] Javadoc Recap
-
[15] Unit testing with JUnit. Examine JUnitMoveTester in JavadocsAndUnitTesting project.
-
[20] JUnit exercise: create and implement StringMethodsPracticeTest in JavadocsAndUnitTesting project.
-
[10] Object references, assignment, box and pointer diagrams
-
[5 min] OO encapsulation
-
[5 min] Break
-
[15 min] Java classes. Live coding on implementing a class: implement Shouter and add a test to ShouterTest in the WordGames project, as specified in the WordGames instructions.
- Fields, Constructors, Methods
- Overloading
- Visibility (public, private)
- Public Interface vs. Private Implementation
- The this Keyword: Implicit vs. Explicit Parameters
- Fields vs. Parameters vs. Local Variables
- Implementing an Interface
- Using Documented Stubs
- Test-first Programming, JUnit tests
-
[15 min] More live coding on implementing a class: implement Censor and add a test to CensorTest in the WordGames project, as specified in the WordGames instructions.
- Fields: when you need one, how you declare one, how you initialize one
- Constructors: writing and calling
-
[10 min] Begin homework (continue working per the WordGames instructions).
HW Assigned
-
HW 3