Length: ~ 3 hours
This module is split into five parts, and the course includes hands on coding, a lecture and presentations of the code you just made.
Length: 10 minutes
Q: What do you associate with clean code?
Length: 30-45 minutes
- Story of a time I messed up (not writing clean code)
- Meaningful Names: Class, Functions and Variables
- Functions and Classes: Keep Them Small! Should do one thing, explanatory names.
- DRY KISS
- Comments and Documentation
- Formatting
- Error Handling
- TDD and Testing
- Consistency
- Code Smells: Argumnents, dead code, duplication, information at the wrong level of abstraction, understand the algorithm, conventions, negative conditionals, don't be arbitrary, use datatypes
- Example of Code Transformed From Bad Code To Clean Code
Length: 90 minutes
Use your knowledge and the piece of information you have just learned to tidy up the already working code. Maybe you found an error within the program?
Rules for number to roman numerals and vice versa
Choose one of the following:
- a) Identify errors and improve the code presentation-code There is a proposed-solution
- b) Build them from scratch in your prefered language.
Pro tip: you can use this online compiler online compiler If you want to test the code in the repo in this online compiler you must paste it inside the main program:
using System.Collections.Generic;
using System;
using System.Linq;
public class RomanNumeralsConverter
{
-> Here for the proposed solution
public static void Main(string[] args) //Delete this if you are using the proposed solution
{
-> Here for presentation-code
}
}
Length: 20-30 minutes You can either choose option a) or option b).
-
a) - Joint review, everyone presents how they cleansed their code with the presented principles.
-
b) - Pair review, group up and present your solution to each other.
Length: 10 min
What have we learned from this? In pairs; list 2 things you have learned and present them to the rest of the group.