- Excessive Comments
- Dead Code (e.g. commmented-out, or completely unused code)
- Long Methods / Large Classes
- Inconsistent Naming
- Uncommunicative Naming
- Long Parameter Lists
- Inconsistent Interfaces
- Duplicated code
- Complex Conditionals
- Combinitorial Explosion
- Speculative Generality (aka "premature optimization")
- Inappropriate Intimacy (aka "entangled code")
Source: List of Code Smells
Take a look at the three Game solutions in this repo.
- What did they do well?
- Good style
- Helpful comments about complex logic
- Indentation, Spacing
- Good variable names & function names
- What could they refactor?
- Code "smells"
- Don't Repeat Yourself (DRY)
- Modularity / Encapsulation / Abstraction
- Keep it Simple, Stupid (KISS)
- "Premature optimization is the root of all evil" -- Donald Knuth
- Separation of Concerns (SoC)
- Model View Controller (MVC)
- Model Logic (Data) - e.g. player 1, player 2
- View Logic (Presentation Logic) - What it looks like
- Control Logic (Game Logic) - Rules of the game
- Model View Controller (MVC)
- Mixing styles -- Vanilla Javascript DOM Manipulation vs. JQuery DOM Manipulation
- Overloading Functions
- Accepts too many parameters (3 or fewer is best!)
- Does too many things (could be broken down further)