This eBook includes the following formats, accessible from your Account page after purchase:
EPUB The open industry format known for its reflowable content and usability on supported mobile devices.
MOBI The eBook format compatible with the Amazon Kindle and Amazon Kindle applications.
PDF The popular standard, used most often with the free Adobe® Reader® software.
This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.
Master Java 5.0 and TDD Together: Build More Robust, Professional Software
Master Java 5.0, object-oriented design, and Test-Driven Development (TDD) by learning them together. Agile Java weaves all three into a single coherent approach to building professional, robust software systems. Jeff Langr shows exactly how Java and TDD integrate throughout the entire development lifecycle, helping you leverage today's fastest, most efficient development techniques from the very outset.
Langr writes for every programmer, even those with little or no experience with Java, object-oriented development, or agile methods. He shows how to translate oral requirements into practical tests, and then how to use those tests to create reliable, high-performance Java code that solves real problems. Agile Java doesn't just teach the core features of the Java language: it presents coded test examples for each of them. This TDD-centered approach doesn't just lead to better code: it provides powerful feedback that will help you learn Java far more rapidly. The use of TDD as a learning mechanism is a landmark departure from conventional teaching techniques.
Presents an expert overview of TDD and agile programming techniques from the Java developer's perspective
Brings together practical best practices for Java, TDD, and OO design
Walks through setting up Java 5.0 and writing your first program
Covers all the basics, including strings, packages, and more
Simplifies object-oriented concepts, including classes, interfaces, polymorphism, and inheritance
Contains detailed chapters on exceptions and logging, math, I/O, reflection, multithreading, and Swing
Offers seamlessly-integrated explanations of Java 5.0's key innovations, from generics to annotations
Shows how TDD impacts system design, and vice versa
Complements any agile or traditional methodology, including Extreme Programming (XP)
© Copyright Pearson Education. All rights reserved.
About the Author.
Who Is This Book For?
What This Book Is Not
How to Use This Book
Conventions Used in This Book
An Agile Overview.
What Is “Agile?”
What Is Java?
What Is an Object?
What Are Classes?
What Is Inheritance?
Why Test-Driven Development?
Software You’ll Need
Does It Work?
Compiling Hello World
Executing Hello World
Lesson 1: Getting Started.
A Simple Test
Adding a Test
Creating a Student
Creating the Student Class
Returning a Value from a Method
Summarizing the Test
Lesson 2: Java Basics.
The SDK and java.util.ArrayList
Objects in Memory
Packages and the import Statement
The java.lang Package
The Default Package and the package Statement
The setup Method
Creating Dates with Calendar
Lesson 3: Strings and Packages.
Characters and Strings
Looping Through All Students
Lesson 4: Class Methods and Fields.
Operating on Class Variables with Class Methods
Using Statics: Various Notes
Jeff’s Rule of Statics
Tests as Documentation
More on Initialization
Revisiting Primitive-Type Field Initialization
Lesson 5: Interfaces and Polymorphism.
Sorting on Department and Number
The if Statement
Using Interface References
ArrayList and the List Interface
Lesson 6: Inheritance.
The switch Statement
Case Labels Are Just Labels
Enhancing the Grade Enum
Summer Course Sessions
Calling Superclass Constructors
More on Constructors
Inheritance and Polymorphism
The Principle of Subcontracting
Lesson 7: Legacy Elements.
Breaking Up a Student’s Name
The while Loop
Comparing Java Loops
Looping Control Statements
The Ternary Operator
Iterators and the for-each Loop
Lesson 8: Exceptions and Logging.
Dealing With Exceptions
Creating Your Own Exception Type
Checked Exceptions vs. Unchecked Exceptions
Catching Multiple Exceptions
The finally Block
Logging in Java
Logging to Files
Testing Philosophy for Logging
More on FileHandler
Additional Notes on Logging
Lesson 9: Maps and Equality.
The Contract for Equality
Apples and Oranges
Collections and Equality
An Ideal Hash Algorithm
A Final Note on hashCode
More on Using HashMaps
Additional Hash Tables and Set Implementations
Strings and Equality
Lesson 10: Mathematics.
More on Primitive Numerics
Expression Evaluation Order
Numeric Wrapper Classes
Lesson 11: IO.
Writing to a File
Byte Streams and Conversion
A Student User Interface
Testing the Application
Random Access Files
The Student Directory
Static Nested Classes and Inner Classes
Developing the Solution
Lesson 12: Reflection and Other Advanced Topics.
Mock Objects Revisited
The Jim Bob ACH Interface
The Mock Class
The Account Class Implementation
Anonymous Inner Classes
Accessing Variables from the Enclosing Class
Using JUnit Code
The Class Class
Building the Suite
A Secure Account Class
Building the Secure Account Solution
The SecureProxy Class
Problems With Reflection
Lesson 13: Mulithreading.
The Search Class
Less Dependent Testing
Waiting in the Test
Creating and Running Threads
Cooperative and Preemptive Multitasking
Creating Threads with Runnable
Additional Notes on wait and notify
Locks and Conditions
The Timer Class
Summary: Basic Design Principles for Synchronization
Lesson 14: Generics.
Multiple Type Parameters
Creating Parameterized Types
Implications of Using Wildcards
Lesson 15: Assertions and Annotations.
The assert Statement vs. JUnit Assert Methods
Building a Testing Tool
The @TestMethod Annotation
Skipping Test Methods
A TestRunner User Interface Class
Multiple Parameter Annotations
Additional Return Types and Complex Annotation Types
Additional Notes on Annotations
Additional Lesson I: Swing, Part 1.
Swing Application Design
Button Clicks and ActionListeners
Additional Lesson II: Swing, Part 2.
Additional Lesson III: Java Miscellany.
Cloning and Covariance
Call by Reference versus Call by Value
What Else Is There?
Appendix A: An Agile Java Glossary.
Appendix B: Java Operator Precedence Rules.
Appendix C: Getting Started with IDEA.
The Hello Project
Taking Advantage of IDEA
Agile Java References.