SKIP THE SHIPPING
Use code NOSHIP during checkout to save 40% on eligible eBooks, now through January 5. Shop now.
Register your product to gain access to bonus material or receive a coupon.
Gives students with little or no experience in writing computer programs a solid understanding of how computer systems work. Ex.___
Provides students with clear methodology for learning an object-oriented language. Ex.___
Provides students with the foundational material necessary for creating functional classes that can interact with one another. Ex.___
Frees student programmers from a need to know details of the windowing environment in which their programs will be run. Ex.__
Shows students how to create objects that run concurrently and share the available processor time between them, and alerts them to a number of new problems created by multithreaded programs. Ex.___
Encourages students to apply concepts at the point they are reached, and helps them feel confident about their understanding of key material throughout their progression of the text. Ex.___
Helps students gain a deeper understanding of points made by looking at real-world designs and implementations of problems. Ex.___
Gives students the opportunity to thoroughly grasp the main points of the material covered before moving on to the next section. Ex.___
This well-organized, clearly written and visually engaging book provides hands-on experience as it guides the reader through all of Java's functions and capabilities. This comprehensive text shows readers how to use such a versatile object-oriented programming language as a primary tool in many different aspects of programming work. It is designed primarily as a first programming text. Java's everyday applicability is reinforced through the book's many, interesting UK case studies. With an "objects-early" approach, David Barnes stresses the importance of objects for a clear methodology of learning an object-oriented language. Throughout the book, the author emphasizes the importance of good programming style, particularly the need to maintain an object's integrity from outside interference.
http://www.prenhall.com/barnes and links to the author's Web site <http://www.cs.ukc.ac.uk/people/staff/djb/Book/Index.html>
I. JAVA FUNDAMENTALS.
1. Bits, Bytes, and Java.II. FURTHER LANGUAGE FEATURES.
11. Exceptions.III. GUI PACKAGES.
16. AWT Applications.IV. ADVANCED FEATURES.
18. Threads.V. APPLETS.
20. Applets.VI. JAVA FOR SIMULATION.
21. Simulation.APPENDICES.
A: The Primitive Data Types.
Introduction
This book is designed for those readers who wish to start learning to program in an object-oriented programming language. It has been designed primarily as a first programming text. It is also suitable for those who already have some experience with another programming language, and who now wish to move on to an object-oriented one. Indeed, much of the material is based on courses delivered by the author to students with a wide range of both non-programming and programming backgrounds. The language we use to teach object-oriented programming is Java.
Since its arrival on the scene in 1995, the adoption of Java as a primary programming language has been amazing. In its favor at the time of its arrival were the facts that it was an object-oriented language, and that it offered a safer and more portable alternative to other languages. It also rode the wave of interest in the World Wide Web, with which it integrated well in its provision of applets. Since then, however, Java has come to be regarded as a genuine mainstream programming language.
Our approach in this book is to regard Java as a language that readers will want to use as a primary tool in many different areas of their programming work - not just for creating programs with graphical content within Web pages. For this reason, in the early chapters we have avoided an emphasis on creating applets and GUI-based programs. While being able to create GUI-based programs is superficially attractive, the language concepts required to create them properly are, in fact, quite advanced. Nevertheless, we recognize that visual examples are much more fun to create and work with. To this end, many of our early examples and exercises are enhanced by the provision of visual material that makes them more interesting to experiment with. An object-oriented language makes this approach relatively easy, without the reader needing to become enmeshed in the details of how they are implemented.
Key Features
The following are key features of this book:
Chapter Outlines
In Chapter 2 through Chapter 15, we cover the most important features of object-oriented programming and the Java language. Within those chapters, exercises have been deliberately positioned between sections, rather than grouped at the end. We recommend that these exercises are attempted at the point they are reached, because many of them are designed to reinforce important concepts that you should feel confident with before moving forward. Each of these chapters also includes periodic reviews to reprise and reinforce the main points of the material covered in the preceding sections. From time to time, case studies are used in order to reinforce or bring out further points that are best made in looking at the design and implementation of a larger problem.
In the remaining chapters, we describe in detail how to use many of the GUI components provided by the AWT and Swing classes, how to write multi-threaded programs, and how to interact with programs across a network. We conclude with a chapter on simulation - a common application area for object-oriented programs. Throughout the book, there is an emphasis on the importance of good programming style; particularly the need to maintain an object's integrity from outside interference.
The individual chapters are organized as follows:
The Java API continues to grow, and it is impossible to cover it all in detail within the scope of a teaching text such as this. In Chapter 16 through Chapter 20, therefore, we only attempt to sample the riches of the classes it defines, and provide illustrations of something of what is possible with them. By that stage, our hope is that the reader will be able to harness the power that object-oriented programming in Java permits, and be able to create their own interesting and practical everyday programs.
Supporting Materials
The examples we use have been developed using the Java 2 SDK, which is freely available from the JavaSoft Web site (http://www.javasoft.com). You are strongly recommended to obtain a copy of the documentation on the Java API which is available from the JavaSoft site. The source code for the examples in this book is available from the Companion Website: http://ww.prenhall.com/barnes
Acknowledgements
I have the privilege of working in a Computer Science Department in which excellent teaching is both encouraged and practiced. I have benefited enormously from working with many talented colleagues. I have probably received help and picked up ideas from most of them over the years, but I would like to thank a few by name for the particular help and support that they have given to me while putting this book together.
David Bateman - a legendary source of good teaching and great ideas for assignments. Thanks to him for allowing me to use his chess program idea. Tim Hopkins, for being a constant source of books and sink of videos (neither of which seem to get returned by either of us), for his willingness to proofread, and for his good humour sic!. Janet Linington, for many discussions about the best ways to teach introductory programming, and for the gas station idea that ultimately led to the chapter on simulation. Simon Thompson, who is also an excellent teacher. Thanks to him for encouraging me to start this project in the first place, and for his introducing me to Jackie Harbor (now at Macmillan) that made it happen. Ian Utting, who pioneered the teaching of object-oriented software engineering at UKC and who currently shares the teaching of the first-year course with me. He remains a constant source of wisdom in this area and contributed important ideas to the chess program.
I would also like to thank David Till of City University, for being willing to let me use his and the late Michael Bell's 'soup salting' analogy as the basis of some of my early examples. At Pearson, thanks to my publisher, Alan Apt, and his editorial assistant, Toni Holm, both of whom have been extremely efficient at making this book happen. They provided superb support at the other end of a stream of email messages from me, and were always patient when deadlines were missed! To the several reviewers of this book, I also owe a debt of thanks. Their diligence and thoroughness were remarkable, and much appreciated. During the production stages, Amy Ryan and her team at Interactive Composition Corporation did an amazing job, accommodating my frequent changes, and yet keeping us ahead of schedule.
Finally, to my immediate family, for putting up with the extreme working hours that creating a book seems to require, and to the Scottish contingent for accommodating an antisocial me and my laptop over Christmas!
David Barnes
December 1999