Java编程风格电子书,英文原版,Java代码书写的经典指导书,学习Java代码书写风格以及命名规则的圣经SIGS Reference library1.Object Methodology Overview CD-ROM. Doug Rosenberg2. Directory of Object Technology edited by dale. gaumer3. Dictionary of object Technology: The Definitive Desk referenceDonald g Firesmith and Edward M. Eykholt4. Next Generation Computing: Distributed Objects for Businessedited by peter Fingar, Dennis Read, and im Stikeleather5. C++ Gems.edited by Stanley B. Lippman6. OMT Insights: Perspectives on Modeling from the Journal ofObject-Oriented Programming. James Rumbaugh7. Best of Booch: Designing Strategies for Object TechnologyGrady Booch(Edited by Ed Eykholt)8. Wisdom of the gurus: A Vision for Object Technologyselected and edited by Charles F bowman9. Open Modeling Language(OML) Reference manualDonald firesmith, Brian Henderson-Sellers, and Jan graham10. JavaTM Gems: Jewels from Java"M Reportcollected and introduced by dwight deugo, Ph. D11. The Netscape Programmer's Guide: Using OlE to BuildComponentware Apps. Richard B Lam12. Advanced Object-Oriented Analysis and designUML·/mesJ.Ol13. The Patterns Handbook: Techniques, Strategies, andApplications edited by Linda rising14. Kent becks guide to better smalltalkA Sorted Collection Kent beck15. The Elements of Java Style. Al Vermeulen, et al16. More Java"M Gems.edited by dwight deugo, Ph. D17. More C++ Gems edited by robert C. martinAdditional Volumes in Preparationrogue WaveSOFTWAREThe elementsJava StyleAl vermeulenScot w. amblerGreg BumgardnerEldon metzTrevor MisfeldtJim ShurPatrick ThompsonCAMBRIDGEUNIVERSITY PRESSBOOKCAMBRIDGE UNIVERSITY PRESSCambridge, New York, Melbourne, Madrid, Cape Town, Singapore, Sao PauloCambridge University Press32 Avenue of the americas New york ny 10013-2473 USAwww.cambridge.orgInformationonthistitlewww.cambridge.org/978052177768iPublished in association with Sigs booksC Cambridge University Press 2000Al rights reservedThis publication is in copyright. Subject to statutory exceptionand to the provisions of relevant collective licensing agreements,no reproduction of any part may take place withouthe written permission of Cambridge university pressAny product mentioned in this book may be a trademark of its companyFirst published 20009th printing, 2007Design and Composition by david Van NessCover design by Andrea CammarataPrinted in the United States of AmericaA catalog record for this publication is available from the British libraryisBn 978-0-521-77768-I paperbackCambridge University Press hasbility fothe persistence or accuracy of URls for extemal orthird-party Internet Web sites referred to in this publicationand does not guarantee that any content on suchWeb sites is, or will remain, accurate or appropriateThe authors would like to thankour loved ones for enduring uswhile we toiled away on this bookTable of contentsefaceAudienceAcknowledgmentsXIntroduction1. General Principles2. Formatting C。 venti。ns3. Naming C。 nventions15Package Names18pe Names20Class namesInterface Names22Method Names23Variable names25Field names27Parameter names28Constant Names29THE ELEMENTS OF JAVA STYLE。D。 cementation Conventions3Comment Types32Documentation Comments36ommen stydle38Comment Content49nternal comments525. Programming Conventions57pe WateryStatements and ExpressionsConstructionException Handling72Assertions5Concurrency79Synchronization80Efficiency856. Packaging Conventions.89Summary95Glossary105Bibliography119Index123PrefaceT ROGUE WAVE, we sell C+t and java software components. We have always included source code with ourproducts. Customers often browse through the code to get afeeling, not just for how it works, but for how to write goodsoftware. As a result, we have always felt pressure--maybemore pressure than most companies-to have good, consis-tent style throughout our source codethe company grew, making sure programmers were all fol-inghe same rules became difficult. To address this, ourfounder and first programmer, Tom Keffer, wrote 35 pagesthat explained how we write C++ code at rogue Wave. Wepassed the document around and made sure new hires got acopy. It worked. When customers asked how we maintainedconsistency in our coding, we told them about Toms"C++Design, Implementation, and Style Guide, and sent them acopy. Word spread and we turned Toms document into atechnical report. We sent out thousands of copies andreceived terrific positive feedbackWhen Java came along, we decided we needed a documentlike the C++ guide a note went out to our internaljavadev@roguewave com mailing list soliciting rules for Javause that we should be using. The resulting list of rules becamethe first draft of the Rogue Wave Java Style GuideAs the list of rules grew, the style guuide began to look moreand more like a real book. This time, we decided to publishour guide instead of simply issuing another rogue wave technical report To our amazement the folks at Cambridge uni-versity Press thought this was a great idea, and The elementsofjava Style was born