Beginning Java Objects 2nd Edition.pdf
(
11801 KB
)
Pobierz
184562250 UNPDF
Beginning Java Objects
From Concepts to Code, Second Edition
JACQUIE BARKER
Beginning Java Objects: From Concepts to Code, Second Edition
Copyright © 2005 by Jacquie Barker
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying, recording, or by any information storage or retrieval
system, without the prior written permission of the copyright owner and the publisher.
ISBN (pbk): 1-59059-457-6
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence
of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark
owner, with no intention of infringement of the trademark.
Lead Editor: Steve Anglin
Technical Reviewer: James Huddleston
Editorial Board: Steve Anglin, Dan Appleman, Ewan Buckingham, Gary Cornell, Tony Davis, Jason Gilmore,
Jonathan Hassell, Chris Mills, Dominic Shakeshaft, Jim Sumser
Assistant Publisher: Grace Wong
Project Manager: Beckie Stones
Copy Edit Manager: Nicole LeClerc
Copy Editors: Nicole LeClerc, Ami Knox
Production Manager: Kari Brooks-Copony
Production Editor: Katie Stence
Compositor and Artist: Kinetic Publishing Services, LLC
Proofreader: Sue Boshers
Indexer: Broccoli Information Management
Interior Designer: Van Winkle Design Group
Cover Designer: Kurt Krames
Manufacturing Manager: Tom Debolski
Distributed to the book trade in the United States by Springer-Verlag New York, Inc., 233 Spring Street,
6th Floor, New York, NY 10013, and outside the United States by Springer-Verlag GmbH & Co. KG,
Tiergartenstr. 17, 69112 Heidelberg, Germany.
In the United States: phone 1-800-SPRINGER, fax 201-348-4505, e-mail
orders@springer-ny.com
, or visit
http://www.springer-ny.com
. Outside the United States: fax +49 6221 345229, e-mail
orders@springer.de
,
or visit
http://www.springer.de
.
For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley,
CA 94710. Phone 510-549-5930, fax 510-549-5939, e-mail
info@apress.com
, or visit
http://www.apress.com
.
The information in this book is distributed on an “as is” basis, without warranty. Although every precaution
has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to
any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly
by the information contained in this work.
The source code for this book is available to readers at
http://www.apress.com
in the Downloads section.
In loving memory of “the Weens”—sweet little Shylow and funny little Chloe—
who graced our lives with unconditional love for almost 17 years.
Contents at a Glance
About the Author
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii
About the Technical Reviewer
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv
Acknowledgments
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvii
Preface
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxix
Introduction
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxi
PART 1
■ ■ ■
The ABCs of Objects
CHAPTER 1
Abstraction and Modeling
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
CHAPTER 2
Some Java Basics
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
CHAPTER 3
Objects and Classes
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
CHAPTER 4
Object Interactions
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
CHAPTER 5
Relationships Between Objects
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
CHAPTER 6
Collections of Objects
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
CHAPTER 7
Some Final Object Concepts
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
PART 2
■ ■ ■
Object Modeling 101
CHAPTER 8
The Object Modeling Process in a Nutshell
. . . . . . . . . . . . . . . . . . . . 333
CHAPTER 9
Formalizing Requirements Through Use Cases
. . . . . . . . . . . . . . . . . 343
CHAPTER 10
Modeling the Static/Data Aspects of the System
. . . . . . . . . . . . . . . 355
CHAPTER 11
Modeling the Dynamic/Behavioral Aspects
of the System
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
CHAPTER 12
Wrapping Up Our Modeling Efforts
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
v
vi
■
CONTENTS AT A GLANCE
PART 3
■ ■ ■
Translating an Object Blueprint
into Java Code
CHAPTER 13
Rounding Out Your Java Knowledge
. . . . . . . . . . . . . . . . . . . . . . . . . . . 441
CHAPTER 14
Transforming Your Model into Java Code
. . . . . . . . . . . . . . . . . . . . . . 567
CHAPTER 15
Rounding Out Your Application, Part 1: Adding a Data
Access Layer
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619
CHAPTER 16
Rounding Out Your Application, Part 2: Adding a
Presentation Layer
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681
CHAPTER 17
SRS, Take 3: Adding a GUI
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773
CHAPTER 18
Next Steps
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 831
PART 4
■ ■ ■
Appendixes
APPENDIX A
Suggestions for Using This Book As a Textbook
. . . . . . . . . . . . . . . . 839
APPENDIX B
Alternative Case Studies
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 843
APPENDIX C
Setting Up Your Java Development Environment
. . . . . . . . . . . . . . . 849
APPENDIX D
Downloading and Compiling the Book’s Source Code
. . . . . . . . . . 865
APPENDIX E
Note to Experienced C++ Programmers
. . . . . . . . . . . . . . . . . . . . . . . 867
APPENDIX F
How Polymorphism Works Behind the Scenes
(Static vs. Dynamic Binding)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 873
APPENDIX G
Collections Prior to J2SE 5.0
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 879
APPENDIX H
Programming 101, and the Role of a Compiler
. . . . . . . . . . . . . . . . . 891
INDEX
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 897
Plik z chomika:
r41lblast
Inne pliki z tego folderu:
A Tester's Guide to .NET Programming.pdf
(20132 KB)
A Programmer's Introduction to PHP 4.0.pdf
(4311 KB)
Accelerated CSharp 2010.pdf
(7008 KB)
Accelerated CSharp 2008.pdf
(6166 KB)
Adobe Coldfusion Anthology.pdf
(31579 KB)
Inne foldery tego chomika:
Pliki dostępne do 01.06.2025
C#
c# - C sharp
Dokumenty
Galeria
Zgłoś jeśli
naruszono regulamin