Developing Java Software

By Russel Winder, Graham Roberts
Details Edition 3 John Wiley & Sons, Limited
ISBN 9780470090251
Language English
Choose from
Price 865.00 kr.
Paperback

Not in stock

Not in stock. Order now and have it delivered in appr. 12 working days

This significantly updated new edition of Developing Java Software is a thorough presentation of object-oriented design and programming concepts using the Java 5 programming language. The book takes the reader from the basics of using Java 5 to the creation of complete, object-oriented programs. Following an 'objects early' approach, the core elements of the Java language are covered, including the use of recently added features such as generics.

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.

Preface xix
Part 1 Programming with Objects and Classes 1 1 Introduction 3
1.1 The Start 4
1.2 A (Very!) Short History of Java 4
1.3 Being at the Right Place at the Right Time 6
1.4 What is Java? 6
1.5 Abstraction: The Critical Core of Programming 7
1.6 The Java 2 Platform 8
1.7 Java is Architecture Neutral 9
1.8 Java and its Jokes 11
1.9 Summary 12 2 Programming Fundamentals 13
2.1 Introduction 14
2.2 Abstraction and the Big Picture 15
2.3 Statement Sequences 16
2.4 Iteration 19
2.5 Selection 23
2.6 State 26
2.7 Writing a Simple Java Program 32
2.8 Comments 35
2.9 Output Statements 38
2.10 Input Statements 39
2.11 Interactive Programs 40
2.12 Summary 51 Self-review Questions 52 Programming Exercises 53 Challenges 54 3 Adding Structure 57
3.1 Introduction 58
3.2 Abstraction and Encapsulation 59
3.3 Methods 59
3.4 Writing Programs with Methods 68
3.5 Procedural Decomposition 77
3.6 Encapsulation 78
3.7 Some More Operators 81
3.8 Some More Control Statements 83
3.9 Some More Example Programs 85
3.10 Summary 97 Self-review Questions 97 Programming Exercises 98 Challenges 100 4 Introducing Containers 103
4.1 Introduction 104
4.2 Arrays 104
4.3 Container Classes 119
4.4 Data Files 125
4.5 Summary 138 Self-review Questions 139 Programming Exercises 139 Challenges 141 5 Drawing Pictures 143
5.1 Introduction 144
5.2 Creating Drawings 144
5.3 Properties of Drawings 152
5.4 Drawing Text 155
5.5 Example Programs 156
5.6 Summary 167 Self-review Questions 167 Programming Exercises 168 Challenges 169 6 Classes and Objects 171
6.1 Introduction 172
6.2 Creating New Data Types 172
6.3 Generic Classes 178
6.4 Method Names and Scope 181
6.5 Object Initialization 183
6.6 Objects and References 188
6.7 Static Variables and Methods 197
6.8 Example Classes 200
6.9 Programming with Classes and Objects 211
6.10 Enumerated Types 213
6.11 An Example--Creating Bridge Hands 216
6.12 Summary 220 Self-review Questions 221 Programming Exercises 222 Challenges 222 7 Class Relationships 225
7.1 Introduction 226
7.2 Association 226
7.3 Inheritance 228
7.4 Reuse: Inheritance vs. Association 238
7.5 Inheritance Hierarchies 240
7.6 Interfaces and Type Conformance 243
7.7 Comparing Objects for Equality 247
7.8 Nested Classes 251
7.9 Packages 253
7.10 Class Matrix Revisited 255
7.11 Reusability and Components 264
7.12 Summary 266 Self-review Questions 266 Programming Exercises 267 Challenges 267 8 Exceptions 269
8.1 What''s the Problem? 270
8.2 Kinds of Errors 271
8.3 Representing Exceptions 272
8.4 Throwing an Exception 273
8.5 Catching Exceptions 275
8.6 The Finally Block 277
8.7 Plan to Use Exceptions 278
8.8 Some Examples 278
8.9 Summary 296 Self-review Questions 297 Programming Exercises 297 9 Introducing Concurrency with Threads 299
9.1 Doing More Than One Thing At Once 300
9.2 Threads 300
9.3 Using Threads 302
9.4 Thread Synchronization 303
9.5 Thread Scheduling 304
9.6 Example Programs 305
9.7 Summary 319 Self-review Questions 319 Programming Exercises 319 10 User Interfaces 321
10.1 Introduction 322
10.2 Core GUI Concepts 324
10.3 Text Input with a GUI 336
10.4 A Very Simple Text Editor 338
10.5 Menus 342
10.6 Painting 346
10.7 Summary 346 Self-review Questions 347 Programming Exercises 347 Challenges 348
Part 2 The Process of Programming 349 11 The Programming Process 351
11.1 Introduction 352
11.2 Why Object-oriented? 354
11.3 Development Tasks 357
11.4 Testing Strategies 368
11.5 UML Class, Object and Sequence Diagrams 371
11.6 Practice and Experience 382
11.7 Summary 383 Self-review Questions 383 Programming Exercises 384 Challenges 385 12 Unit Testing 387
12.1 Introduction 388
12.2 Unit Testing--A First Example 390
12.3 The Core Principles of Unit Testing 393
12.4 Test-driven Development 395
12.5 The TestNG Framework 398
12.6 Extending the Person Class 404
12.7 Summary 421 Self-review Questions 421 Programming Exercises 422 Challenges 423 13 Test-driven Programming Strategies 425
13.1 Introduction 426
13.2 Getting Started--Searching for Files 427
13.3 The GUI 440
13.4 The Complete Searcher 460
13.5 Summary 461 Self-review Questions 461 Programming Exercises 462 Challenges 462 14 Programming Tools 463
14.1 Introduction 464
14.2 Project Structure 464
14.3 Ant--The Build Tool 468
14.4 Version Control 481
14.5 Integrated Development Environments 490
14.6 Summary 499 Self-review Questions 499 Programming Exercises 500 Challenges 500
Part 3 Case Studies in Developing Programs 501 15 Introducing the Case Studies 503
15.1 Introduction 504
15.2 The Case Studies 505
15.3 The Presentations of the Case Studies 506 16 Contacts Book 507
16.1 Introduction 508
16.2 Wading In 508
16.3 Stepping Back--Some Research 509
16.4 Data Storage 521
16.5 A GUI Design 535
16.6 Displaying the List of Contacts 536
16.7 Menus and Action 550
16.8 More to Do 563 Programming Exercises 563 Challenges 564 17 Pedestrian Crossing Simulation 565
17.1 Introduction 566
17.2 The Initial Problem Specification 566
17.3 The Initial Thinking 567
17.4 A First Pass 570
17.5 Getting GUI 584
17.6 GUIer and GUIer 597
17.7 Control... We Have a Problem 604
17.8 Onward 615
17.9 Summary 616 Programming Exercises 616 Challenges 616
Part 4 The Java Programming Language in Detail 617 18 A Java Language Reference 619
18.1 Introduction 620
18.2 Syntax and Semantics 620
18.3 The Presentation 621
18.4 The Example Programs 621
18.5 Summary 623 19 Variables, Types and Expressions 625
19.1 Introduction 626
19.2 Comments 626
19.3 Identifiers 630
19.4 Unicode Escapes 633
19.5 Literals 634
19.6 Types 636
19.7 Scope 639
19.8 Variables 640
19.9 Expressions and Operators 649
19.10 Source Files 662
19.11 Summary 662 Self-review Questions 663 Programming Exercises 663 20 Flow Control 665
20.1 Introduction 666
20.2 Selection 666
20.3 Iteration 675
20.4 Transfer Statements 686
20.5 Recursion 694
20.6 Summary 695 Self-review Questions 695 Programming Exercises 696 21 Classes and Packages 697
21.1 Introduction 698
21.2 Classes 698
21.3 Top-Level Classes 720
21.4 Nested Classes 720
21.5 Enumerated Types 734
21.6 Packages 737
21.7 Static Import 739
21.8 Summary 742 Self-review Questions 742 Programming Exercises 743 22 Inheritance and Interfaces 745
22.1 Introduction 746
22.2 Inheritance 746
22.3 Interfaces 775
22.4 Annotations 782
22.5 Summary 784 Self-review Questions 784 Programming Exercises 785 23 Exception Handling 787
23.1 Introduction 788
23.2 Summary 800 Self-review Questions 801 24 Threads and Concurrency 803
24.1 Introduction 804
24.2 Class Thread 805
24.3 Synchronized Methods 811
24.4 Synchronized Statement 816
24.5 Summary 817 Self-review Questions 818 Programming Exercises 818
Part 5 Endmatter 819 Appendix A Glossary 821 Appendix B The CRC Method 829 B. 1 Introduction 829 B. 2 Basic Concepts 829 B. 3 CRC Cards 830 B. 4 CRC Method Process 831 B. 5 Problems 832 B. 6 Documentation 832 B. 7 Design 833 Appendix C The Online Documentation 835 Appendix D Running Java Programs 839 D. 1 Getting Started 839 D. 2 Compiling and Running a Program 839 D. 3 Using Classes Input, FileInput and FileOutput 840 D. 4 Using Classes DrawFrame and DrawPanel 841 D. 5 Using CLASSPATH 841 Appendix E Class Input 843 Appendix F Class FileInput 851 Appendix G Class FileOutput 853 Appendix H Class DrawFrame 857 Appendix I Class DrawPanel 861 Appendix J Bibliography 863 J. 1 Features and Use of Java 863 J. 2 Unit Testing and Refactoring 864 J. 3 Object-oriented Analysis, Design and Programming 864 J. 4 General Programming 865 J. 5 Algorithms and Data Structures 865 J. 6 Concurrency and Threads 865 J. 7 Tools 866 J. 8 Human-Computer Interaction 866 Index 867