In this article,I try to re-index code complete 2nd edition for intermediate programmer who wants to skim through big book. It is a well structured book and comes with great insights.I really recommend reading this book and I want to help lazy people out there without reducing integrity and perspective of the book.
My background
I am programmer mostly working in python and c#.I have mostly worked in projects with team size of 2 to 4.
Most Valuable Parts (in my perspective)
- Laying the foundation
- Creating high quality code
Most Valuable Chapters (in my perspective)
- Measure twice, cut once: Upstream Prerequisites
- Design in construction
- Defensive programming
- The pseudocode Programming process
- Code Tuning Strategies
Some Notes from construction of software
Plan before programming
Input Data -> Barricade -> internet processors
Assert routines — program to check the end of routine completes the process and gives output
Robustness vs correctness — depends upon software
To handle exceptional cases use offensive programming (test tough conditions during development ex. High memory allocation)
Design pseudocode
- Basic description
- Statements in normal language
- End
Variable
- Declare close to where it is used
- Make short spans of variable change
- One variable one purpose
- Don’t change input value(parameter value) in routines.
Loops
- Using break and while true for easier maintenance
- While is for not knowing when loop ends and for loop is for number of times foreach is for every array value
- Avoid monkeying
- Avoid code that depends on the loop index’s final value
- Use safety counter
- Try continue rather then big if indent
- Create loop inside — out
Unusual control structures
- Use guard clauses (early returns or exits) to simplify complex error processing
Recursion
- Use safety counter
- Limit to one routine
General control issues
- Use do while and if break rather then nesting in if
Optimisation
- Use optimisation afterwords the development
- Use caching
Hope, it is helpful.