100% found this document useful (9 votes)
1K views

O'Reilly Head First Object-Oriented Design and Analysis PDF

Uploaded by

Amr
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
100% found this document useful (9 votes)
1K views

O'Reilly Head First Object-Oriented Design and Analysis PDF

Uploaded by

Amr
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 603
Psscs ie wM HU IW me WO CR CeRO LOI tca Head First Object-Oriented Analysis @ Design @ Gs =F Impress friends with your UML prowess ‘Load important 00 Bend your mind ‘ arcuny dobons of design principles straight OO exercises } inte your brain See how polymorphism, encapsulation and inheritance helped Jen vefactor her love life Avoid embarrassing Pelationship mistakes Lon aba Praise for other Head First books by the authors “When arriving home after a 10-hour day at the of throu ice programming, who has the energy to plow h yet another new facet of emerging technology? If a developer is going to invest free time in sel-deiven career development, should it not be at least remotely enjoyable? Judging from the content of OReilly’s new release Head Rush Ajax, the answer is yes...Head Rush Ajav is a most enjoyable k into the world of Ajax web applications, well worth the investment in time and money.” — Barry Hawkins, Slashdot.org anchpad “By starting with simple concept: and examples, the book gently takes the reader from humble beginnings to (by the end of the book) where the reader should be comfortable creating Ajax-based websites... Probably the best web designer centric book on Ajax.” — Stefan Mischook, Killersites.com Using the irreverent style common of the Head First! Head Rusk series of books, this book starts at the beginning and introduces you to all you need to know to be able to write the JavaScript that will bath send requests to the server and update the page with the results when the returned..One of the best things about this book (apart form the excellent explanations of how the code works) is that it also looks at security issues...If you learn Ajax from this book you are unlikely to forget much of what you learn.” — Stephen Chapman, JavaScript.About.com. “Head Rusk Aje is the book if you sant to cut through all the hype and learn how to make your web apps sparkled. ..your users will love you for i — Kristin Stromberg, Aguirre International If you know some H about what all the L, a dollop of CSS, a little JavaScript, and a bit of PHE, but you're mystified x hype is about, this book is for you... You'll have a blast learning Ajax with Head Rush Ajax, By the time you've reached the end of the book, all those web technologies that didn’t quite fit together in your head will all snap into place and you'll x Power! You'll know the secrets behind some of the most popular web applications on the Internet. You'll impress your f workers with you knowledge of how those interactive maps and web farms really work.” ids and co- — Elisabeth Freeman, Director, Technology, The Walt Disney Internet Group Co-Author, Hrad First Design Patterns and Head First HTML with CSS @ NHTML “IF you thought Ajax was rocket science, this book is for you. Head Rush Ajax puts dynamic, compelling nees within reach for every web developer.” — Jesse James Garrett, Adaptive Path “This stuff is brain candy; T can’t get enough of it.” — Pauline McNamara, Center for New Technologies and Education Fribourg University, Switzerland Praise for other Head First books by the authors When arriving home after a 10-hour day at the office programming, who has the energy to plow through yet another new facet of emes ving to invest free time in selF-driven career development, should it not be at least remotely enjoyable? Judging from the content of OFReilly’s new release Head Rush Ajax, the answer is yes... Head Rush Ajav is a most enjoyable launchpad into the world of Ajax web applications, well worth the investment in time and money.” sing technology? If a developer is — Barry Hawkins, Slashdot.org “By starting with simple concepts and examples, the book gently takes the reader from humble beginnings to (by the end of the book) where the reader should be comfortable ereating Ajax-based websites... Probably the best web designer centric book on Ajax.” — Stefan Mischook, Killersites.com “Using the irreverent style common of the Head Firsi/ Head Rush series of books, this book starts at the beginning and introduces you to all you need to know to be able to write the JavaScript that will both send requests to the server and update the page with the results when they are returned...One of the best things about this book (apart form the excellent explanations of how the code works) is that it also looks at security issues...[f you learn Ajax from this book you are unlikely to forget much of what you learn.” — Stephen Chapman, JavaScript.About.com “Head Rush Ajax is the book if you want to cut through all the hype and learn how to make your web apps sparkled. ..your users will love you for it!” — Kristin Stromberg, Aguirre International “If you know some HTML, a dollop of CSS, a litile JavaScript, and a bit of PHE, but you're mystified about what all the Ajax hype is about, this book is for you... You'll have a blast learning Ajax with Head Rush Ajax. By the time you've reached the end of the book, all those web technologies that didn’t quite fit together in your head will all snap into place and you'll have The Ajax Power! You'll know the secrets behind some of the most popular web applications on the Internet. You'll impress your friends and co- workers with you knowledge of how those interactive maps and web farms really work.” — Elisabeth Freeman, Director, Technology, The Walt Disney Internet Group Co-Author, Head First Design Patterns amd Head First HTML with CSS & NHTML “If you thought Ajax was rocket science, this book is for you. Head Rusk Aja puts dynamic, compelling nees within reach for every web developer,” — Jesse James Garrett, Adaptive Path in “This stull is k andy; Tean’t get enough of it.” — Pauline McNamara, Center for New Technologies and Education Fribourg University, Switzerland Praise for other Head First Books Head Fist HTML with CSS & XHTML — ic teaches you everything you need to learn ina ‘fun — Sally Applin, UI Designer and Fine Artist, hetp://sally.com. “My wile stole the book. She’s never done any web design, so she needed a book like Mead First HTML with € (HTML to take her from beginning to end. She now b list of web sites she wants to build for our son’s class, our family, ... If Pm lucky, PH get — David Kaminsky, Master Inventor, IBM book back when she’s done, Freeman's Head Fist HTML with CSS & XHTML is a most entertaining book for learning how to build a great web page. It not only covers everything you need to know about HTML, CSS, and XHTML, it also excels in exp 's terms with a lot of great examples. I found the hook truly enjoyable to read, and I learned something new!” everything in lay — Newton Lee, Editor-in-Chief, ACM Computers in Entertainment hitp://www.acmeie.org From the awesome Head First Jaca folks, this book uses every conceivable trick to help you understand and remember. Not just loacls of pictures: pictures of humans, which tend to interest ocher humans. Surprises everywhere, Stories, because humans love narrativ chocolate. Need we say more?) Plus, it’s darned funny. — Bill Camarda, READ ONLY ones about things like pizza and “This book’s admirable clarivy, humor and substanti even non-programmers think well about problem-salving,” al clases of clever make it the sort af book that helps Cary Doctorow, co-editor of Boing Boing Author, “Down and Out in the Magic Kingdom” and “Someone Gomes to Town, Someone Leaves Town” “Lfeel like a thousand pounds of books have just been lifted aff of my head.” Ward Cunningham, inventor of the Wiki and founder of the Hillside Group “T literally love this book. In fact, I kissecl this book in front of my wile.” — Satish Kumar Head First Object-Oriented Analysis and Design by Brett D, McLaughlin, Gary Pollice, and Davicl West Copyright © 2007 O'Reilly Media, Ine. All rights reserved. Printed in the United States af America Published by O'Reilly Media, Inc., 1005 Gravenstein H 95472. ‘orth, Sebastopol, C: editions are ‘O'Reilly Media books may be purchased for educational, business, or sales promotional use, Onli also available for most titles (safari.oreilly:com). For more information, contact our corporate institutional sales department: (800) 998-9938 or corporate @oreilly:com Series Creators: Kathy Sierra, Bert Bates. Series Editor: Brett D. McLaughlin Editor: Mary O'Brien, Cover Designer: Mike Kohnke, Edie Freedman 00: Brett D, McLaughlin a: David West D: Gary Pollice Page Viewer: Dean and Rebbic McLaughlin | Printing History: November 2006; First E The Reilly logo is a registered trademark of O'Reilly Media, Inc. The Head First series designations, Head First OOAED, and related le dress are trademarks of O'Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks, Where those designations appear in this book, and O'Reilly Media, Inc., was aware of a trademark im, the designations have been printed in caps or initial caps. © nd the authors assume no: mation ¢ ned het While every precaution has been t responsibility for errors or omissions, in the preparation of this book, the publish wr for damages resulting from the use of the inf Tn other words, if you use hat controls an Am shuttle, you're on your ow nything in Head First OOAGD to, say, write code yerican space No dogs, rabbits, or woodchucks were harmed in the making of thi ¢ book, or ‘Todel and Gina's dog door, ISBN-10: 0-596-086 7-1 ISBN-1 3: 978-0-596-(10867 Mi ‘To all the brilliant people who came up with various ways to gather requirements, analyze sofiware, and design cod «thanks for coming up with something good enough to produce great software, but hard enough that we needed this book to explain it all. how te use this book Intro T can't believe they put that in an object- oriented analysis and design book! the burving question’ that in an OORED book? In this section we “So why DID they Put xxiii how fo use this book Who is this book for? If you can answer “yes” to all of these: You'll probably be okay if @ Do you know Java? (You don't need to be a guru.) you know CA instead CHF inste: Do you wantto learn, understand, remember, and apply object-oriented analysis and design to real world projects, and write better software in the process? Do you prefer stimulating dinner party conversation to dry, dull, academic lectures? this book is for you. Who should probably back away from this book? Tf you can answer “yes” (o any one of these: Are you completely new to Java? (You don't need to. be advanced, and even if you don't know Java, but you know C#, you'll probably understand almost all of the code examples. You also might be okay with just a C++ background.) @ ‘Are you a kick-butt OO designer/developer looking for a reference book? @ Ave you afraid to try something different? Would you rather have a root canal than mix stripes with plaid? Do you believe that a technical book can't be serious if programming concepts are anthropomorphized? we this book is not for you. Crate from marketing: this book is Gor anyone with & eredit: card] xxiv Intro We know what youre thinking. How can this be a serious programming book!” ‘What's with all the graphic “Can I actually learn it this way?” And we know what your brain is thinking. Your brain ¢ ‘'s nowelty: It’s hvays searching, scanning, reiting for something unusual, [Cwas built that way, and it helps you stay alive, So what does your brain do with all the routine, ordinary, normal t you encounter? Everything it ear jo stop them from int brain’s weal job—recording thi the boring thing: important” filter. es ing with the es that matier. It doesn’t bother saving they never make it past the “this is obviously not How does your brain know what's important? Suppase you're aut for a day hike and a tiger jumps in front of you, what happens ins your head and body? Neurons fire. Emotions crank up. Chemicals surge. And that’s how your brain knows This must be important! Don’t forget it! 637 more dull, dry, boring pages. But imagine you're at home, or in a library, It’s a sale, warm, tiger-free zone. You're studying, Getting ready for an exam. Or trying ta learn some tough ow 83" Ey, technical topic your boss thinks will take a week, wen days at the most. THIS se > mi i savinty Just one problem. Your brain's trying to do -you a big favor. It’s wying to make sure that this obeforsd) non-important content doesn't clutter up scarce \ are bett gers. Like the danger of fire. Like how you should never again snowboard in shorts, resources. Resources th F spent storing the really big things. Like And there's no simple way to tell your brain, “Hey brain, thank you very much, but no matter how dull this book is, and how little I'm registering on the emotional Richter scale right now, [ really de want you to keep this stuff around.” you are here » xxv. how to use this book ‘we think of a “Head First’ reader as a learner. So what does it take to learn something? First, you have to getit, then make sure you don’t forgetit. It's not about pushing facts into your head. Based on the Jatest research in cognitive science, neurobiology, and educational psychology, learning takes a lot more than text on a page. We know what turns your brain on. AM of thie ‘thin represented in ometbion cect Some of the Head First learning principle: 2 Sage Ce Make it visual. Images are far more memorable than words alone, and make learning much more effective (up 0 894% imp rovement in recall and transfer studies), It also makes things more understandable, Put the words within or near the graphics they relate to,rather than on the bottom ‘or on another page, and learners will be up to twice as likely to solve problems. related to the content. Use a conversational and personalized style.In recent studies students performed up to 4a% better on pastlearning tests if the content spoke directly to the reader, using 2 first-person, conversational style rather than taking + formal tone. Tell stories instead of lecturing. Use casual language. Don't take ‘yourself too seriously. Which would you Pay more attention to:a stimulating dinner party companion, of a lecture? ‘Ta really sucks 10 be on abstract methad. You don't have « body ° Get the learner to think more deeply. 0 other words, unless you actively flex your neurons, nothing much happens in Our head. A reader has to. be motivated, engaged, curious,and inspired to solve problems, drav’ conclusions, ‘and generate new knawledge. And for that, you need challenges, exercises, and thaught-provaking questions, and activities that involve both sides of the brain, and multiple senses Great software every time? E can hardly imagine what thet would be likel Foam( \ Get—and keep—the reader's attention. We've yee ae all had the “I really want to learn this but | can’t stay awake past a page one” experience. Your brain pays attention to things that are out of the ordinary, interesting strange, eye-catching, unexpected, Learning a new, tough, technical topic doesn't Reve £0 be boring. four brain will earn much more quickly if it's nor Touch their emotions. We now know (hat Your ability to remember something is largely dependent on its emotions! content, You remember what you care about ‘You remember when you feel something. Ne, we're not talking heart-wrenching stories about a boy and his dag. We're talking emotions Ike surprise, curiasity, fun “what the...,and the feeling of “Rule!” that comes when you solve @ puzzle, learn something everybody else thinks is hard, or realize you know something that "'m more technical than thou” Bob from engineering doesn’. voi intro Metacognition: thinking about thinking If you really want to learn, and you want to learn more quickly and more deeply, pay attention to how you pay attention. Think about how you think. n haw you learn. Twonder how I can trick my brain into remembering this stuff... Most of us did not take courses on metacognition or learning theory when we were growing up, We were expected to learn, but rarely taught wo learn, But we assume that if you're holding oriented analysi is book, you really want to learn abject- ° nd design. And you probably don’t want to spend a lot of time, And since you're going to develop software, you need to remeber what you read. And for that, you've got to uidersiand it. To get the most from this book, or any hook or learning experienc on this content. take responsibility for your brain. Your brain ‘The trick is to get your brain to see the new material you're learning as Really Important. Crucial to your well-being, As important as a tiger. Otherwise, you're in for a constant battle, with your brain doing its be keep the new content from stie ing. So just how DO you get your brain to think object- oriented analysis and design is a hungry tiger? There's the stow, tedious way, or the faster, more effective way. The slow way is aboue sheer repetition. You obviously know that you ave able to learn and remember even the dullest of topies if you keep pounding the same thing n. With enough repetition, your brain says, “This doesn’t jee! important to him, but he keeps looking at the same thing oier and over and acer, so T suppose it must be.” into your bi The faster way is to do anything that increases brain activity, especially dillerent pes of brain activity The things on the previous page are a big part of the solution and they're all things that have been proven to help your brain work in your favor. For example, studies show that putting words within the pictures they describe (as opposed to somewhere ele in the page, like a caption or in the body text) causes your brain wo uy to makes sense of how the words and picture relate, and this eauses more neurons to fire. More neurons firing = more chances for your brain to get that this is something worth paying auendon to, and possibly recording. A conversational style helps because people tend to pay more atten perceive that they're in a conversation, since they're expected to follow along and hold up their end. The amazing thing is, your brain doesn’t necessarily eae that the “conversation” is between you and a book! On the other hand, if the writing style is formal and dry, your brain perceives it the same way you experience being lectured to while sitting in a roomful of passive attendees, No need ta stay awake. n when they But pictures and conversational style are just the beginning, you are here » xxvii

You might also like