|2020ok Directory of FREE Online Books and FREE eBooks|
Thinking In Java
by Bruce Eckel
(Respecting the intellectual property of others is utmost important to us, we make every effort to make sure we only link to legitimate sites, such as those sites owned by authors and publishers. If you have any questions about these links, please contact us.)
Thinking in Java is a printed version of Bruce Eckel's online materials that provides a useful perspective on mastering Java for those with previous programming experience. The author's take on the essence of Java as a new programming language and the thorough introduction to Java's features make this a worthwhile tutorial.
Thinking in Java begins a little esoterically, with the author's reflections on why Java is new and better. (This book's choice of font for chapter headings is remarkably hard on the eyes.) The author outlines his thoughts on why Java will make you a better programmer, without all the complexity. The book is better when he presents actual language features. There's a tutorial to basic Java types, keywords, and operators. The guide includes extensive source code that is sometimes daunting (as with the author's sample code for all the Java operators in one listing.) As such, this text will be most useful for the experienced developer.
The text then moves on to class design issues, when to use inheritance and composition, and related topics of information hiding and polymorphism. (The treatment of inner classes and scoping will likely seem a bit overdone for most readers.) The chapter on Java collection classes for both Java Developer's Kit (JDK) 1.1 and the new classes, such as sets, lists, and maps, are much better. There's material in this chapter that you are unlikely to find anywhere else.
Chapters on exception handling and programming with type information are also worthwhile, as are the chapters on the new Swing interface classes and network programming. Although it adopts somewhat of a mixed-bag approach, Thinking in Java contains some excellent material for the object-oriented developer who wants to see what all the fuss is about with Java.
Thinking in Java has earned raves from programmers worldwide for its extraordinary clarity, careful organization, and small, direct programming examples. It's the definitive introduction to object-oriented programming in the language of the world wide web. From the fundamentals of Java syntax to its most advanced features, Thinking in Java is designed to teach, one simple step at a time. Fully updated for J2SE5 with many new examples and chapters.
Designed to teach the fundamentals of Java syntax & ultimately teach its most advanced features such as network programming, advanced object-oriented capabilities, & multithreading using an easy to read style. Paper. DLC: Java (Computer program language).
From the Back Cover
âThinking in Java should be read cover to cover by every Java programmer, then kept close at hand for frequent reference. The exercises are challenging, and the chapter on Collections is superb! Not only did this book help me to pass the Sun Certified Java Programmer exam; itâs also the first book I turn to whenever I have a Java question.â
âJim Pleger, Loudoun County (Virginia) GovernmentâMuch better than any other Java book Iâve seen. Make that âby an order of magnitudeâ.... Very complete, with excellent right-to-the-point examples and intelligent, not dumbed-down, explanations.... In contrast to many other Java books I found it to be unusually mature, consistent, intellectually honest, well-written, and precise. IMHO, an ideal book for studying Java.â
âAnatoly Vorobey, Technion University, Haifa, IsraelâAbsolutely one of the best programming tutorials Iâve seen for any language.â
âJoakim Ziegler, FIX sysopâThank you again for your awesome book. I was really floundering (being a non-C programmer), but your book has brought me up to speed as fast as I could read it. Itâs really cool to be able to understand the underlying principles and concepts from the start, rather than having to try to build that conceptual model through trial and error. Hopefully I will be able to attend your seminar in the not-too-distant future.â
âRandall R. Hawley, automation technician, Eli Lilly & Co.âThis is one of the best books Iâve read about a programming language.... The best book ever written on Java.â
âRavindra Pai, Oracle Corporation, SUNOS product lineâBruce, your book is wonderful! Your explanations are clear and direct. Through your fantastic book I have gained a tremendous amount of Java knowledge. The exercises are also fantastic and do an excellent job reinforcing the ideas explained throughout the chapters. I look forward to reading more books written by you. Thank you for the tremendous service that you are providing by writing such great books. My code will be much better after reading Thinking in Java. I thank you and Iâm sure any programmers who will have to maintain my code are also grateful to you.â
âYvonne Watkins, Java artisan, Discover Technologies, Inc.âOther books cover the what of Java (describing the syntax and the libraries) or the how of Java (practical programming examples). Thinking in Java is the only book I know that explains the why of Java: Why it was designed the way it was, why it works the way it does, why it sometimes doesnât work, why itâs better than C++, why itâs not. Although it also does a good job of teaching the what and how of the language, Thinking in Java is definitely the thinking personâs choice in a Java book.â
âRobert S. StephensonAwards for Thinking in Java2003 Software Development Magazine Jolt Award for Best Book
2003 Java Developerâs Journal Readerâs Choice Award for Best Book
2001 JavaWorld Editorâs Choice Award for Best Book
2000 JavaWorld Readerâs Choice Award for Best Book
1999 Software Development Magazine Productivity Award
1998 Java Developerâs Journal Editorâs Choice Award for Best Book
Thinking in Java has earned raves from programmers worldwide for its extraordinary clarity, careful organization, and small, direct programming examples. From the fundamentals of Java syntax to its most advanced features, Thinking in Java is designed to teach, one simple step at a time.
Download seven free sample chapters from Thinking in Java, Fourth Edition. Visit http://mindview.net/Books/TIJ4.
About the Author
Bruce Eckel is president of MindView, Inc. (www.MindView.net), which provides public and private training seminars, consulting, mentoring, and design reviews in object-oriented technology and design patterns. He is the author of several books, has written more than fifty articles, and has given lectures and seminars throughout the world for more than twenty years. Bruce has served as a voting member of the C++ Standards Committee. He holds a B.S. in applied physics and an M.S. in computer engineering.
Excerpt. © Reprinted by permission. All rights reserved.
I originally approached Java as “just another programming language,” which in many senses it is.
But as time passed and I studied it more deeply, I began to see that the fundamental intent of this language was different from other languages I had seen up to that point.
Programming is about managing complexity: the complexity of the problem you want to solve, laid upon the complexity of the machine in which it is solved. Because of this complexity, most of our programming projects fail. And yet, of all the programming languages of which I am aware, almost none have gone all out and decided that their main design goal would be to conquer the complexity of developing and maintaining programs.1 Of course, many language design decisions were made with complexity in mind, but at some point there were always other issues that were considered essential to be added into the mix. Inevitably, those other issues are what cause programmers to eventually “hit the wall” with that language. For example, C++ had to be backwards-compatible with C (to allow easy migration for C programmers), as well as efficient. Those are both very useful goals and account for much of the success of C++, but they also expose extra complexity that prevents some projects from being finished (certainly, you can blame programmers and management, but if a language can help by catching your mistakes, why shouldn’t it?). As another example, Visual BASIC (VB) was tied to BASIC, which wasn’t really designed to be an extensible language, so all the extensions piled upon VB have produced some truly unmaintainable syntax. Perl is backwards-compatible with awk, sed, grep, and other Unix tools it was meant to replace, and as a result it is often accused of producing “write-only code” (that is, after a while you can’t read it). On the other hand, C++, VB, Perl, and other languages like Smalltalk had some of their design efforts focused on the issue of complexity and as a result are remarkably successful in solving certain types of problems.
What has impressed me most as I have come to understand Java is that somewhere in the mix of Sun’s design objectives, it seems that there was a goal of reducing complexity for the programmer. As if to say, “We care about reducing the time and difficulty of producing robust code.” In the early days, this goal resulted in code that didn’t run very fast (although this has improved over time), but it has indeed produced amazing reductions in development time—half or less of the time that it takes to create an equivalent C++ program. This result alone can save incredible amounts of time and money, but Java doesn’t stop there. It goes on to wrap many of the complex tasks that have become important, such as multithreading and network programming, in language features or libraries that can at times make those tasks easy. And finally, it tackles some really big complexity problems: cross-platform programs, dynamic code changes, and even security, each of which can fit on your complexity spectrum anywhere from “impediment” to “show-stopper.” So despite the performance problems that we’ve seen, the promise of Java is tremendous: It can make us significantly more productive programmers.
In all ways—creating the programs, working in teams, building user interfaces to communicate with the user, running the programs on different types of machines, and easily writing programs that communicate across the Internet—Java increases the communication bandwidth between people.
I think that the results of the communication revolution may not be seen from the effects of moving large quantities of bits around. We shall see the true revolution because we will all communicate with each other more easily: one-on-one, but also in groups and as a planet. I’ve heard it suggested that the next revolution is the formation of a kind of global mind that results from enough people and enough interconnectedness. Java may or may not be the tool that foments that revolution, but at least the possibility has made me feel like I’m doing something meaningful by attempting to teach the language.
Java SE5 and SE6
This edition of the book benefits greatly from the improvements made to the Java language in what Sun originally called JDK 1.5, and then later changed to JDK5 or J2SE5, then finally they dropped the outdated “2” and changed it to Java SE5. Many of the Java SE5 language changes were designed to improve the experience of the programmer. As you shall see, the Java language designers did not completely succeed at this task, but in general they made large steps in the right direction.
One of the important goals of this edition is to completely absorb the improvements of Java SE5/6, and to introduce and use them throughout this book. This means that this edition takes the somewhat bold step of being “Java SE5/6-only,” and much of the code in the book will not compile with earlier versions of Java; the build system will complain and stop if you try. However, I think the benefits are worth the risk.
If you are somehow fettered to earlier versions of Java, I have covered the bases by providing free downloads of previous editions of this book via www.MindView.net. For various reasons, I have decided not to provide the current edition of the book in free electronic form, but only the prior editions.
This book was a monumental, time-consuming project, and before it was published, Java SE6 (code-named mustang) appeared in beta form. Although there were a few minor changes in Java SE6 that improved some of the examples in the book, for the most part the focus of Java SE6 did not affect the content of this book; the features were primarily speed improvements and library features that were outside the purview of this text.
The code in this book was successfully tested with a release candidate of Java SE6, so I do not expect any changes that will affect the content of this book. If there are any important changes by the time Java SE6 is officially released, these will be reflected in the book’s source code, which is downloadable from www.MindView.net.
The cover indicates that this book is for “Java SE5/6,” which means “written for Java SE5 and the very significant changes that version introduced into the language, but is equally applicable to Java SE6.”
The 4th edition
The satisfaction of doing a new edition of a book is in getting things “right,” according to what I have learned since the last edition came out. Often these insights are in the nature of the saying “A learning experience is what you get when you don’t get what you want,” and my opportunity is to fix something embarrassing or simply tedious. Just as often, creating the next edition produces fascinating new ideas, and the embarrassment is far outweighed by the delight of discovery and the ability to express ideas in a better form than what I have previously achieved.
There is also the challenge that whispers in the back of my brain, that of making the book something that owners of previous editions will want to buy. This presses me to improve, rewrite and reorganize everything that I can, to make the book a new and valuable experience for dedicated readers.
The CD-ROM that has traditionally been packaged as part of this book is not part of this edition. The essential part of that CD, the Thinking in C multimedia seminar (created for MindView by Chuck Allison), is now available as a downloadable Flash presentation. The goal of that seminar is to prepare those who are not familiar enough with C syntax to understand the material presented in this book. Although two of the chapters in this book give decent introductory syntax coverage, they may not be enough for people without an adequate background, and Thinking in C is intended to help those people get to the necessary level.
The Concurrency chapter (formerly called “Multithreading”) has been completely rewritten to match the major changes in the Java SE5 concurrency libraries, but it still gives you a basic foundation in the core ideas of concurrency. Without that core, it’s hard to understand more complex issues of threading. I spent many months working on this, immersed in that netherworld called “concurrency,” and in the end the chapter is something that not only provides a basic foundation but also ventures into more advanced territory.
There is a new chapter on every significant new Java SE5 language feature, and the other new features have been woven into modifications made to the existing material. Because of my continuing study of design patterns, more patterns have been introduced throughout the book as well.
The book has undergone significant reorganization. Much of this has come from the teaching process together with a realization that, perhaps, my perception of what a “chapter” was could stand some rethought. I have tended towards an unconsidered belief that a topic had to be “big enough” to justify being a chapter. But especially while teaching design patterns, I find that seminar attendees do best if I introduce a single pattern and then we immediately do an exercise, even if it means I only speak for a brief time (I discovered that this pace was also more enjoyable for me as a teacher). So in this version of the book I’ve tried to break chapters up by topic, and not worry about the resulting length of the chapters. I think it has been an improvement.
I have also come to realize the importance of code testing. Without a built-in test framework with tests that are run every time you do a build of your ...
Related Free eBooks