| |
| |
About the Author | |
| |
| |
Foreword | |
| |
| |
Acknowledgments | |
| |
| |
Introduction | |
| |
| |
Who Is This Book For? | |
| |
| |
What This Book Is Not How to Use | |
| |
| |
This Book Exercises Conventions Used in This Book | |
| |
| |
An Agile Overview | |
| |
| |
What Is "Agile?" | |
| |
| |
What Is Java? | |
| |
| |
Why OO? | |
| |
| |
What Is an Object? | |
| |
| |
What Are Classes? | |
| |
| |
Why UML? | |
| |
| |
What Is Inheritance? | |
| |
| |
Why Test-Driven Development? | |
| |
| |
Setting Up | |
| |
| |
Software You''ll Need Does It Work? | |
| |
| |
Compiling Hello World Executing Hello World Still Stuck? | |
| |
| |
| |
Getting Started | |
| |
| |
Testing Design A Simple Test Junit | |
| |
| |
Adding a Test Creating a Student | |
| |
| |
Creating the Student Class Constructors | |
| |
| |
Local Variables Returning a Value from a Method | |
| |
| |
Assertions Instance Variables | |
| |
| |
Summarizing the Test Refactoring this private | |
| |
| |
Naming Conventions Whitespace | |
| |
| |
Exercises | |
| |
| |
| |
Java Basics | |
| |
| |
CourseSession Enrolling Students int Initialization | |
| |
| |
Default Constructors Suites | |
| |
| |
The SDK and java.util.ArrayList | |
| |
| |
Adding Objects Incremental Refactoring | |
| |
| |
Objects in Memory Packages and the import Statement | |
| |
| |
The java.lang Package | |
| |
| |
The Default Package and the package Statement | |
| |
| |
The setup Method More Refactoring Class | |
| |
| |
Constants Dates Overload Constructors | |
| |
| |
Deprecation Warnings Refactoring Creating Dates with Calendar | |
| |
| |
Comments Javadoc Comments | |
| |
| |
Exercises | |
| |
| |
| |
Strings and Packages | |
| |
| |
Characters and Strings Strings String | |
| |
| |
Builder System Properties | |
| |
| |
Looping Through All Students Single-Responsibility | |
| |
| |
Principle Refactoring System.out | |
| |
| |
Using System.out Refactoring Package | |
| |
| |
Structure Access Modifiers Using Ant | |
| |
| |
Exercises | |
| |
| |
| |
Class Methods and Fields | |
| |
| |
Class Methods Class Variables | |
| |
| |
Operating on Class Variables with Class Methods | |
| |
| |
Static Import Incrementing Factory Methods | |
| |
| |
Simple Design Static Dangers | |
| |
| |
Using Statics: Various Notes | |
| |
| |
Jeff''s Rule of Statics Booleans Tests as Documentation | |
| |
| |
More on Initialization Exceptions Revisiting | |
| |
| |
Primitive-Type Field Initialization | |
| |
| |
Exercises | |
| |
| |
| |
Interfaces and Polymorphism | |
| |
| |
Sorting: Preparation Sorting: Collections.sort | |
| |
| |
Course Report Test Interfaces | |
| |
| |
Why Interfaces Implementing Comparable | |
| |
| |
Sorting on Department and Number | |
| |
| |
The if Statement Grading Students | |
| |
| |
Floating-Point Numbers Testing | |
| |
| |
Grades Refactoring Enums Polymorphism | |
| |
| |
Using Interface | |
| |
| |
References | |
| |
| |
ArrayList and the List Interface | |
| |
| |
Exercises | |
| |
| |
| |
Inheritance | |
| |
| |
The switch Statement Case Labels | |
| |
| |
Are Just Labels Maps Inheritance Abstract Classes | |
| |
| |
Extending Methods Refactoring | |
| |
| |
Enhancing the Grade Enum Summer Course | |
| |
| |
Sessions Calling Superclass Constructors Refactoring | |
| |
| |
More on Constructors Inheritance and Polymorphism | |
| |
| |
The Principle of Subcontracting | |
| |
| |
Exercises | |
| |
| |
| |
Legacy Elements | |
| |
| |
Looping Constructs Breaking Up a Student''s Name | |
| |
| |
The while Loop Comparing Java Loops | |
| |
| |
Refactoring Looping Control Statements | |
| |
| |
The Ternary Operator Legacy Collections Iterators | |
| |
| |
Iterators and the for-each Loop Casting | |
| |
| |
Wrapper Classes Arrays Refactoring | |
| |
| |
Exercises | |
| |
| |
| |
Exceptions and Logging | |
| |
| |
Exceptions Dealing With Exceptions | |
| |
| |
Checked Exceptions | |
| |
| |
Exception Hierarchy Creating | |
| |
| |
Your Own Exception Type Checked Exceptions vs. Unchecked | |
| |
| |
Exceptions Messages Catching Multiple | |
| |
| |
Exceptions Rethrowing | |
| |
| |
Exceptions Stack Traces | |
| |
| |
The finally Block Refactoring Logging | |
| |
| |
Logging in Java Testing Logging | |
| |
| |
Logging to Files Testing Philosophy for Logging | |
| |
| |
More on File Handler Logging Levels Logging | |
| |
| |
Hierarchies Additional Notes on Logging | |
| |
| |
Exercises | |
| |
| |
| |
Maps and Equality | |
| |
| |
Logical Operators Short-Circuiting Hash Tables Courses | |
| |
| |
Refactoring Session Equality | |
| |
| |
The Contract for Equality Apples and Oranges | |
| |
| |
Collections and Equality Hash Tables | |
| |
| |
Collisions An Ideal Hash Algorithm | |
| |
| |
A Final Note on hashCode | |
| |
| |
More on Using HashMaps | |
| |
| |
Additional Hash Tables and Set Implementations toString | |
| |
| |
Strings and Equality | |
| |
| |
Exercises | |
| |
| |
| |
Mathematics | |
| |
| |
BigDecimal More on Primitive Numerics | |
| |
| |
Integer Math Numeric Casting Expression | |
| |
| |
Evaluation Order NaN Infinity Numeric | |
| |
| |
Overflow Bit Manipulation Java.lang.Math Numeric | |
| |
| |
Wrapper Classes Random Numbers | |
| |
| |
Exercises | |
| |
| |
| |
IO. Organization Character Streams | |
| |
| |
Writing to a File Java.io.File | |
| |
| |
Byte Streams and Conversion | |
| |
| |
A Student User Interface Testing the Application | |
| |
| |
Data Streams Course | |