On Java 8.pdf

所需积分/C币:23 2019-06-22 16:44:50 12.47MB PDF

On Java 8.pdf,http://www.OnJava8.com 1
designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals Java is a trademark of oracle. inc. windows 95. windows nt Windows 2000. Windows xp. windows 7. windows 8 and windows 10 are trademarks of Microsoft Corporation. All other product names and company names mentioned herein are the property of their respective owners. The author and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained erein This book was created as an e book for tablets and computers. That is t was not first created for print and then converted It is an ebook first all layout and formatting is designed to optimize your viewing experience on the various e Book reading platforms and systems Coverdesignbydanielwill-harris,www.will-harris.com Preface This book teaches the most modern form of Java programming using the teatures in the 8th version of that language My previous Java book, Thinking in Java, 4th Edition(Prentice Hall 2006), is still useful for programming in Java 5, the version of the language used for Android programming. But especially with the advent of Java 8, the language has changed significantly enough that new Java code feels and reads differently. This justified the two-year effort of creating a new book On Java 8 is designed for someone with a basic foundation in programming For beginners, web sites like Code. org and Khan Academy can provide at least some of that background, along with the Thinking in C seminar freely available at the onJava8 Site. Services like YouTube, blogs and Stackoverflow have made finding answers ridiculously easy compared to just a few years ago when we relied on print media. Combine these with perseverance, and you can use this book as your first programming text. It's also intended for professional programmers who want to expand their knowledge I am grateful for all the benefits from Thinking in Java, mostly in the form of speaking engagements all over the world. It has proved invaluable in creating connections with people and companies for my Reinventing Business project. One of the reasons i finally wrote this book is to support my reinventing Business research, and it seems the next logical step is to actually create a so-called Teal Organization I hope this book can become a kind of crowdfunding for that project Goals Each chapter teaches a concept, or a group of associated concepts, without relying on features that haven't yet been introduced. That way you can digest each piece in the context of your current knowledge before moving on My goals in this book are to 1. Present the material one step at a time so you can easily incorporate each idea before moving on, and to carefully sequence the presentation of features so youre exposed to a topic before you see it in use. This isn't always possible; in those situations,a brief introductory description is given 2. Use examples that are as simple and short as possible this sometimes prevents me from tackling" real world problems, but I've found that beginners are usually happier when they can understand every detail of an example rather than being impressed by the scope of the problem it solves. For this i mig receive criticism for using toy examples, "but I'm willing to accept that in favor of producing something pedagogically useful 3. Give you what i think is important for you to understand about the language, rather than everything i know i believe there is an information importance hierarchy and there are some facts that 95 percent of programmers will never need to know-details that just confuse people and increase their perception of the complexity of the language. If you must think about it, it will also confuse the reader/maintainer of that code. so i advocate choosing a simpler approach 4. Provide you with a solid foundation so you understand the issues well enough to move on to more difficult coursework and books. anguage Design Errors Every language has design errors. New programmers experience deep uncertainty and frustration when they must wade through features and guess at what they should use and what they shouldnt It's embarrassing to admit mistakes but this bad beginner experience is a lot worse than the discomfort of acknowledging you were wrong about something. Alas, every failed language/library design experiment is forever embedded in the java distribution The Nobel laureate economist Joseph Stiglitz has a philosophy of life that applies here, called The Theory of escalating Commitment (The cost of continuing mista kes is borne by others, while the cost of admitting mistakes is borne by yourself. If you've read my past writings, you'll know that when i find design errors in a language, I tend to point them out. Java has developed a particularly avid following, folks who treat the language more like a country of origin and less like a programming tool. Because I've written about Java, they assume i am a fellow patriot. when i criticize the errors i find it tends to have two effects 1. Initially, a lot of"my-country-right-or-wrong "furor, which typically dies down to isolated pockets. Eventually-this can take years-the error is acknowledged and seen as just part of the history of Java 2. More importantly, new programmers dont go through the struggle of wondering why they"did it this way, especially the self-doubt that comes from finding something that just doesnt seem right and naturally assuming I must be doing it wrong or I just don' t get it. Worse, those who teach the language often go right along with the misconceptions rather than delving in and analyzing the issue By understanding the language design errors, new programmers can understand that something was a mistake, and move ahead Understanding language and library design errors is essential because of the impact they have on programmer productivity. Some companies and teams choose to avoid certain features because while seductive on the surface, those features can block your progress when you least expect it. Design errors also inform the creation and adoption of new languages. It's fun to explore what can be done with a language, but design errors tell you what can't be done with that language For many years, I honestly felt a lack of care from the Java designers regarding their users. Some of these errors seemed so blatant, so poorly thought-out, that it appeared the designers had some other motivation in mind instead of serving their users. There was a lot of notoriety around the Java language for a long time, and perhaps that's where the seduction was. This seeming lack of respect for programmers is the major reason i moved away from Java and didnt want anything to do with it for such a long time When i did start looking into java again something about Java 8 felt very different, as if a fundamental shift had occurred in the designers attitude about the language and its users. Many features and libraries that had been warts on the language were fixed after years of ignoring user complaints. New features felt very different, as if there were new folks on board who were extremely interested in programmer experience. These features were-finally--working to make the language better rather than just quickly adding ideas without delving into their implications. And some of the new features are downright elegant(or at least, as elegant as possible given Java constraints). I can only guess that some person or people have departed the language group and this has changed the perspective Because of this new focus by the language developers--and i dont think I'm imagining it--writing this book has been dramatically better than past experiences. Java 8 contains fundamental and important improvements. Alas, because of Java's rigid backwards-compatibility promise, these improvements required great effort so it's unlikely we'll see anything this dramatic again(I hope 'm wrong about this) Nonetheless, I applaud those who have turned the ship as much as they have and set the language on a better course. For the first time I can ever recall, I found myself saying"I love that? about some of the Java code i've been able to write in java 8 Ultimatel y the timing for this book seems good because java 8 introduces important features that strongly affect the way code is written, while-so far-Java 9 seems to focus on the understory of the


评论 下载该资源后可以进行评论 1

麦吉 实用的干货儿。。。 感谢

关注 私信 TA的资源