SØG - mellem flere end 8 millioner bøger:
Viser: Objects First with Java - A Practical Introduction Using BlueJ
Objects First with Java
A Practical Introduction Using BlueJ
David J. Barnes og Michael Kölling
(2011)
Sprog: Engelsk
Detaljer om varen
- 5. Udgave
- Paperback: 560 sider
- Udgiver: Pearson Education, Limited (December 2011)
- Forfattere: David J. Barnes og Michael Kölling
- ISBN: 9780132492669
This is the only introductory programming textbook that uses the BlueJ integrated development environment (IDE) to teach introductory and object-oriented programming principles using Java. Its close integration with the BlueJ development environment allows this book to focus on key aspects of object-oriented software development from day one. BlueJ's clear visualization of classes and objects means that readers can immediately appreciate the differences between them, and gain a much better understanding of the nature of an object than they would from simply reading source code. Unlike traditional textbooks, the chapters are not ordered by language features but by software development concepts. Language features are introduced as a response to the problems to be solved. A large number of different, interesting projects are used to provide variety and avoid the monotony of a running problem. This book takes an "objects first" approach to teaching the traditionally difficult concepts of objects in a manipulative visual form. Throughout, the emphasis is on developing a practical approach to programming, with students encouraged to add code to existing programs rather than working with an intimidating sheet of blank paper. This textbook is printed in four-color to aid pedagogy and reader learning.
Part 1 Foundations of object orientation 1
Chapter 1 Objects and classes 3
1.1 Objects and classes 3
1.2 Creating objects 4
1.3 Calling methods 5
1.4 Parameters 6
1.5 Data types 7
1.6 Multiple instances 8
1.7 State 8
1.8 What is in an object? 9
1.9 Java code 10
1.10 Object interaction 12
1.11 Source code 12
1.12 Another example 14
1.13 Return values 14
1.14 Objects as parameters 14
1.15 Summary 16
Chapter 2 Understanding class definitions 18
2.1 Ticket machines 18
2.1.1 Exploring the behavior of a na ve ticket machine 19
2.2 Examining a class definition 20
2.3 The class header 22
2.3.1 Keywords 23
2.4 Fields, constructors, and methods 23
2.4.1 Fields 24
2.4.2 Constructors 27
2.5 Parameters: receiving data 28
2.5.1 Choosing variable names 30
2.6 Assignment 30
2.7 Methods 31
2.8 Accessor and mutator methods 33
2.9 Printing from methods 36
2.10 Method summary 38
2.11 Summary of the na ve ticket machine 38
2.12 Reflecting on the design of the ticket machine 39
2.13 Making choices: the conditional statement 42
2.14 A further conditional-statement example 44
2.15 Scope highlighting 45
2.16 Local variables 46
2.17 Fields, parameters, and local variables 48
2.18 Summary of the better ticket machine 49
2.19 Self-review exercises 50
2.20 Reviewing a familiar example 51
2.21 Calling methods 54
2.22 Experimenting with expressions: the Code Pad 55
2.23 Summary 58
Chapter 3 Object interaction 62
3.1 The clock example 62
3.2 Abstraction and modularization 63
3.3 Abstraction in software 64
3.4 Modularization in the clock example 64
3.5 Implementing the clock display 65
3.6 Class diagrams versus object diagrams 66
3.7 Primitive types and object types 67
3.8 The ClockDisplay source code 67
3.8.1 Class NumberDisplay 68
3.8.2 String concatenation 72
3.8.3 The modulo operator 73
3.8.4 Class ClockDisplay 73
3.9 Objects creating objects 77
3.10 Multiple constructors 78
3.11 Method calls 79
3.11.1 Internal method calls 79
3.11.2 External method calls 79
3.11.3 Summary of the clock display 81
3.12 Another example of object interaction 81
3.12.1 The mail-system example 82
3.12.2 The this keyword 83
3.13 Using a debugger 85
3.13.1 Setting breakpoints 85
3.13.2 Single stepping 87
3.13.3 Stepping into methods 88
3.14 Method calling revisited 88
3.15 Summary 89
Chapter 4 Grouping objects 92
4.1 Building on themes from
Chapter 3 92
4.2 The collection abstraction 93
4.3 An organizer for music files 94
4.4 Using a library class 95
4.4.1 Importing a library class 97
4.4.2 Diamond notation 98
4.4.3 Key methods of ArrayList 98
4.5 Object structures with collections 98
4.6 Generic classes 100
4.7 Numbering within collections 101
4.7.1 The effect of removal on numbering 102
4.7.2 The general utility of numbering with collections 103
4.8 Playing the music files 104
4.8.1 Summary of the music organizer 106
4.9 Processing a whole collection 106
4.9.1 The for-each loop 107
4.9.2 Selective processing of a collection 109
4.9.3 A limitation of using strings 111
4.9.4 Summary of the for-each loop 111
4.10 Indefinite iteration 112
4.10.1 The while loop 112
4.10.2 Iterating with an index variable 114
4.10.3 Searching a collection 115
4.10.4 Some non-collection examples 118
4.11 Improving structure-the Track class 119
4.12 The Iterator type 122
4.12.1 Index access versus iterators 124
4.12.2 Removing elements 125
4.13 Summary of the music-organizer project 126
4.14 Another example: An auction system 128
4.14.1 Getting started with the project 129
4.14.2 The null keyword 130
4.14.3 The Lot class 130
4.14.4 The Auction class 131
4.14.5 Anonymous objects 134
4.14.6 Chaining method calls 135
4.14.7 Using collections 136
4.15 Flexible-collection summary 138
4.16 Fixed-size collections 139
4.16.1 A log-file analyzer 139
4.16.2 Declaring array variables 142
4.16.3 Creating array objects 142
4.16.4 Using array objects 144
4.16.5 Analyzing the log file 144
4.16.6 The for loop 145
4.16.7 Arrays and the for-each loop 147
4.16.8 The for loop and iterators 148
4.17 Summary 150
Chapter 5 More-sophisticated behavior 15 3
5.1 Documentation for library classes 154
5.2 The TechSupport system 155
5.2.1 Exploring the TechSupport system 155
5.2.2 Reading the code 157
5.3 Reading class documentation 160
5.3.1 Interfaces versus implementation 162
5.3.2 Using library-class methods 163
5.3.3 Checking string equality 165
5.4 Adding random behavior 166
5.4.1 The Random class 166
5.4.2 Random numbers with limited range 167
5.4.3 Generating random responses 168
5.4.4 Reading documentation for parameterized classes 171
5.5 Packages and import 171
5.6 Using maps for associations 172
5.6.1 The concept of a map 173
5.6.2 Using a HashMap 173
5.6.3 Using a map for the TechSupport system 175
5.7 Using sets 177
5.8 Dividing strings 178
5.9 Finishing the TechSupport system 179
5.10 Writing class documentation 181
5.10.1 Using javadoc in BlueJ 182
5.10.2 Elements of class documentation 182
5.11 Public versus private 183
5.11.1 Information hiding 184
5.11.2 Private methods and public fields 185
5.12 Learning about classes from their interfaces 186
5.12.1 The scribble demo 186
5.12.2 Code completion 189
5.12.3 The bouncing-balls demo 190
5.13 Class variables and constants 190
5.13.1 The static keyword 191
5.13.2 Constants 192
5.14 Summary 193
Chapter 6 Designing classes 196
6.1 Introduction 197
6.2 The world-of-zuul game example 198
6.3 Introduction to coupling and cohesion 200
6.4 Code duplication
6.5 Making extensions 204
6.5.1 The task 205
6.5.2 Finding the relevant source code 205
6.6 Coupling 207
6.6.1 Using encapsulation to reduce coupling 207
6.7 Responsibility-driven design 212
6.7.1 Responsibilities and coupling 212
6.8 Localizing change 214
6.9 Implicit coupling 215
6.10 Thinking ahead 218
6.11 Cohesion 219
6.11.1 Cohesion of methods 219
6.11.2 Cohesion of classes 220
6.11.3 Cohesion for readability 221
6.11.4 Cohesion for reuse 221
6.12 Refactoring 222
6.12.1 Refactoring and testing 223
6.12.2 An example of refactoring 223
6.13 Refactoring for language independence 226
6.13.1 Enumerated types 227
6.13.2 Further decoupling of the command interface 229
6.14 Design guidelines 231
6.15 Executing without BlueJ 232
6.15.1 Class methods 232
6.15.2 The main method 233
6.15.3 Limitations in class methods 234
6.16 Summary 234
Chapter 7 Well-behaved objects 236
7.1 Introduction 236
7.2 Testing and debugging 237
7.3 Unit testing within BlueJ 237
7.3.1 Using inspectors 243
7.3.2 Positive versus negative testing 245
7.4 Test automation 245
7.4.1 Regression testing 245
7.4.2 Automated testing using JUnit 246
7.4.3 Recording a test 248
7.4.4 Fixtures 251
7.5 Debugging 252
7.6 Commenting and style 254
7.7 Manual walkthroughs 255
7.7.1 A high-level walkthrough 255
7.7.2 Checking state with a walkthrough 257
7.7.3 Verbal walkthroughs 260
7.8 Print statements 260
7.8.1 Turning debugging information on or off 262
7.9 Debuggers 263
7.10 Choosing a debugging strategy 265
7.11 Putting the techniques into practice 265
7.12 Summary 265
Part 2 Application structures 267
Chapter 8 Improving structure with inheritance 269
8.1 The network example 269
8.1.1 The network project: classes and objects 270
8.1.2 Network source code 273
8.1.3 Discussion of the network application 282
8.2 Using inheritance 282
8.3 Inheritance hierarchies 284
8.4 Inheritance in Java 285
8.4.1 Inheritance and access rights 286
8.4.2 Inheritance and initialization 286
8.5 Network: adding other post types 288
8.6 Advantages of inheritance (so far) 290
8.7 Subtyping 291
8.7.1 Subclasses and subtypes 293
8.7.2 Subtyping and assignment 293
8.7.3 Subtyping and parameter passing 295
8.7.4 Polymorphic variables 295
8.7.5 Casting 296
8.8 The Object class 297
8.9 Autoboxing and wrapper classes 298
8.10 The collection hierarchy 299
8.11 Summary 299
Chapter 9 More about inheritance 302
9.1 The problem: network''s display method 302
9.2 Static type and dynamic type 304
9.2.1 Calling display from NewsFeed 305
9.3 Overriding 307
9.4 Dynamic method lookup 309
9.5 Super call in methods 311
9.6 Method polymorphism 313
9.7 Object methods: toString 313
9.8 Object equality: equals and hashCode 316
9.9 Protected access 318
9.10 The instanceof operator 320
9.11 Another example of inheritance with overriding 321
9.12 Summary 323
Chapter 10 Further abstraction techniques 326
Polyteknisk Boghandel
har gennem mere end 50 år været studieboghandlen på DTU og en af Danmarks førende specialister i faglitteratur.
Vi lagerfører et bredt udvalg af bøger, ikke bare inden for videnskab og teknik, men også f.eks. ledelse, IT og meget andet.
Fysisk eller digital bog?
Ud over trykte bøger tilbyder vi tre forskellige typer af digitale bøger:
Vital Source Bookshelf: En velfungerende ebogsplatform, hvor bogen downloades til din computer og/eller mobile enhed.
Du skal bruge den gratis Bookshelf software til at læse læse bøgerne - der er indbygget gode værktøjer til f.eks. søgning, overstregning, notetagning mv. I langt de fleste tilfælde vil du samtidig have en sideløbende 1825 dages online adgang. Læs mere om Vital Source bøger
Levering: I forbindelse med købet opretter du et login. Når du har installeret Bookshelf softwaren, logger du blot ind og din bog downloades automatisk.
Adobe ebog: Dette er Adobe DRM ebøger som downloades til din lokale computer eller mobil enhed.
For at læse bøgerne kræves særlig software, som understøtter denne type. Softwaren er gratis, men du bør sikre at du har rettigheder til installere software på den maskine du påtænker at anvende den på. Læs mere om Adobe DRM bøger
Levering: Et download link sendes pr email umiddelbart efter købet.
Ibog: Dette er en online bog som kan læses på udgiverens website.
Der kræves ikke særlig software, bogen læses i en almindelig browser.
Levering: Vores medarbejder sender dig en adgangsnøgle pr email.
Vi gør opmærksom på at der ikke er retur/fortrydelsesret på digitale varer.