PrabinprabinKshrestha

Notes on book "Clean Code: A Handbook of Agile Software Craftsmanship" by Robert C. Martin

Chapter 2 - Meaningful Names

Chapter 3 - Functions

Chapter 4 - Comments

Chapter 5 - Formatting

Chapter 6 - Objects and Data Structures

Chapter 7 - Error Handling

try{
    MealExpenses expenses = reportDAO.GetMeals(employee.GetId())
    mTotal += expenses.getTotal();
}
catch(NotFoundException e){
    mTotal += GetMealPerDiem();
}
// Replaced By
MealExpenses expenses = reportDAO.GetMeals(employee.GetId())
mTotal += expenses.getTotal();
// we create special object to handle special case like handling above exception case
public class PerDiemMealExpenses: MealExpenses{
    public int getTotal(){
        // return the per diem default
    }
}
// now, reportDao get meails will return meal expenses MealExpenses either with real data or the PerDiemMealExpenses if employee not found.

Chapter 8 - Boundries

Chapter 9 - Unit Tests

Chapter 10 - Classes

Chapter 11 - Systems

Chapter 12 - Emergence

Chapter 13 - Concurrency

Chapter 14 - Successive Refinement

Chapter 15 - Refactoring

Chapter 16 - Smells and Heuristics