Objects First With Java: A Practical Introduction Using BlueJ, 3/e (Paperback)
暫譯: Java 物件導向程式設計:使用 BlueJ 的實用入門,第 3 版 (平裝本)

David J. Barnes, Michael Kolling

  • 出版商: Prentice Hall
  • 出版日期: 2006-06-15
  • 定價: $1,020
  • 售價: 6.0$612
  • 語言: 英文
  • 頁數: 520
  • 裝訂: Paperback
  • ISBN: 013197629X
  • ISBN-13: 9780131976290
  • 相關分類: Java 程式語言
  • 立即出貨(限量) (庫存=1)

買這商品的人也買了...

商品描述

Description

The book has a very clear identity.

It takes a truly objects first approach to teaching problem solving using Java. These are complicated concepts so the book uses the development environment BlueJ to help the student’s understanding. BlueJ has a strong emphasis on visualization and interaction techniques, and allows the students to manipulate objects and call methods as a first exercise. BlueJ is free and freely available, and has been developed specifically for teaching.

The book is loaded with projects so that the student can really get a grip on actually solving problems; and it takes a “spiral approach”, introducing a topic in a simple context early on, then revisiting it later in the book to deepen understanding. It also comes with a CD containing JDK, BlueJ, a BlueJ tutorial and code for all the projects. The website contains style guide for all examples, PowerPoints for lecturers and also a Solutions Manual. 

 

Table of Contents

Foreword

Preface to the instructor

List of projects discussed in detail in this book

Acknowledgements

 

Part 1 Foundations of object orientation

 

Chapter 1 Objects and classes

1.1 Objects and classes

1.2 Creating objects

1.3 Calling methods

1.4 Parameters

1.5 Data types

1.6 Multiple instances

1.7 State

1.8 What is in an object?

1.9 Object interaction

1.10 Source code

1.11 Another example

1.12 Return values

1.13 Objects as parameters

1.14 Summary

 

Chapter 2 Understanding class definitions

2.1 Ticket machines

2.1.1 Exploring the behavior of a naïve ticket machine

2.2 Examining a class definition

2.3 Fields, constructors, and methods

2.3.1 Fields

2.3.2 Constructors

2.4 Passing data via parameters

2.5 Assignment

2.6 Accessor methods  

2.7 Mutator methods

2.8 Printing from methods  

2.9 Summary of the naïve ticket machine

2.10 Reflecting on the design of the ticket machine

2.11 Making choices: the conditional statement

2.12 A further conditional-statement example

2.13 Local variables

2.14 Fields, parameters, and local variables

2.15 Summary of the better ticket machine

2.16 Self-review exercises

2.17 Reviewing a familiar example

2.18 Summary

 

Chapter 3 Object interaction

3.1 The clock example

3.2 Abstraction and modularization

3.3 Abstraction in software

3.4 Modularization in the clock example

3.5 Implementing the clock display

3.6 Class diagrams versus object diagrams

3.7 Primitive types and object types

3.8 The ClockDisplay source code

3.8.1 Class NumberDisplay

3.8.2 String concatenation

3.8.3 The modulo operator

3.8.4 Class ClockDisplay

3.9 Objects creating objects

3.10 Multiple constructors

3.11 Method calls

3.11.1 Internal method calls

3.11.2 External method calls

3.11.3 Summary of the clock display

3.12 Another example of object interaction

3.12.1 The mail system example

3.12.2 The this keyword

3.13 Using a debugger

3.13.1 Setting breakpoints

3.13.2 Single stepping 

3.13.3 Stepping into methods

3.14 Method calling revisited

3.15 Summary

 

Chapter 4 Grouping objects

4.1 Grouping objects in flexible-size collections

4.2 A personal notebook

4.3 A first look at library classes

4.3.1 An example of using a library 

4.4 Object structures with collections

4.5 Generic classes

4.6 Numbering within collections

4.7 Removing an item from a collection

4.8 Processing a whole collection

4.8.1 The for-each loop

4.8.2 The while loop

4.8.3 Iterating over a collection

4.8.4 Index access versus iterators

4.9 Summary of the notebook example

4.10 Another example: an auction system

4.10.1 The Lot class

4.10.2 The Auction class

4.10.3 Anonymous objects

4.10.4 Using collections

4.11 Flexible collection summary

4.12 Fixed-size collections

4.12.1 A log-file analyzer

4.12.2 Declaring array variables

4.12.3 Creating array objects

4.12.4 Using array objects

4.12.5 Analyzing the log file

4.12.6 The for loop

4.13 Summary

 

Chapter 5 More sophisticated behavior

