Developing Java Software, 3rd Edition
November 2006, ©2006
The encouragement of the proper creation and use of classes, and the demonstration of the strategies used to create good quality code are at the core of this book. You will learn how Java programs work and how they can be designed and implemented in an organized and systematic way. In addition, the book addresses how a Java programming project should be managed and introduces the Ant build tool and the Subversion version control system.
Testing has always been an important part of Developing Java Software. This edition provides new chapters which give a detailed introduction to Test-driven Development (TDD). This approach to programming introduces more rigor to writing programs by placing emphasis on writing high quality testable and tested code from the outset. A series of examples and case studies shows how TDD works and highlights the strategies for testing code.
Reflecting recent changes to the Java programming language and newly focused on first courses in programming, this excellent primer is ideal for classroom use or self-study. The many motivating examples and larger case studies show how core ideas can be applied when creating real applications, and show how to use object-oriented methods effectively to create robust, reliable, and fully-tested Java applications.
Part 1 Programming with Objects and Classes.
1.1 The Start.
1.2 A (Very!) Short History of Java.
1.3 Being at the Right Place at the Right Time.
1.4 What is Java?
1.5 Abstraction: The Critical Core of Programming.
1.6 The Java 2 Platform.
1.7 Java is Architecture Neutral.
1.8 Java and its Jokes.
2 Programming Fundamentals.
2.2 Abstraction and the Big Picture.
2.3 Statement Sequences.
2.7 Writing a Simple Java Program.
2.9 Output Statements.
2.10 Input Statements.
2.11 Interactive Programs.
3 Adding Structure.
3.2 Abstraction and Encapsulation.
3.4 Writing Programs with Methods.
3.5 Procedural Decomposition.
3.7 Some More Operators.
3.8 Some More Control Statements.
3.9 Some More Example Programs.
4 Introducing Containers.
4.3 Container Classes.
4.4 Data Files.
5 Drawing Pictures.
5.2 Creating Drawings.
5.3 Properties of Drawings.
5.4 Drawing Text.
5.5 Example Programs.
6 Classes and Objects.
6.2 Creating New Data Types.
6.3 Generic Classes.
6.4 Method Names and Scope.
6.5 Object Initialization.
6.6 Objects and References.
6.7 Static Variables and Methods.
6.8 Example Classes.
6.9 Programming with Classes and Objects.
6.10 Enumerated Types.
6.11 An Example—Creating Bridge Hands.
7 Class Relationships.
7.4 Reuse: Inheritance vs. Association.
7.5 Inheritance Hierarchies.
7.6 Interfaces and Type Conformance.
7.7 Comparing Objects for Equality.
7.8 Nested Classes.
7.10 Class Matrix Revisited.
7.11 Reusability and Components.
8.1 What’s the Problem?
8.2 Kinds of Errors.
8.3 Representing Exceptions.
8.4 Throwing an Exception.
8.5 Catching Exceptions.
8.6 The Finally Block.
8.7 Plan to Use Exceptions.
8.8 Some Examples.
9 Introducing Concurrency with Threads.
9.1 Doing More Than One Thing At Once.
9.3 Using Threads.
9.4 Thread Synchronization.
9.5 Thread Scheduling.
9.6 Example Programs.
10 User Interfaces.
10.2 Core GUI Concepts.
10.3 Text Input with a GUI.
10.4 A Very Simple Text Editor.
Part 2 The Process of Programming.
11 The Programming Process.
11.2 Why Object-oriented?
11.3 Development Tasks.
11.4 Testing Strategies.
11.5 UML Class, Object and Sequence Diagrams.
11.6 Practice and Experience.
12 Unit Testing.
12.2 Unit Testing—A First Example.
12.3 The Core Principles of Unit Testing.
12.4 Test-driven Development.
12.5 The TestNG Framework.
12.6 Extending the Person Class.
13 Test-driven Programming Strategies.
13.2 Getting Started—Searching for Files.
13.3 The GUI.
13.4 The Complete Searcher.
14 Programming Tools.
14.2 Project Structure.
14.3 Ant—The Build Tool.
14.4 Version Control.
14.5 Integrated Development Environments.
Part 3 Case Studies in Developing Programs.
15 Introducing the Case Studies.
15.2 The Case Studies.
15.3 The Presentations of the Case Studies.
16 Contacts Book.
16.2 Wading In.
16.3 Stepping Back—Some Research.
16.4 Data Storage.
16.5 A GUI Design.
16.6 Displaying the List of Contacts.
16.7 Menus and Action.
16.8 More to Do.
17 Pedestrian Crossing Simulation.
17.2 The Initial Problem Specification.
17.3 The Initial Thinking.
17.4 A First Pass.
17.5 Getting GUI.
17.6 GUIer and GUIer.
17.7 Control… We Have a Problem.
Part 4 The Java Programming Language in Detail.
18 A Java Language Reference.
18.2 Syntax and Semantics.
18.3 The Presentation.
18.4 The Example Programs.
19 Variables, Types and Expressions.
19.4 Unicode Escapes.
19.9 Expressions and Operators.
19.10 Source Files.
20 Flow Control.
20.4 Transfer Statements.
21 Classes and Packages.
21.3 Top-Level Classes.
21.4 Nested Classes.
21.5 Enumerated Types.
21.7 Static Import.
22 Inheritance and Interfaces.
23 Exception Handling.
24 Threads and Concurrency.
24.2 Class Thread.
24.3 Synchronized Methods.
24.4 Synchronized Statement.
Part 5 Endmatter.
Appendix A Glossary.
Appendix B The CRC Method.
Appendix C The Online Documentation.
Appendix D Running Java Programs.
Appendix E Class Input.
Appendix F Class FileInput.
Appendix G Class FileOutput.
Appendix H Class DrawFrame.
Appendix I Class DrawPanel.
Appendix J Bibliography.
Graham Roberts lectures at Department of Computer Science, University College London, UK.
- Thorough coverage of generic programming
- Updated coverage of J2SE 5.0
- Updated website containing:
- All source code of the programmes used in the book
- Documentation for the ADS library
- Cover graphic
- Answers to exercises in the book
- Teaching materials used by authors
- Links to useful Java resources
- Updates and revisions of book plus various material from 1st edition
- Reviews of 1st edition
- Full, thorough and up-to-date coverage of Java J2SE 5.0
- Tried, tested and successful pedagogy
- Many motivating examples and case studies with supporting code.
- Provides walk through of test driven development, a process new and revolutionary for programmers
- Newly revised to aid learning and focused on first programming courses in Java.
- Exercises and instructor support on the accompanying website aid course management
- Wiley E-Texts are powered by VitalSource technologies e-book software.
- With Wiley E-Texts you can access your e-book how and where you want to study: Online, Download and Mobile.
- Wiley e-texts are non-returnable and non-refundable.
- WileyPLUS registration codes are NOT included with the Wiley E-Text. For informationon WileyPLUS, click here .
- To learn more about Wiley e-texts, please refer to our FAQ.
- E-books are offered as e-Pubs or PDFs. To download and read them, users must install Adobe Digital Editions (ADE) on their PC.
- E-books have DRM protection on them, which means only the person who purchases and downloads the e-book can access it.
- E-books are non-returnable and non-refundable.
- To learn more about our e-books, please refer to our FAQ.