Objects First with Java: A Practical Introduction Using BlueJ, Global Edition

Höfundar: David J. Barnes; Michael Kölling (Útgáfa: 7)
Objects First with Java: A Practical Introduction Using BlueJ, Global Edition

Kaup valmöguleikar

Objects First with Java introduces object-oriented programming from a software engineering perspective. The text integrates BlueJ, an interactive Java development environment that visualizes class structure. BlueJ lets you create and test objects, offering a better understanding than you would from simply reading source code. Unlike traditional textbooks, the chapters are not ordered by language features but by software development concepts.

Nánar um bókina

Útgefandi
Pearson International Content
ISBN
9781292731735
Print ISBN
9781292463605
Format
ePub
Útgáfa
7
Höfundar
David J. Barnes; Michael Kölling
Tungumál
English
Útgefið
2025-04-21
Prent takmörkun á líftíma
100
Prent takmörkun
2
Afritunar takmörkun
2

Kaflar

  • Welcome
  • Cover
  • Cover
  • Copyright Page
  • Copyright Page
  • Dedication
  • Dedication
  • Foreword
  • Foreword
  • Preface
  • New to the seventh edition
  • Java
  • BlueJ
  • Real Objects First
  • An iterative approach
  • Project-driven approach
  • Concept sequence rather than language constructs
  • Supplements
  • Pearson eTextbook
  • The Blueroom
  • List of Projects Discussed in Detail in This Book
  • List of Projects Discussed in Detail in This Book
  • Acknowledgments
  • Acknowledgments
  • 1: Objects and Classes
  • Objectives: Objects and Classes
  • 1.1: Objects and classes
  • 1.1: Objects and classes
  • 1.2 Creating objects
  • 1.2: Creating objects
  • 1.3: Calling methods
  • 1.3: Calling methods
  • 1.4: Parameters
  • 1.4: Parameters
  • 1.5: Data types
  • 1.5: Data types
  • 1.6: Multiple instances
  • 1.6: Multiple instances
  • 1.7: State
  • 1.7: State
  • 1.8: What is in an object?
  • 1.8: What is in an object?
  • 1.9: Java code
  • 1.9: Java code
  • 1.10: Object interaction
  • 1.10: Object interaction
  • 1.11: Source code
  • 1.11: Source code
  • 1.12: Another example
  • 1.12: Another example
  • 1.13: Return values
  • 1.13: Return values
  • 1.14: Objects as parameters
  • 1.14: Objects as parameters
  • 1.15: Summary
  • 1.15: Summary
  • 2: Understanding Class Definitions
  • Objectives: Understanding Class Definitions
  • 2.1: Ticket machines
  • 2.1: Ticket machines
  • 2.1.1: Exploring the behavior of a naïve ticket machine
  • 2.2: Examining a class definition
  • 2.2: Examining a class definition
  • 2.3: The class header
  • 2.3: The class header
  • 2.3.1: Keywords
  • 2.4: Fields, constructors, and methods
  • 2.4: Fields, constructors, and methods
  • 2.4.1: Fields
  • 2.4.2: Constructors
  • 2.5: Parameters: receiving data
  • 2.5: Parameters: receiving data
  • 2.5.1: Choosing variable names
  • 2.6: Assignment
  • 2.6: Assignment
  • 2.7: Methods
  • 2.7: Methods
  • 2.8: Accessor and mutator methods
  • 2.8: Accessor and mutator methods
  • 2.8.1: Setter methods
  • 2.8.2: The this keyword
  • 2.9: Printing from methods
  • 2.9: Printing from methods
  • 2.10: Method summary
  • 2.10: Method summary
  • 2.11: Summary of the naïve ticket machine
  • 2.11: Summary of the Naïve Ticket Machine
  • 2.12: Reflecting on the design of the ticket machine
  • 2.12: Reflecting on the design of the ticket machine
  • 2.13: Making choices: the conditional statement
  • 2.13: Making choices: the conditional statement
  • 2.14: A further conditional-statement example
  • 2.14: A further conditional-statement example
  • 2.15: Scope highlighting
  • 2.15: Scope highlighting
  • 2.16: Local variables
  • 2.16: Local variables
  • 2.17: Fields, parameters, and local variables
  • 2.17: Fields, parameters, and local variables
  • 2.18: Summary of the better-ticket machine
  • 2.18: Summary of the better-ticket machine
  • 2.19: Self-review exercises
  • 2.19: Self-review exercises
  • 2.20: Experimenting with expressions: the Code Pad
  • 2.20: Experimenting with expressions: the Code Pad
  • 2.21: Summary
  • 2.21: Summary
  • 3: Object Interaction
  • Objectives: Object Interaction
  • 3.1: The clock example
  • 3.1: The clock example
  • 3.2: Abstraction and modularization
  • 3.2: Abstraction and modularization
  • 3.3: Abstraction in software
  • 3.3: Abstraction in software
  • 3.4: Modularization in the clock example
  • 3.4: Modularization in the clock example
  • 3.5: Implementing the clock display
  • 3.5: Implementing the clock display
  • 3.6: Class diagrams Versus object diagrams
  • 3.6: Class diagrams Versus object diagrams
  • 3.7: Primitive types and object types
  • 3.7: Primitive types and object types
  • 3.8: The NumberDisplay class
  • 3.8: The NumberDisplay class
  • 3.8.1: The logical operators
  • 3.8.2: String concatenation
  • 3.8.3: The increment method
  • 3.9: The ClockDisplay class
  • 3.9: The ClockDisplay class
  • 3.10: Objects creating objects
  • 3.10: Objects creating objects
  • 3.11: Multiple constructors
  • 3.11: Multiple constructors
  • 3.12: Method calls
  • 3.12.1: Internal method calls
  • 3.12.2: External method calls
  • 3.12.3: The modulo operator
  • 3.12.4: Summary of the clock display
  • 3.13: Modularization, abstraction, and object-interaction revisited
  • 3.13: Modularization, abstraction, and object-interaction revisited
  • 3.13.1: The midi-player project
  • 3.13.2: The Note class
  • 3.13.3: Playing tunes
  • 3.13.4: The BlueJ object bench
  • 3.13.5: Programming the playing of a tune
  • 3.14: Instance methods
  • 3.14: Instance methods
  • 3.15: Static methods
  • 3.15: Static methods
  • 3.15.1: The Math.abs Method
  • 3.15.2: The System.currentTimeMillis method
  • 3.15.3: The String.format method—alternative to concatenation
  • 3.16: Using a debugger
  • 3.16: Using a debugger
  • 3.16.1: Setting breakpoints
  • 3.16.2: Single stepping
  • 3.16.3: Stepping into methods
  • 3.17: Summary
  • 3.17: Summary
  • 4: Grouping Objects
  • Objectives: Grouping Objects
  • 4.1: Building on themes from Chapter 3
  • 4.1: Building on themes from Chapter 3
  • 4.2: The collection abstraction
  • 4.2: The collection abstraction
  • 4.3: An organizer for music files
  • 4.3: An organizer for music files
  • 4.4: Using a library class
  • 4.4: Using a library class
  • 4.4.1: Importing a library class
  • 4.4.2: Diamond notation
  • 4.4.3: Key methods of ArrayList
  • 4.5: Object structures with collections
  • 4.5: Object structures with collections
  • 4.6: Generic classes
  • 4.6: Generic classes
  • 4.7: Numbering within collections
  • 4.7: Numbering within collections
  • 4.7.1: The effect of removal on numbering
  • 4.7.2: The general utility of numbering with collections
  • 4.8: Playing the music files
  • 4.8: Playing the music files
  • 4.8.1: Summary of the music organizer
  • 4.9: Processing a whole collection
  • 4.9: Processing a whole collection
  • 4.9.1: The for-each loop
  • 4.9.2: Selective processing of a collection
  • 4.9.3: Summary of the for-each loop
  • 4.10: Improving structure—the Track class
  • 4.10: Improving structure—the Track class
  • 4.11: Indefinite iteration
  • 4.11: Indefinite iteration
  • 4.11.1: The while loop
  • 4.11.2: Iterating with an index variable
  • 4.11.3: Searching a collection
  • 4.11.4: Some non-collection examples
  • 4.12: The Iterator type
  • 4.12: The Iterator type
  • 4.12.1: Index access versus iterators
  • 4.12.2: Removing elements
  • 4.13: Summary of the MusicOrganizer Project
  • 4.13: Summary of the MusicOrganizer Project
  • 4.14: Another example: An auction system
  • 4.14: Another example: An auction system
  • 4.14.1: Getting started with the project
  • 4.14.2: The null keyword
  • 4.14.3: The Lot class
  • 4.14.4: The Auction class
  • 4.14.5: Anonymous objects
  • 4.14.6: Chaining method calls
  • 4.15: Summary
  • 4.15: Summary
  • 5: Functional Processing of Collections
  • Objectives: Functional Processing of Collections
  • 5.1: An alternative look at themes from Chapter 4
  • 5.1: An alternative look at themes from Chapter 4
  • 5.2: Monitoring animal populations
  • 5.2: Monitoring animal populations
  • 5.3: A first look at lambdas
  • 5.3: A first look at lambdas
  • 5.3.1: Processing a collection with a lambda
  • 5.3.2: Basic syntax of a lambda
  • 5.4: The forEach method of collections
  • 5.4: The forEach method of collections
  • 5.4.1: Variations of lambda syntax
  • 5.4.2: Removing from a collection
  • 5.5: Streams
  • 5.5: Streams
  • 5.5.1: Filters, maps and reductions
  • 5.5.2: Pipelines
  • 5.5.3: The filter method
  • 5.5.4: The map method
  • 5.5.5: The reduce method
  • 5.5.6: Other stream methods
  • 5.6: The music-organizer project revisited
  • 5.6: The music-organizer project revisited
  • 5.6.1: Rewriting listAllTracks
  • 5.6.2: Rewriting listByArtist
  • 5.6.3: Stream indices, short-circuit operations and the optional class
  • 5.6.4: Stream indices
  • 5.6.5: Short-circuit operations
  • 5.6.6: The Optional class
  • 5.6.7: Printing a sorted listing of the tracks
  • 5.6.8: Using a lambda to sort a collection
  • 5.6.9: Using a Comparator
  • 5.7: Summary
  • 5.7: Summary
  • 6: More-Sophisticated Behavior
  • Objectives: More-Sophisticated Behavior
  • 6.1: Documentation for library classes
  • 6.1: Documentation for library classes
  • 6.2: The TechSupport system
  • 6.2: The TechSupport system
  • 6.2.1: Exploring the TechSupport system
  • 6.2.2: Reading the code
  • 6.3: Reading class documentation
  • 6.3: Reading class documentation
  • 6.3.1: Interfaces versus implementation
  • 6.3.2: Using methods from the library
  • 6.3.3: Checking string equality
  • 6.4: Adding random behavior
  • 6.4: Adding random behavior
  • 6.4.1: The Random class
  • 6.4.2: Random numbers with limited range
  • 6.4.3: Generating random responses
  • 6.4.4: Text blocks
  • 6.4.5: Reading documentation for parameterized classes
  • 6.5: Packages and import
  • 6.5: Packages and import
  • 6.6: Using maps for associations
  • 6.6: Using maps for associations
  • 6.6.1: The concept of a map
  • 6.6.2: Using a HashMap
  • 6.6.3: Using a map for the TechSupport system
  • 6.7: Using sets
  • 6.7: Using sets
  • 6.8: Dividing strings
  • 6.8: Dividing strings
  • 6.9: Finishing the TechSupport system
  • 6.9: Finishing the TechSupport system
  • 6.10: Autoboxing and wrapper classes
  • 6.10: Autoboxing and wrapper classes
  • 6.10.1: Maintaining usage counts
  • 6.11: Writing class documentation
  • 6.11: Writing class documentation
  • 6.11.1: Using javadoc in BlueJ
  • 6.11.2: Elements of class documentation
  • 6.12: Public versus private
  • 6.12: Public versus private
  • 6.12.1: Information hiding
  • 6.12.2: Private methods and public fields
  • 6.13: Learning about classes from their interfaces
  • 6.13: Learning about classes from their interfaces
  • 6.13.1: The scribble demo
  • 6.13.2: Code completion
  • 6.13.3: The bouncing-balls demo
  • 6.14: Class variables and Constants
  • 6.14: Class Variables and Constants
  • 6.14.1: The static keyword
  • 6.14.2: Constants
  • 6.15: Class methods
  • 6.15: Class methods
  • 6.15.1: Static methods
  • 6.15.2: Limitations of class methods
  • 6.16: Executing without BlueJ
  • 6.16: Executing without BlueJ
  • 6.16.1: The main method
  • 6.17: Polymorphic collection types
  • 6.17: Polymorphic collection types
  • 6.18: Combining streams and collections
  • 6.18.1: The collect method of streams
  • 6.18.2: Method references
  • 6.19: Organizing data appropriately
  • 6.19: Organizing data appropriately
  • 6.19.1: Organizing sightings by type of animal
  • 6.20: Summary
  • 6.20: Summary
  • 7: Fixed-Size Collections—Arrays
  • Objectives: Fixed-Size Collections—Arrays
  • 7.1: Fixed-size collections
  • 7.1: Fixed-size collections
  • 7.2: Arrays
  • 7.2: Arrays
  • 7.3: A log-file analyzer
  • 7.3: A log-file analyzer
  • 7.3.1: Declaring array variables
  • 7.3.2: Creating array objects
  • 7.3.3: Using array objects
  • 7.3.4: Analyzing the log file
  • 7.4: The for loop
  • 7.4: The for loop
  • 7.4.1: Arrays and the for-each loop
  • 7.4.2: The for loop and iterators
  • 7.5: The Arrays class
  • 7.5: The Arrays class
  • 7.6: Arrays and streams
  • 7.6: Arrays and Streams
  • 7.7: The automaton project
  • 7.7: The automaton project
  • 7.7.1: The conditional operator
  • 7.7.2: First and last iterations
  • 7.7.3: Lookup tables
  • 7.8: Arrays of more than one dimension (advanced)
  • 7.8: Arrays of more than one dimension (advanced)
  • 7.8.1: The brain project
  • 7.8.2: Calculating the next state
  • 7.8.3: Setting up the 2D cell array
  • 7.9: Varargs
  • 7.9: Varargs
  • 7.10: Summary
  • 7.10: Summary
  • 8: Designing Classes
  • Objectives: Designing Classes
  • 8.1: Introduction
  • 8.1: Introduction
  • 8.2: The world-of-zuul game example
  • 8.2: The world-of-zuul game example
  • 8.3: Introduction to coupling and cohesion
  • 8.3: Introduction to coupling and cohesion
  • 8.4: Code duplication
  • 8.4: Code duplication
  • 8.5: Making extensions
  • 8.5: Making extensions
  • 8.5.1: The task
  • 8.5.2: Finding the relevant source code
  • 8.6: Coupling
  • 8.6: Coupling
  • 8.6.1: Using encapsulation to reduce coupling
  • 8.7: Responsibility-driven design
  • 8.7: Responsibility-driven design
  • 8.7.1: Responsibilities and coupling
  • 8.8: Localizing change
  • 8.8: Localizing change
  • 8.9: Implicit coupling
  • 8.9: Implicit coupling
  • 8.10: Thinking ahead
  • 8.10: Thinking ahead
  • 8.11: Cohesion
  • 8.11: Cohesion
  • 8.11.1: Cohesion of methods
  • 8.11.2: Cohesion of classes
  • 8.11.3: Cohesion for readability
  • 8.11.4: Cohesion for reuse
  • 8.12: Choosing an appropriate programming language feature
  • 8.12: Choosing an appropriate programming language feature
  • 8.12.1: The switch statement
  • 8.12.2: Switch expressions
  • 8.12.3: Switch expression as a computational mapping
  • 8.13: Refactoring
  • 8.13: Refactoring
  • 8.13.1: Refactoring and testing
  • 8.13.2: An example of refactoring
  • 8.14: Refactoring for language independence
  • 8.14: Refactoring for language independence
  • 8.14.1: Enumerated types
  • 8.14.2: Further decoupling of the command interface
  • 8.15: Design guidelines
  • 8.15: Design guidelines
  • 8.16: Summary
  • 8.16: Summary
  • 9: Well-Behaved Objects
  • Objectives: Well-Behaved Objects
  • 9.1: Introduction
  • 9.1: Introduction
  • 9.2: Testing and debugging
  • 9.2: Testing and debugging
  • 9.3: Unit testing within BlueJ
  • 9.3: Unit testing within BlueJ
  • 9.3.1: Using inspectors
  • 9.3.2: Positive versus negative testing
  • 9.4: Test automation
  • 9.4: Test automation
  • 9.4.1: Regression testing
  • 9.4.2: Automated testing using JUnit
  • 9.4.3: Recording a test
  • 9.4.4: Fixtures
  • 9.5: Refactoring to use streams
  • 9.5: Refactoring to use streams
  • 9.6: Debugging
  • 9.6: Debugging
  • 9.7: Commenting and style
  • 9.7: Commenting and style
  • 9.8: Manual walkthroughs
  • 9.8: Manual walkthroughs
  • 9.8.1: A high-level walkthrough
  • 9.8.2: Checking state with a walkthrough
  • 9.8.3: Verbal walkthroughs
  • 9.9: Print statements
  • 9.9: Print statements
  • 9.9.1: Turning debugging information on or off
  • 9.10: Debuggers
  • 9.10: Debuggers
  • 9.11: Debugging streams
  • 9.11: Debugging streams
  • 9.12: Choosing a debugging strategy
  • 9.12: Choosing a debugging strategy
  • 9.13: Summary
  • 9.13: Summary
  • 10: Working in Teams
  • Objectives: Working in Teams
  • 10.1: The need to work in teams
  • 10.1: The need to work in teams
  • 10.2: Technology for team work
  • 10.2: Technology for team work
  • 10.3: Pair programming
  • 10.3: Pair programming
  • 10.4: Teamwork—the Problem
  • 10.4: Teamwork—the Problem
  • 10.4.1: Ad Hoc solutions
  • 10.4.2: Shared storage
  • 10.4.3: A Shared repository with local copies
  • 10.5: Working with a shared repository
  • 10.5: Working with a shared repository
  • 10.5.1: Terminology
  • 10.5.2: The extended workflow
  • 10.5.3: Functionality of a version control system
  • 10.6: Teamwork in BlueJ
  • 10.6: Teamwork in BlueJ
  • 10.6.1: The GIT VCS
  • 10.6.2: GIT repository hosting services
  • 10.6.3: Creating a repository
  • 10.6.4: Sharing your project
  • 10.6.5: Checkout
  • 10.6.6: Checking the project status
  • 10.6.7: Working as a team
  • 10.6.8: Resolving conflicts
  • 10.6.9: Project History
  • 10.7: More teamwork functionality
  • 10.7: More teamwork functionality
  • 10.8: Summary
  • 10.8: Summary
  • 11: Recursion
  • Objectives: Recursion
  • 11.1: Introduction
  • 11.1: Introduction
  • 11.2: Recursive methods
  • 11.2: Recursive methods
  • 11.2.1: Avoiding infinite recursion
  • 11.2.2: Divide and conquer
  • 11.3: Recursive classes
  • 11.3: Recursive classes
  • 11.4: Recursive data structures
  • 11.4: Recursive data structures
  • 11.5: The file-system project
  • 11.5: The file-system project
  • 11.5.1: Recursive listing of files
  • 11.5.2: Improving the format of the listing
  • 11.5.3: Showing the structure of the file system
  • 11.6: Working with recursive classes
  • 11.6: Working with recursive classes
  • 11.6.1: Finding a route
  • 11.7: Summary
  • 11.7: Summary
  • 12: Improving Structure with Inheritance
  • Objectives: Improving Structure with Inheritance
  • 12.1: The network example
  • 12.1: The network example
  • 12.1.1: The network project: classes and objects
  • 12.1.2: Network source code
  • 12.1.3: Discussion of the network application
  • 12.2: Using inheritance
  • 12.2: Using inheritance
  • 12.3: Inheritance hierarchies
  • 12.3: Inheritance hierarchies
  • 12.4: Inheritance in Java
  • 12.4: Inheritance in Java
  • 12.4.1: Inheritance and access rights
  • 12.4.2: Inheritance and initialization
  • 12.5: Network: adding other post types
  • 12.5: Network: adding other post types
  • 12.6: Advantages of inheritance (so far)
  • 12.6: Advantages of inheritance (so far)
  • 12.7: Subtyping
  • 12.7: Subtyping
  • 12.7.1: Subclasses and subtypes
  • 12.7.2: Subtyping and assignment
  • 12.7.3: Subtyping and parameter passing
  • 12.7.4: Polymorphic variables
  • 12.7.5: Casting
  • 12.8: The Object class
  • 12.8: The Object class
  • 12.9: The collection hierarchy
  • 12.9: The collection hierarchy
  • 12.10: Summary
  • 12.10: Summary
  • 13: More About Inheritance
  • Objectives: More About Inheritance
  • 13.1: The problem: network’s display method
  • 13.1: The problem: network’s display method
  • 13.2: Static type and dynamic type
  • 13.2: Static type and dynamic type
  • 13.2.1: Calling display from NewsFeed
  • 13.3: Overriding
  • 13.3: Overriding
  • 13.4: Dynamic method lookup
  • 13.4: Dynamic method lookup
  • 13.5: super call in methods
  • 13.5: super call in methods
  • 13.6: Method polymorphism
  • 13.6: Method polymorphism
  • 13.7: Object methods: toString
  • 13.7: Object methods: toString
  • 13.8: Object equality: equals and hashcode
  • 13.8: Object equality: equals and hashcode
  • 13.9: Protected access
  • 13.9: Protected access
  • 13.10: The instanceof operator
  • 13.10: The instanceof operator
  • 13.11: Limits of inheritance
  • 13.11: Limits of inheritance
  • 13.11.1: Composition versus inheritance
  • 13.11.2: Preventing inheritance—final classes
  • 13.11.3: Limiting inheritance—sealed classes
  • 13.11.4: Sealed classes—the benefits
  • 13.12: Another example of inheritance with overriding
  • 13.12: Another example of inheritance with overriding
  • 13.13: Summary
  • 13.13: Summary
  • 14: Further Abstraction Techniques
  • Objectives: Further Abstraction Techniques
  • 14.1: Simulations
  • 14.1: Simulations
  • 14.2: The foxes-and-rabbits simulation
  • 14.2: The foxes-and-rabbits simulation
  • 14.2.1: The foxes-and-rabbits project
  • 14.2.2: The Rabbit class
  • 14.2.3: The Fox class
  • 14.2.4: The Field class
  • 14.2.5: The Simulator class: setup
  • 14.2.6: The Simulator class: a simulation step
  • 14.2.7: Taking steps to improve the simulation
  • 14.3: Abstract classes
  • 14.3: Abstract classes
  • 14.3.1: The Animal superclass
  • 14.3.2: Abstract methods
  • 14.3.3: Abstract classes
  • 14.4: More abstract methods
  • 14.4: More abstract methods
  • 14.5: Multiple inheritance
  • 14.5.1: An Actor class
  • 14.5.2: Flexibility through abstraction
  • 14.5.3: Selective drawing
  • 14.5.4: Drawable actors: multiple inheritance
  • 14.6: Interfaces
  • 14.6: Interfaces
  • 14.6.1: An Actor interface
  • 14.6.2: Default methods in interfaces
  • 14.6.3: Multiple inheritance of interfaces
  • 14.6.4: Interfaces as types
  • 14.6.5: Interfaces as specifications
  • 14.6.6: Library support through abstract classes and interfaces
  • 14.6.7: Functional interfaces and lambdas
  • 14.7: A further example of interfaces
  • 14.7: A further example of interfaces
  • 14.8: The Class class
  • 14.8: The Class class
  • 14.9: Abstract class or interface?
  • 14.9: Abstract class or interface?
  • 14.10: Event-driven simulations
  • 14.10: Event-driven simulations
  • 14.11: Summary of inheritance
  • 14.11: Summary of inheritance
  • 14.12: Summary
  • 14.12: Summary
  • 15: Data-Oriented Classes
  • Objectives: Data-Oriented Classes
  • 15.1: Immutable classes
  • 15.1: Immutable classes
  • 15.2: The experiments project
  • 15.2: The experiments project
  • 15.2.1: Defining a record type
  • 15.2.2: Accessor (getter) methods
  • 15.2.3: Methods inherited from the Record class
  • 15.3: The canonical constructor
  • 15.3: The canonical constructor
  • 15.3.1: Defensive copying
  • 15.3.2: State validation
  • 15.3.3: Constructor overloading
  • 15.4: Static fields in records
  • 15.4: Static fields in records
  • 15.5: Records as lightweight type names
  • 15.5: Records as lightweight type names
  • 15.6: Refactoring the animal monitoring project
  • 15.6: Refactoring the animal monitoring project
  • 15.6.1: Simplifying a class definition with a record
  • 15.6.2: Expanding the features of the project
  • 15.6.3: Records as key types for maps
  • 15.6.4: A map of sightings
  • 15.7: Summary
  • 15.7: Summary
  • 16: A Brief History of Java
  • Objectives: A Brief History of Java
  • 16.1: Java 1.0—the birth of a language
  • 16.1: Java 1.0—the birth of a language
  • 16.1.1: Research languages versus development languages
  • 16.1.2: Superficial familiarity, ease of use and copying from C
  • 16.2: The challenge of retrofitting new constructs
  • 16.2: The challenge of retrofitting new constructs
  • 16.2.1: Collections and generic types
  • 16.2.2: Auto-boxing
  • 16.2.3: The problem with keywords
  • 16.2.4: Side effects and unintended consequences
  • 16.3: The pressure of hardware development
  • 16.3: The pressure of hardware development
  • 16.3.1: Extending libraries
  • 16.3.2: Method references versus inner classes
  • 16.4: More recent language changes
  • 16.4: More recent language changes
  • 16.5: The future and what it may bring
  • 16.5: The future and what it may bring
  • 16.6: Simplicity and the evolution of languages
  • 16.6: Simplicity and the evolution of languages
  • 16.7: Summary
  • 16.7: Summary
  • 17: Building Graphical User Interfaces
  • Objectives: Building Graphical User Interfaces
  • 17.1: Introduction
  • 17.1: Introduction
  • 17.2: Components, layout, and event handling
  • 17.2: Components, layout, and event handling
  • 17.3: AWT, Swing, and JavaFX
  • 17.3: AWT, Swing, and JavaFX
  • 17.4: The ImageViewer example
  • 17.4: The ImageViewer example
  • 17.4.1: First experiments: Creating a JavaFX application
  • 17.4.2: Understanding a top-level JavaFX class
  • 17.4.3: Creating a top-level window
  • 17.4.4: Extending the interface
  • 17.4.5: Studying the JavaFX classes
  • 17.5: Controls
  • 17.5: Controls
  • 17.6: Layout
  • 17.6: Layout
  • 17.6.1: Layout panes
  • 17.6.2: Nested panes
  • 17.7: Making a start with the ImageViewer
  • 17.7: Making a start with the ImageViewer
  • 17.7.1: Adding an image
  • 17.7.2: Adding menus
  • 17.7.3: Event handling
  • 17.7.4: Summary of key GUI elements
  • 17.8: ImageViewer 1.0: The First Complete Version
  • 17.8: ImageViewer 1.0: The first complete version
  • 17.8.1: Image-handling classes
  • 17.8.2: Choosing an image
  • 17.8.3: Image filters
  • 17.8.4: Dialogs
  • 17.9: ImageViewer 2.0: Improving program structure
  • 17.9: ImageViewer 2.0: Improving program structure
  • 17.10: ImageViewer 3.0: More interface improvements
  • 17.10: ImageViewer 3.0: More interface improvements
  • 17.10.1: Buttons
  • 17.10.2: Size of components
  • 17.10.3: Styling with CSS
  • 17.10.4: Using style classes
  • 17.10.5: Defining your own style classes
  • 17.10.6: Styling using ID selectors
  • 17.10.7: Inheriting styling
  • 17.10.8: Going further with styles
  • 17.11: Further extensions
  • 17.11: Further extensions
  • 17.12: Another example: MusicPlayer
  • 17.12: Another example: MusicPlayer
  • 17.13: Summary
  • 17.13: Summary
  • 18: Handling Errors
  • Objectives: Handling Errors
  • 18.1: The address-book project
  • 18.1: The address-book project
  • 18.2: Defensive programming
  • 18.2.1: Client–server interaction
  • 18.2.2: Parameter checking
  • 18.3: Server error reporting
  • 18.3: Server error reporting
  • 18.3.1: Notifying the user
  • 18.3.2: Notifying the client object
  • 18.3.3: The Optional type
  • 18.4: Exception-throwing principles
  • 18.4: Exception-throwing principles
  • 18.4.1: Throwing an exception
  • 18.4.2: Checked and unchecked exceptions
  • 18.4.3: The effect of an exception
  • 18.4.4: Using unchecked exceptions
  • 18.4.5: Preventing object creation
  • 18.5: Exception handling
  • 18.5: Exception handling
  • 18.5.1: Checked exceptions: the throws clause
  • 18.5.2: Anticipating exceptions: the try statement
  • 18.5.3: Throwing and catching multiple exceptions
  • 18.5.4: Propagating an exception
  • 18.5.5: The finally block
  • 18.6: Defining new exception classes
  • 18.6: Defining new exception classes
  • 18.7: Using assertions
  • 18.7.1: Internal consistency checks
  • 18.7.2: The assert statement
  • 18.7.3: Guidelines for using assertions
  • 18.7.4: Assertions and the BlueJ unit-testing framework
  • 18.8: Error recovery and avoidance
  • 18.8: Error recovery and avoidance
  • 18.8.1: Error recovery
  • 18.8.2: Error avoidance
  • 18.9: File-based input/output
  • 18.9: File-based input/output
  • 18.9.1: Readers, writers, and streams
  • 18.9.2: The file class and Path interface
  • 18.9.3: File output
  • 18.9.4: The try-with-resource statement
  • 18.9.5: Text input
  • 18.9.6: Scanner: parsing input
  • 18.9.7: Object serialization
  • 18.10: Summary
  • 18.10: Summary
  • 19: Designing Applications
  • Objectives: Designing Applications
  • 19.1: Analysis and design
  • 19.1: Analysis and design
  • 19.1.1: The verb/noun method
  • 19.1.2: The cinema booking example
  • 19.1.3: Discovering classes
  • 19.1.4: Using CRC cards
  • 19.1.5: Scenarios
  • 19.2: Class design
  • 19.2: Class design
  • 19.2.1: Designing class interfaces
  • 19.2.2: User interface design
  • 19.3: Documentation
  • 19.3: Documentation
  • 19.4: Cooperation
  • 19.4: Cooperation
  • 19.5: Prototyping
  • 19.5: Prototyping
  • 19.6: Software growth
  • 19.6: Software growth
  • 19.6.1: Waterfall model
  • 19.6.2: Iterative development
  • 19.7: Using design patterns
  • 19.7: Using design patterns
  • 19.7.1: Structure of a pattern
  • 19.7.2: Decorator
  • 19.7.3: Singleton
  • 19.7.4: Factory method
  • 19.7.5: Observer
  • 19.7.6: Pattern summary
  • 19.8: Summary
  • 19.8: Summary
  • 20: A Case Study
  • Objectives: A Case Study
  • 20.1: The case study
  • 20.1: The case study
  • 20.1.1: The problem description
  • 20.2: Analysis and design
  • 20.2: Analysis and design
  • 20.2.1: Discovering classes
  • 20.2.2: Using CRC cards
  • 20.2.3: Scenarios
  • 20.3: Class design
  • 20.3: Class design
  • 20.3.1: Designing class interfaces
  • 20.3.2: Collaborators
  • 20.3.3: The outline implementation
  • 20.3.4: Testing
  • 20.3.5: Some remaining issues
  • 20.4: Iterative development
  • 20.4: Iterative development
  • 20.4.1: Development steps
  • 20.4.2: A first stage
  • 20.4.3: Testing the first stage
  • 20.4.4: A later stage of development
  • 20.4.5: Further ideas for development
  • 20.4.6: Reuse
  • 20.5: Another example
  • 20.5: Another example
  • 20.6: Taking Things Further
  • 20.6: Taking things further
  • Appendix A: Working with a BlueJ Project
  • Appendix A: Working with a BlueJ Project
  • Appendix B: Java Data Types
  • Appendix B: Java Data Types
  • Appendix C: Operators
  • Appendix C: Operators
  • Appendix D: Java Control Structures
  • Appendix D: Java Control Structures
  • Appendix E: Running Java without BlueJ
  • Appendix E: Running Java without BlueJ
  • Appendix F: Using the Debugger
  • Appendix F: Using the Debugger
  • Appendix G: JUnit Unit-Testing Tools
  • Appendix G: JUnit Unit-Testing Tools
  • Appendix H: Teamwork Tools
  • Appendix H: Teamwork Tools
  • Appendix I: Javadoc
  • Appendix I: Javadoc
  • Appendix J: Program Style Guide
  • Appendix J: Program Style Guide
  • Appendix K: Important Library Classes
  • Appendix K: Important Library Classes
  • Appendix L: Concept Glossary
  • Appendix L: Concept Glossary
  • Footnotes
  • Glossary