5.1 Documentation for library classes

5.2 The TechSupport system

5.2.1 Exploring the TechSupport system

5.2.2 Reading the code

5.3 Reading class documentation

5.3.1 Interfaces versus implementation

5.3.2 Using library-class methods

5.3.3 Checking string equality

5.4 Adding random behavior

5.4.1 The Random class

5.4.2 Random numbers with limited range

5.4.3 Generating random responses

5.4.4 Reading documentation for parameterized classes

5.5 Packages and import

5.6 Using maps for associations

5.6.1 The concept of a map

5.6.2 Using a HashMap

5.6.3 Using a map for the TechSupport system

5.7 Using sets

5.8 Dividing strings

5.9 Finishing the TechSupport system

5.10 Writing class documentation

5.10.1 Using javadoc in BlueJ

5.10.2 Elements of class documentation

5.11 Public versus private

5.11.1 Information hiding

5.11.2 Private methods and public fields

5.12 Learning about classes from their interfaces

5.13 Class variables and constants

5.13.1 The static key word

5.13.2 Constants

5.14 Summary

 

Chapter 6 Well-behaved objects

6.1 Introduction

6.2 Testing and debugging

6.3 Unit testing within BlueJ

6.3.1 Using inspectors

6.3.2 Positive versus negative testing

6.4 Test automation

6.4.1 Regression testing

6.4.2 Automated checking of test results

6.4.3 Recording a test

6.4.4 Fixtures

6.5 Modularization and interfaces

6.6 A debugging scenario

6.7 Commenting and style

6.8 Manual walkthroughs

6.8.1 A high-level walkthrough

6.8.2 Checking state with a walkthrough

6.8.3 Verbal walkthroughs

6.9 Print statements

6.9.1 Turning debugging information on or off

6.10 Choosing a test strategy

6.11 Debuggers

6.12 Putting the techniques into practice

6.13 Summary

 

Chapter 7 Designing classes

7.1 Introduction

7.2 The world-of-zuul game example

7.3 Introduction to coupling and cohesion

7.4 Code duplication

7.5 Making extensions

7.5.1 The task

7.5.2 Finding the relevant source code

7.6 Coupling

7.6.1 Using encapsulation to reduce coupling

7.7 Responsibility-driven design

7.7.1 Responsibilities and coupling

7.8 Localizing change

7.9 Implicit coupling

7.10 Thinking ahead

7.11 Cohesion

7.11.1 Cohesion of methods

7.11.2 Cohesion of classes

7.11.3 Cohesion for readability

7.11.4 Cohesion for reuse

7.12 Refactoring

7.12.1 Refactoring and testing

7.12.2 An example of refactoring

7.13 Refactoring for language independence

7.13.1 Enumerated types

7.13.2 Further decoupling of the command interface

7.14 Design guidelines

7.15 Executing without BlueJ

7.15.1 Class methods

7.15.2 The main method

7.15.3 Limitations of class methods

7.16 Summary

 

Part 2 Application structures

 

Chapter 8 Improving structure with inheritance

8.1 The DoME example

8.1.1 DoME classes and objects

8.1.2 DoME source code

8.1.3 Discussion of the DoME application

8.2 Using inheritance

8.3 Inheritance hierarchies

8.4 Inheritance in Java

8.4.1 Inheritance and access rights

8.4.2 Inheritance and initialization

8.5 DoME: adding other item types

8.6 Advantages of inheritance (so far)

8.7 Subtyping

8.7.1 Subclasses and subtypes

8.7.2 Subtyping and assignment

8.7.3 Subtyping and parameter passing

8.7.4 Polymorphic variables

8.7.5 Casting

8.8 The Object class

8.9 Autoboxing and Wrapper classes

8.10 The collection hierarchy

8.11 Summary

 

Chapter 9 More about inheritance

9.1 The problem: DoME’s print method

9.2 Static type and dynamic type

9.2.1 Calling print from Database

9.3 Overriding

9.4 Dynamic method lookup

9.5 Super call in methods

9.6 Method polymorphism

9.7 Object methods: toString

9.8 Protected access

9.9 Another example of inheritance with overriding

9.10 Summary

 

Chapter 10 Further abstraction techniques

10.1 Simulations

10.2 The foxes-and-rabbits simulation

10.2.1 The foxes-and-rabbits project

10.2.2 The Rabbit class

10.2.3 The Fox class

10.2.4 The Simulator class: setup

10.2.5 The Simulator class: a simulation step

10.2.6 Taking steps to improve the simulation

10.3 Abstract classes

10.3.1 The Animal superclass

