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.
這本書以幽默的方式來反轉一般的程式設計實踐手冊,假裝教你成為世界上最糟糕的程式設計師,故意引起混亂,但實際上是教你如何避免引入錯誤或導致程式碼被拒絕的壞習慣。
為什麼要當一個程式碼猴子,當你可以成為一個混亂猴子呢?好吧,你想成為一個糟糕的程式設計師。你想寫出會被嚴厲拒絕的程式碼。你期待著讀到像「WTF???」這樣的評論。更好的是,你幻想著你充滿錯誤的更改能夠悄悄地通過並在程式碼庫中引起無法預料的混亂。你想建立一個以寫出脆弱、混亂、容易出錯的垃圾程式碼而聞名的聲譽,讓你的同事感到沮喪。《壞的程式設計實踐101》將幫助你更快地實現這個目標,通過教授一系列壞習慣,讓你造成最大的混亂。
或者,你可以使用這本書來識別這些壞習慣並學習避免它們。這些壞的實踐被組織成為程式設計的基礎主題(佈局、變數、迴圈、模組等)。有人曾說,要成為一個好的程式設計師,你必須先寫出一萬行糟糕的程式碼,以將它們全部排除在系統之外。這本書針對迄今為止只寫過一小部分程式碼的程式設計師。通過學習有關糟糕的程式設計習慣,你將學習到良好的實踐方法。此外,你還將了解每個實踐背後的動機,以便了解為什麼它被認為是好的,而不僅僅是得到一個規則清單。
你將學到什麼:
- 通過學習如何(不)編程來成為更好的程式設計師
- 明智地選擇你的工具
- 將程式設計視為解決問題的過程
- 了解程式外觀和整體結構的後果
- 解釋程式中變數的不良使用
- 在使用條件和迴圈時避免壞習慣和常見錯誤
- 看到糟糕的錯誤處理如何導致不穩定的程式
- 避免與物件導向程式設計有關的壞習慣
- 減輕無效和不足的錯誤定位和測試的影響
這本書適合對程式設計有一些實際知識(能夠使用至少一種程式語言進行編程),但缺乏專業經驗的人。他們可能仍在接受軟體開發培訓,或者剛開始他們的程式設計生涯。他們最多只有1-2年的專業經驗。