Last updated: Nov 15, 24 04:26 UTC | Permalink
4 - Code-Level Design Principles
Learning Objectives:
This lecture is about writing code that other people will be able to understand, reuse, and modify. We’ve distilled this down to five general program-design princples which should be best practices for effective programmers:
- Use Good Names
- Make Your Data Mean Something
- One Method/One Job
- Don’t Repeat Yourself
- Don’t Hardcode Things That Are Likely To Change
In this lecture, you will learn to:
- Describe the purpose of our best practices for code-level design
- List 5 principles for designing readable code, with examples
- Identify some violations of the practices and suggest ways to mitigate them
Important Dates:
- Individual Project Deliverable 1 Due Wednesday, September 18 at noon
Lecture Slides:
- Code-Level Design Principles Slides PDF, PPT
Activity
- Traffic Light Activity: (Handout)
Resources
- Code Style Policy for this class
- Book: “The Programmer’s Brain” by Felienne Hermans
- Resource: “What is cognitive load”
- Research paper: I know what you did last summer: an investigation of how developers spend their time, Minelli, Mocci and Lanza
- Research paper: A metric for software readability, Buse and Weimer
- Research paper: To camelcase or under_score, Dave Binkley et al