10.3.2 Abstract methods

10.3.3 Abstract classes

10.4 More abstract methods

10.5 Multiple inheritance

10.5.1 An Actor class

10.5.2 Flexibility through abstraction

10.5.3 Selective drawing

10.5.4 Drawable actors: multiple inheritance

10.6 Interfaces

10.6.1 An Actor interface

10.6.2 Multiple inheritance of interfaces

10.6.3 Interfaces as types

10.6.4 Interfaces as specifications

10.6.5 A further example of interfaces

10.6.6 Abstract class or interface?

10.7 Summary of inheritance

10.8 Summary

 

Chapter 11 Building graphical user interfaces

11.1 Introduction

11.2 Components, layout, and event handling

11.3 AWT and Swing

11.4 The ImageViewer example

11.4.1 First experiments: creating a frame

11.4.2 Adding simple components

11.4.3 Adding menus

11.4.4 Event handling

11.4.5 Centralized receipt of events

11.4.6 Inner classes

11.4.7 Anonymous inner classes

11.5 ImageViewer 1.0: the first complete version

11.5.1 Image-processing classes

11.5.2 Adding the image

11.5.3 Layout

11.5.4 Nested containers

11.5.5 Image filters

11.5.6 Dialogs

11.6 ImageViewer 2.0: improving program structure

11.7 ImageViewer 3.0: more interface components

11.7.1 Buttons

11.7.2 Borders

11.8 Further extensions

11.9 Another example: SoundPlayer338

11.10 Summary

 

Chapter 12 Handling errors

12.1 The address-book project

12.2 Defensive programming

12.2.1 Client–server interaction

12.2.2 Argument checking

12.3 Server error reporting

12.3.1 Notifying the user

12.3.2 Notifying the client object

12.4 Exception-throwing principles

12.4.1 Throwing an exception

12.4.2 Exception classes

12.4.3 The effect of an exception

12.4.4 Unchecked exceptions

12.4.5 Preventing object creation

12.5 Exception handling

12.5.1 Checked exceptions: the throws clause

12.5.2 Catching exceptions: the try statement

12.5.3 Throwing and catching multiple exceptions

12.5.4 Propagating an exception

12.5.5 The finally clause

12.6 Defining new exception classes

12.7 Using assertions

12.7.1 Internal consistency checks

12.7.2 The assert statement

12.7.3 Guidelines for using assertions

12.7.4 Assertions and the BlueJ unit testing framework

12.8 Error recovery and avoidance

12.8.1 Error recovery

12.8.2 Error avoidance

12.9 Case study: text input/output

12.9.1 Readers, writers, and streams

12.9.2 The address-book-io project

12.9.3 Text output with FileWriter

12.9.4 Text input with FileReader

12.9.5 Scanner: reading input from the terminal

12.9.6 Object serialization

12.10 Summary

 

Chapter 13 Designing applications

13.1 Analysis and design

13.1.1 The verb/noun method

13.1.2 The cinema booking example

13.1.3 Discovering classes

13.1.4 Using CRC cards

13.1.5 Scenarios

13.2 Class design

13.2.1 Designing class interfaces

13.2.2 User interface design

13.3 Documentation

13.4 Cooperation

13.5 Prototyping

13.6 Software growth

13.6.1 Waterfall model

13.6.2 Iterative development

13.7 Using design patterns

13.7.1 Structure of a pattern

13.7.2 Decorator

13.7.3 Singleton

13.7.4 Factory method

13.7.5 Observer

13.7.6 Pattern summary

13.8 Summary

 

Chapter 14 A case study

14.1 The case study

14.1.1 The problem description

14.2 Analysis and design

14.2.1 Discovering classes

14.2.2 Using CRC cards

14.2.3 Scenarios

14.3 Class design

14.3.1 Designing class interfaces

14.3.2 Collaborators

14.3.3 The outline implementation

14.3.4 Testing

14.3.5 Some remaining issues

14.4 Iterative development

14.4.1 Development steps

14.4.2 A first stage

14.4.3 Testing the first stage

14.4.4 A later stage of development

14.4.5 Further ideas for development

14.4.6 Reuse

14.5 Another example

14.6 Taking things further

 

Appendices

A Working with a BlueJ project

B Java data types

C Java control structures

D Operators

E Running Java without BlueJ

F Configuring BlueJ

G Using the debugger

H JUnit unit-testing tools

I Javadoc

J Program style guide

K Important library classes

 

Index

商品描述(中文翻譯)

