Tài liệu New Programmer’s Survival Manual ppt

246 805 0
Tài liệu New Programmer’s Survival Manual ppt

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

www.it-ebooks.info What Readers Are Saying About New Programmer’s Survival Manual I love the pragmatic tone and content. ➤ Bob Martin President, Object Mentor, Inc., and author of The Clean Coder An excellent overview of the “big picture” and the many facets of software development that a lot of new developers lack. A great primer for starting an exciting career in software development. ➤ Andy Keffalas Software engineer and team lead www.it-ebooks.info A funny, honest, inside look at the ever-growing, ever-changing industry of writing code. If y o u just got handed y o u r CS degree, this book is a must- have. ➤ Sam Rose Computer science student, University of Glamorgan This book has everything I should have sought out to learn when I started in the industry. A must-read for new developers and a good read for everyone in the industry. ➤ Chad Dumler-Montplaisir Software developer www.it-ebooks.info New Programmer’s Survival Manual Navigate Y o u r W o r k p l a c e , Cube Farm, or Startup Josh Carter The Pragmatic Bookshelf Dallas, Texas • Raleigh, North Carolina www.it-ebooks.info 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 The Pragmatic Programmers, LLC w a s aware of a trademark claim, the desig- nations have been printed in initial capital letters or in all capitals. The Pragmatic Starter Kit, The Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf, PragProg and the linking g device are trademarks of The Pragmatic Programmers, LLC. Every precaution w a s taken in the preparation of this book. However, the publisher assumes no responsibility for errors or omissions, or for damages that may result from the use of information (including program listings) contained herein. Our Pragmatic courses, w o r k s h o p s , and other products can help y o u and y o u r team create better software and have more fun. For more information, as w e l l as the latest Pragmatic titles, please visit us at http://pragprog.com . The team that produced this book includes: Susannah Pfalzer (editor) P o t o m a c Indexing, LLC (indexer) Kim W i m p s e t t (copyeditor) David J Kelly (typesetter) Janet Furlow (producer) Juliet Benda (rights) Ellie Callahan (support) Copyright © 2011 Pragmatic Programmers, LLC. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior consent of the publisher. Printed in the United States of America. ISBN-13: 978-1-934356-81-4 Printed on acid-free paper. Book version: P1.0—November 2011 www.it-ebooks.info For Daria and Genevieve. www.it-ebooks.info Contents Acknowledgments . . . . . . . . ix Introduction . . . . . . . . . xi Part I — Professional Programming 1. Program for Production . . . . . . . 3 Tip 1. Beat Up Y o u r Code 6 Tip 2. Insist on Correctness 11 Tip 3. Design with T e s t s 21 Tip 4. T a m e Complexity 27 Tip 5. Fail Gracefully 35 Tip 6. Be Stylish 41 Tip 7. Improve Legacy Code 48 Tip 8. Review Code Early and Often 53 2. Get Y o u r T o o l s in Order . . . . . . . 59 Tip 9. Optimize Y o u r Environment 61 Tip 10. Speak Y o u r Language Fluently 69 Tip 11. Know Y o u r Platform 77 Tip 12. Automate Y o u r P a i n A w a y 83 Tip 13. Control Time (and Timelines) 87 Tip 14. Use the Source, Luke 92 www.it-ebooks.info Part II — People Skills 3. Manage Thy Self . . . . . . . . 101 Tip 15. Find a Mentor 103 Tip 16. Own the Image Y o u Project 107 Tip 17. Be V i s i b l e 110 Tip 18. Ace Y o u r P e r f o r m a n c e Review 114 Tip 19. Manage Y o u r Stress 121 Tip 20. T r e a t Y o u r Body Right 127 4. T e a m w o r k . . . . . . . . . 133 Tip 21. Grok P e r s o n a l i t y T y p e s 135 Tip 22. Connect the Dots 141 Tip 23. W o r k T o g e t h e r 144 Tip 24. Meet Effectively 148 Part III — The Corporate World 5. Inside the Company . . . . . . . 155 Tip 25. Know Y o u r P e e p s 157 Tip 26. Know Y o u r (Corporate) Anatomy 163 6. Mind Y o u r Business . . . . . . . 181 Tip 27. Get with the Project 183 Tip 28. Appreciate the Circle of (a Product’s) Life 189 Tip 29. Put Y o u r s e l f in the Company’s Shoes 200 Tip 30. Identify Corporate Antipatterns 203 Part IV — Looking Forward 7. Kaizen . . . . . . . . . . 211 Tip 31. Mind Y o u r Head 213 Tip 32. Never Stop Learning 217 Tip 33. Find Y o u r Place 222 A1. Bibliography . . . . . . . . . 227 Index . . . . . . . . . . 231 viii • Contents www.it-ebooks.info Acknowledgments First, I must thank my ever-patient editor, Susannah D avidson P falzer. This b o ok c ouldn’t h ave h a ppened w i thout her clear-minded guidance, w o r d s of encouragement, and occasional swift kick in the rear to keep me going. Susannah, thank y o u so much for helping this first-time author bring a book to life. Next, numerous reviewers ranging from new programmers to industry pros provided tremendous help. They read (or should I say, endured) early drafts of this book and offered their own viewpoints, expertise, and corrections. I’d like to thank Daniel Bretoi, Bob Cochran, Russell Champoux, Javier Collado, Geoff Drake, Chad Dumler-Montplaisir, Kevin Gisi, Brian Hogan, Andy Keffalas, Steve Klabnik, Robert C. Mar- tin, Rajesh Pillai, Antonio Gomes Rodrigues, Sam Rose, Brian Schau, Julian Schrittwieser, Tibor Simic, Jen Spinney, Stefan T u r a l s k i , Juho V e p s ä l ä i n e n , Nick W a t t s , and Chris W r i g h t . Y o u have all made this book far, far better with y o u r diligent and thorough reviews. I—and every reader of this book—appreciate y o u r w o r k . From the beginning, several friends and co-workers allowed me to pester them over and over again for advice, including Jeb Bolding, Mark “The Red” Harlan, Scott Knaster, David Olson, Rich Rector, and Zz Zimmerman. I truly appreciate y o u r patience. Finally, an extra-special thanks for my two biggest fans. My daughter, Genevieve, gave me grace many, many evenings as I needed to duck away and write. And my wife, Daria, not only gave me time to write, but she w a s the first to buy and read the beta v e r s i o n of the book—in one sitting, no less, starting at ten at night. She offered her thoughts and www.it-ebooks.info perspective since this book w a s just an idea I w a s pondering over the dinner table. And she provided her support and encouragement through the whole process. Daria and Genevieve, I couldn’t have done it without y o u . Thank y o u from the bottom of my heart. x • Acknowledgments www.it-ebooks.info [...]... the work off to Student .new( ): Download ReadStudentGrades3.rb def self.import_csv(filename) file = File.open(filename) do |file| file.each_line do |line| name, grade = line.split(',') Student .new( name, grade.to_i) end end end What we need is a test double for the file, something that will intercept the call to File.open() and yield some canned data We need the same for Student .new( ), ideally intercepting... around year ten What happens as the new master continues to use her belt? It becomes frayed and bleached from sunlight…it starts to become white again The masters of old discovered something about expertise that psychologists have only recently studied: you need to get to a certain threshold before you can know what you don’t know And then you begin your learning anew Online Resources This book’s web... White-belt tips, likewise, apply from the very beginning Over years of practice, her belt becomes soiled The brown belt is an intermediate step where the belt is, frankly, dirty (We modern wimps just buy a new belt that’s colored brown.) For this book, I expect brown-belt topics to become relevant between years two and five As the artist practices further, her belt becomes darker and darker until it’s black...Introduction It’s day one on the job You have programming chops, you’ve landed the job, you’re sitting at your workstation…now what? Before you, a new jungle awaits: • Programming at industry scale, with code bases measured in thousands (or hundreds of thousands) of lines of code How do you get your bearings and start contributing quickly? • Navigating... Resources This book’s web page is located here: http://pragprog.com/titles/jcdeg From here you can participate in a discussion forum with me and other readers, check the errata for any bugs, and report any new bugs you discover Onward Enough chatter about the book You’re sitting at your workstation wondering, “Now what?” And your boss is wondering why you’re not working yet So, let’s get going! www.it-ebooks.info... ensure the product doesn’t create radio interference; Underwriter’s Laboratories (UL) looks at what happens when you set the product on fire or lick its battery terminals These tests are run before a new product is launched and any time a hardware change could affect the certification Environmental Testing Hardware products also need to be pushed to extremes in operating temperature and humidity These... ReadStudentGrades2.rb def self.numeric_to_letter_grade(numeric) case numeric when 90 100 then 'A' when 80 89 then 'B' when 70 79 then 'C' when 60 69 then 'D' when 0 59 then 'F' else raise ArgumentError .new( "#{numeric} is not a valid grade") end end Now numeric_to_letter_grade() is a pure function that’s easy to test in isolation: Download ReadStudentGrades2.rb def test_convert_numeric_to_letter_grade... complex and it’s buried in a function that has five different side effects? (Answer: it doesn’t get tested very well.) Teasing apart the knots of pure and impure code can help you test correctness both for new code and when maintaining legacy code Interactions Now what about those side effects? It’s a huge pain to augment your code with constructs like “If in test mode, don’t actually connect to the database….”... projects to ensure that your code is correct and well-tested Next, Chapter 2, Get Your Tools in Order, on page 59 helps with your workflow You’ll need to coordinate with others, automate builds, and learn new technologies as you go Plus, you’ll need to hammer out a ton of code It pays to invest in your tools up front Then we get into the squishier side of things The one manager you’ll have throughout your... framework allows us to do exactly this: www.it-ebooks.info 14 • Chapter 1 Program for Production Download ReadStudentGrades3.rb def test_import_from_csv File.expects(:open).yields('Alice,99') Student.expects( :new) .with('Alice', 99) Student.import_csv(nil) end This illustrates two points about testing interactions between methods: • Unit tests must not pollute the state of the system by leaving stale file handles . www.it-ebooks.info What Readers Are Saying About New Programmer’s Survival Manual I love the pragmatic tone and content. ➤ Bob Martin President,. for new developers and a good read for everyone in the industry. ➤ Chad Dumler-Montplaisir Software developer www.it-ebooks.info New Programmer’s Survival

Ngày đăng: 17/02/2014, 23:20

Từ khóa liên quan

Mục lục

  • Cover

  • Table of Contents

  • Acknowledgments

  • Introduction

    • Where I'm Coming From

    • And Now About You

    • Structure of This Book

    • Conventions Used in This Book

    • White Belt to Black Belt (and Back)

    • Online Resources

    • Onward

    • Part 1—Professional Programming

      • 1. Program for Production

        • Tip 1. Beat Up Your Code

        • Tip 2. Insist on Correctness

        • Tip 3. Design with Tests

        • Tip 4. Tame Complexity

        • Tip 5. Fail Gracefully

        • Tip 6. Be Stylish

        • Tip 7. Improve Legacy Code

        • Tip 8. Review Code Early and Often

        • 2. Get Your Tools in Order

          • Tip 9. Optimize Your Environment

          • Tip 10. Speak Your Language Fluently

Tài liệu cùng người dùng

Tài liệu liên quan