شیوههای بد برنامهنویسی ۱۰۱: با یادگیری چگونگی (و چگونه نباید) برنامهنویسی، برنامهنویس بهتری شوید
Bad Programming Practices 101 : Become a Better Coder by Learning How (Not) to Program
معرفی کتاب «شیوههای بد برنامهنویسی ۱۰۱: با یادگیری چگونگی (و چگونه نباید) برنامهنویسی، برنامهنویس بهتری شوید» (با عنوان لاتین Bad Programming Practices 101 : Become a Better Coder by Learning How (Not) to Program) نوشتهٔ Karl Beecher (auth.)، منتشرشده توسط نشر Apress : Imprint : Apress : Springer در سال 2018. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است.
This book takes a humorous slant on the programming practice manual by reversing the usual approach: under the pretence of teaching you how to become the world’s worst programmer who generally causes chaos, the book teaches you how to avoid the kind of bad habits that introduce bugs or cause code contributions to be rejected. Why be a code monkey when you can be a chaos monkey? OK, so you want to become a terrible programmer. You want to write code that gets vigorously rejected in review. You look forward to reading feedback plastered in comments like "WTF???". Even better, you fantasize about your bug-ridden changes sneaking through and causing untold chaos in the codebase. You want to build a reputation as someone who writes creaky, messy, error-prone garbage that frustrates your colleagues. __Bad Programming Practices 101__ will help you achieve that goal a whole lot quicker by teaching you an array of bad habits that will allow you to cause maximum chaos. Alternatively, you could use this book to identify those bad habits and learn to avoid them. The bad practices are organized into topics that form the basis of programming (layout, variables, loops, modules, and so on). It's been remarked that to become a good programmer, you must first write 10,000 lines of bad code to get it all out of your system. This book is aimed at programmers who have so far written only a small portion of that. By learning about poor programming habits, you will learn good practices. In addition, you will find out the motivation behind each practice, so you can learn why it is considered good and not simply get a list of rules. **What You'll Learn** * Become a better coder by learning how (not) to program * Choose your tools wisely * Think of programming as problem solving * Discover the consequences of a program’s appearance and overall structure * Explain poor use of variables in programs * Avoid bad habits and common mistakes when using conditionals and loops * See how poor error-handling makes for unstable programs * Sidestep bad practices related specifically to object-oriented programming * Mitigate the effects of ineffectual and inadequate bug location and testing **Who This Book Is For** Those who have some practical programming knowledge (can program in at least one programming language), but little or no professional experience, which they would like to quickly build up. They are either still undergoing training in software development, or are at the beginning of their programming career. They have at most 1-2 years of professional experience. Table of Contents 5 About the Author 12 About the Technical Reviewer 13 Acknowledgments 14 Introduction 15 Chapter 1: Learning to Program 19 Objectives 19 Introduction 19 Bad Ways to Learn Programming 19 Take a Pass on Practicing 19 Thumbs Down! 20 Avoid Inspiration 20 Thumbs Down! 21 Be a Script Kiddie 21 Do It Alone 22 Bad Ways to Choose Your Tools 22 Choose Inappropriately While a Beginner 23 Thumbs Down! 24 Obsess Far Too Much over Your Choices 24 Thumbs Down! 25 Be a Fashion Victim 25 Chapter 2: Layout and Structure 26 Objectives 26 Prerequisites 26 Introduction 26 Make Spacing Poor and Inconsistent 27 On the Level 27 Thumbs Down! 28 Spaced Out 30 Tabs and Spaces 31 Thumbs Down! 32 Clutter the Code 32 Unused Stuff 33 Dead Stuff 33 Disabled Stuff 34 Thumbs Down! 34 Write Bad Comments 35 No Comment! 35 Thumbs Down! 35 Code Parroting 36 Thumbs Down! 37 Out of Sync 38 Avoid Structured Programming 39 Jump Around 42 Routine Work 43 Thumbs Down! 44 Chapter 3: Variables 47 Objectives 47 Prerequisites 47 Introduction 47 Use Obscure Names—Thinking Up Meaningful Labels Isn’t Worth the Effort 48 All Meaningless 48 Thumbs Down! 48 Vowel Movements 50 Thumbs Down! 50 Lazy Naming 51 Treat Variable Declaration Like a Waste of Time 51 Be Confusing 51 Thumbs Down! 52 Be Contrarian 52 Maximize the Scope of Variables 53 Broad Scopes 53 Thumbs Down! 55 Going Global 56 Thoroughly Abuse the Type System 58 Turn Numbers into Secret Codes 59 Thumbs Down! 59 Strings Are Magic—They Can Pretend to Be Any Type 60 Thumbs Down! 61 Mix Things Up 62 Thumbs Down! 63 Null—The Harbinger of Doom 63 Null Checks 63 Seeding Disaster 64 Thumbs Down! 64 Chapter 4: Conditionals 67 Objectives 67 Prerequisites 67 Introduction 67 Forget the Alternatives 68 Or Else What? 68 Thumbs Down! 69 The Normal and the Exceptional 70 Thumbs Down! 72 Build a Ladder 74 Thumbs Down! 74 Abuse Expressions 76 Tortuous Expressions 76 Thumbs Down! 77 Not Being Not Non-negative . . . Not 79 Thumbs Down! 80 Include Gaps and Overlaps 81 Thumbs Down! 82 Chapter 5: Loops 83 Objectives 83 Prerequisites 83 Introduction 84 Choose the Wrong Type 84 Collections 84 Thumbs Down! 85 Ranges 86 Thumbs Down! 87 Arbitrary Iterations 87 Thumbs Down! 89 Have Fun with Infinite Loops 90 Citing the Masters 90 Thumbs Down! 91 Taking Precautions 93 Thumbs Down! 94 Make Inappropriate Exits 95 Break Out 96 Thumbs Down! 97 Make'em Looooong and Complex 98 Long Loops 98 Thumbs Down! 99 Complex Loops 100 Thumbs Down! 100 Chapter 6: Subroutines 103 Objectives 103 Prerequisites 103 Introduction 103 Super-Size Your Subroutines 104 Thumbs Down! 105 Put Up Barriers to Understanding 106 Bad Naming 106 Thumbs Down! 107 High Complexity 107 Thumbs Down! 109 Too Many Purposes 110 Thumbs Down! 111 (Ab)use Parameters 112 The More the Merrier 113 Thumbs Down! 113 Being Defensive 114 Thumbs Down! 115 Surreptitious Subroutines 116 Screw with Return Values 117 Return of the Harbinger 117 Thumbs Down! 118 Fun with Output Parameters 118 Thumbs Down! 120 Chapter 7: Error Handling 122 Objectives 122 Prerequisites 122 Introduction 122 Assume Everything Will Always Go Well 123 Don’t Check 123 Don’t Assert 124 Thumbs Down! 126 Don’t Catch 127 Thumbs Down! 127 Send Problems Down the Memory Hole 128 Disappearing Exceptions 128 Reporting Problems Is Doubleplusungood 129 Thumbs Down! 130 Kick the Can Down the Road 131 Using Error Codes 132 Thumbs Down! 133 Baffle and Bamboozle 133 Thumbs Down! 134 Make a Mess 135 Cleaning Up and How Not to Do It 136 Thumbs Down! 137 Chapter 8: Modules 139 Objectives 139 Prerequisites 139 Introduction 139 A Note on Terminology 140 Make Importing Messy 140 Import All the Things! 141 Thumbs Down! 141 Clutter and Mess 142 Thumbs Down! 143 Prevent Reuse 144 Shopping-List Subroutines 144 Thumbs Down! 145 Mono-focused Modules 147 Thumbs Down! 148 Create Strong Dependencies 149 Exposing Your Innards 150 Thumbs Down! 152 The Public Face of a Module 154 Thumbs Down! 158 Chapter 9: Classes and Objects 159 Objectives 159 Prerequisites 159 Introduction 160 Have Questionable Motives for Creating Classes 160 Data Classes 160 Thumbs Down! 162 God Classes 162 Thumbs Down! 162 Utility Classes 163 Thumbs Down! 163 Make Objects Inflexible 164 Objects Obeying Orders 164 Thumbs Down! 166 Rigid Relationships 167 Thumbs Down! 169 Avoid Polymorphism 170 Thumbs Down! 172 Overuse and Abuse Inheritance 174 Going Deep 175 Thumbs Down! 176 Quick and Dirty Reuse 177 Thumbs Down! 179 Chapter 10: Testing 182 Objectives 182 Prerequisites 182 Introduction 183 Be Protective of Your Code 183 Keeping It to Yourself 184 Thumbs Down! 184 Doing the Bare Minimum 184 Thumbs Down! 186 Thwarting Efforts 189 Thumbs Down! 190 Set Traps in Your Tests 190 Machine-specific Tests 191 Thumbs Down! 193 Expansive Focus 193 Thumbs Down! 195 Chaos 196 Thumbs Down! 199 Chapter 11: Debugging 202 Objectives 202 Prerequisites 202 Introduction 202 Investigate Unsystematically 203 Guesswork 203 Thumbs Down! 204 Biases 204 Thumbs Down! 205 Chaos 205 Thumbs Down! 206 Make Debugging Hard 207 Always Keep Your Mouth Shut 207 Thumbs Down! 208 Keeping Records 209 Thumbs Down! 209 Avoid Proper Fixes 211 The Hit'n’ Run Bug 211 Thumbs Down! 212 Patch It Up 212 Thumbs Down! 214 Bibliography 215 Glossary 220 Index 223 This book takes a humorous slant on the programming practice manual by reversing the usual approach: under the pretence of teaching you how to become the world's worst programmer who generally causes chaos, the book teaches you how to avoid the kind of bad habits that introduce bugs or cause code contributions to be rejected. Why be a code monkey when you can be a chaos monkey? OK, so you want to become a terrible programmer. You want to write code that gets vigorously rejected in review. You look forward to reading feedback plastered in comments like "WTF???". Even better, you fantasize about your bug-ridden changes sneaking through and causing untold chaos in the codebase. You want to build a reputation as someone who writes creaky, messy, error-prone garbage that frustrates your colleagues. Bad Programming Practices 101 will help you achieve that goal a whole lot quicker by teaching you an array of bad habits that will allow you to cause maximum chaos. Alternatively, you could use this book to identify those bad habits and learn to avoid them. The bad practices are organised into topics that form the basis of programming (layout, variables, loops, modules, and so on). It's been remarked that to become a good programmer, you must first write 10,000 lines of bad code to get it all out of your system. This book is aimed at programmers who have so far written only a small portion of that. By learning about poor programming habits, you will learn good practices. In addition, you will find out the motivation behind each practice, so you can learn why it is considered good and not simply get a list of rules. You will: Become a better coder by learning how (not) to program Choose your tools wisely Think of programming as problem solving Discover the consequences of a program's appearance and overall structure Explain poor use of variables in programs Avoid bad habits and common mistakes when using conditionals and loops See how poor error-handling makes for unstable programs Sidestep bad practices related specifically to object-oriented programming Mitigate the effects of ineffectual and inadequate bug location and testing Front Matter ....Pages i-xxii Learning to Program (Karl Beecher)....Pages 1-7 Layout and Structure (Karl Beecher)....Pages 9-29 Variables (Karl Beecher)....Pages 31-50 Conditionals (Karl Beecher)....Pages 51-66 Loops (Karl Beecher)....Pages 67-86 Subroutines (Karl Beecher)....Pages 87-105 Error Handling (Karl Beecher)....Pages 107-123 Modules (Karl Beecher)....Pages 125-144 Classes and Objects (Karl Beecher)....Pages 145-167 Testing (Karl Beecher)....Pages 169-188 Debugging (Karl Beecher)....Pages 189-201 Back Matter ....Pages 203-221
دانلود کتاب شیوههای بد برنامهنویسی ۱۰۱: با یادگیری چگونگی (و چگونه نباید) برنامهنویسی، برنامهنویس بهتری شوید