```

描述



這本書有著非常清晰的身份。


它採用真正的物件導向方法來教導使用 Java 解決問題。這些都是複雜的概念,因此本書使用開發環境 BlueJ 來幫助學生理解。BlueJ 強調可視化和互動技術,並允許學生在第一個練習中操作物件和呼叫方法。BlueJ 是免費且可自由獲得的,並且專門為教學而開發。


這本書充滿了專案,讓學生能夠真正掌握解決問題的能力;並且採用“螺旋式方法”,在早期以簡單的上下文介紹主題,然後在書中稍後重新探討以加深理解。它還附帶一張 CD,包含 JDK、BlueJ、BlueJ 教程和所有專案的程式碼。網站上包含所有範例的風格指南、講師用的 PowerPoint 以及解答手冊。



 


目錄



前言


給講師的序言


本書詳細討論的專案列表


致謝


 


第一部分 物件導向的基礎


 


第 1 章 物件與類別


1.1 物件與類別


1.2 創建物件


1.3 呼叫方法


1.4 參數


1.5 資料類型


1.6 多個實例


1.7 狀態


1.8 物件中包含什麼?


1.9 物件互動


1.10 原始碼


1.11 另一個範例


1.12 回傳值


1.13 物件作為參數


1.14 總結


 


第 2 章 理解類別定義


2.1 售票機


2.1.1 探索一個天真的售票機的行為


2.2 檢視類別定義


2.3 欄位、建構子和方法


2.3.1 欄位


2.3.2 建構子


2.4 通過參數傳遞資料


2.5 指派


2.6 存取方法


2.7 修改方法


2.8 從方法中列印


2.9 天真的售票機的總結


2.10 反思售票機的設計


2.11 做出選擇:條件語句


2.12 進一步的條件語句範例


2.13 區域變數


2.14 欄位、參數和區域變數


2.15 更好的售票機的總結


2.16 自我檢測練習


2.17 檢視一個熟悉的範例


2.18 總結


 


第 3 章 物件互動


3.1 時鐘範例


3.2 抽象與模組化


3.3 軟體中的抽象


3.4 時鐘範例中的模組化


3.5 實作時鐘顯示


3.6 類別圖與物件圖


3.7 原始類型與物件類型


3.8 ClockDisplay 原始碼


3.8.1 類別 NumberDisplay


3.8.2 字串串接


3.8.3 取餘數運算子


3.8.4 類別 ClockDisplay


3.9 物件創建物件


3.10 多個建構子


3.11 方法呼叫


3.11.1 內部方法呼叫


3.11.2 外部方法呼叫


3.11.3 時鐘顯示的總結


3.12 另一個物件互動的範例


3.12.1 郵件系統範例


3.12.2 this 關鍵字


3.13 使用除錯器


3.13.1 設定斷點


3.13.2 單步執行


3.13.3 進入方法


3.14 方法呼叫重訪


3.15 總結


 


第 4 章 分組物件


4.1 在可變大小集合中分組物件


4.2 個人筆記本


4.3 初步了解庫類別


4.3.1 使用庫的範例


4.4 使用集合的物件結構


4.5 泛型類別


4.6 在集合中編號


4.7 從集合中移除項目


4.8 處理整個集合


4.8.1 for-each 迴圈


4.8.2 while 迴圈


4.8.3 遍歷集合


4.8.4 索引存取與迭代器


4.9 筆記本範例的總結


4.10 另一個範例:拍賣系統


4.10.1 Lot 類別


4.10.2 Auction 類別


4.10.3 匿名物件


4.10.4 使用集合


4.11 可變集合的總結


4.12 固定大小的集合


4.12.1 日誌檔分析器


4.12.2 宣告陣列變數


4.12.3 創建陣列物件


4.12.4 使用陣列物件


4.12.5 分析日誌檔


4.12.6 for 迴圈


4.13 總結


 


第 5 章 更複雜的行為


5.1 庫類別的文件


5.2 TechSupport 系統


5.2.1 探索 TechSupport 系統


5.2.2 閱讀程式碼


5.3 閱讀類別文件


5.3.1 介面與實作


5.3.2 使用庫類別方法


5.3.3 檢查字串相等性


5.4 添加隨機行為


5.4.1 Random 類別


5.4.2 有限範圍的隨機數


5.4.3 生成隨機回應


5.4.4 閱讀參數化類別的文件


5.5 套件與導入


5.6 使用映射進行關聯


5.6.1 映射的概念


5.6.2 使用 HashMap


5.6.3 在 TechSupport 系統中使用映射


5.7 使用集合


5.8 分割字串


5.9 完成 TechSupport 系統


5.10 撰寫類別文件


5.10.1 在 BlueJ 中使用 javadoc


5.10.2 類別文件的元素


5.11 公共與私有


5.11.1 資訊隱藏


5.11.2 私有方法與公共欄位


5.12 從介面學習類別


5.13 類別變數與常數


5.13.1 static 關鍵字


5.13.2 常數


5.14 總結


 


第 6 章 行為良好的物件


6.1 介紹


6.2 測試與除錯


6.3 在 BlueJ 中的單元測試


6.3.1 使用檢查器


6.3.2 正向與負向測試


6.4 測試自動化


6.4.1 回歸測試


6.4.2 自動檢查測試結果


6.4.3 記錄測試


6.4.4 固定裝置


6.5 模組化與介面


6.6 一個除錯場景


6.7 註解與風格


6.8 手動檢查


6.8.1 高層次檢查


6.8.2 使用檢查檢查狀態


6.8.3 口頭檢查


6.9 列印語句


6.9.1 開啟或關閉除錯資訊


6.10 選擇測試策略


6.11 除錯器


6.12 將技術付諸實踐


6.13 總結


 


第 7 章 設計類別


7.1 介紹


7.2 Zuul 遊戲範例


7.3 介紹耦合與內聚


7.4 程式碼重複


7.5 擴展


7.5.1 任務


7.5.2 尋找相關的原始碼


7.6 耦合


7.6.1 使用封裝來減少耦合


7.7 責任驅動設計


7.7.1 責任與耦合


7.8 本地化變更


7.9 隱式耦合


7.10 前瞻性思考


7.11 內聚


7.11.1 方法的內聚


7.11.2 類別的內聚


7.11.3 可讀性的內聚


7.11.4 可重用性的內聚


7.12 重構


7.12.1 重構與測試


7.12.2 重構的範例


7.13 語言獨立的重構


7.13.1 列舉類型


7.13.2 進一步解耦命令介面


7.14 設計指導方針


7.15 在不使用 BlueJ 的情況下執行


7.15.1 類別方法


7.15.2 主方法


7.15.3 類別方法的限制


7.16 總結


 


第二部分 應用結構


 


第 8 章 通過繼承改善結構


8.1 DoME 範例


8.1.1 DoME 類別與物件


8.1.2 DoME 原始碼


8.1.3 DoME 應用的討論


8.2 使用繼承


8.3 繼承層次結構


8.4 Java 中的繼承


8.4.1 繼承與存取權限


8.4.2 繼承與初始化


8.5 DoME:添加其他項目類型


8.6 繼承的優勢(到目前為止)


8.7 子類型


8.7.1 子類別與子類型


8.7.2 子類型與指派


8.7.3 子類型與參數傳遞


8.7.4 多型變數


8.7.5 類型轉換


8.8 Object 類別


8.9 自動包裝與包裝類別


8.10 集合層次結構


8.11 總結


 


第 9 章 更多關於繼承的內容


9.1 問題:DoME 的 print 方法


9.2 靜態類型與動態類型


9.2.1 從 Database 呼叫 print


9.3 覆寫


9.4 動態方法查找


9.5 方法中的 super 呼叫


9.6 方法多型


9.7 物件方法:toString


9.8 受保護的存取


9.9 另一個覆寫的繼承範例


9.10 總結


 


第 10 章 進一步的抽象技術


10.1 模擬


10.2 狐狸與兔子的模擬


10.2.1 狐狸與兔子專案


10.2.2 Rabbit 類別


10.2.3 Fox 類別


10.2.4 Simulator 類別:設置


10.2.5 Simulator 類別:模擬步驟


10.2.6 採取措施改善模擬


10.3 抽象類別


10.3.1 Animal 超類別


10.3.2 抽象方法


10.3.3 抽象類別


10.4 更多抽象方法


10.5 多重繼承


10.5.1 Actor 類別


10.5.2 通過抽象實現靈活性


10.5.3 選擇性繪製


10.5.4 可繪製的演員:多重繼承


10.6 介面


10.6.1 Actor 介面


10.6.2 介面的多重繼承


10.6.3 介面作為類型


10.6.4 介面作為規範


10.6.5 介面的進一步範例


10.6.6 抽象類別還是介面?


10.7 繼承的總結


10.8 總結


 


第 11 章 建立圖形使用者介面


11.1 介紹


11.2 元件、佈局與事件處理


11.3 AWT 與 Swing


11.4 ImageViewer 範例


11.4.1 首次實驗:創建一個框架


11.4.2 添加簡單元件


11.4.3 添加選單


11.4.4 事件處理


11.4.5 C
```