Through this series of posts, I am exploring my journey refactoring an existing project. I hope that each version will improve on the last, becoming:
- more readable
- cleaner, shorter and more succint
- utilise new tools or methods to do the above
- maintain natural syntax. I would like my code to be easy to read, easy to understand and easy to maintain. I would like to avoid overly obscure code.
For this journey, I am going to work with the project here: http://codereview.stackexchange.com/questions/24372
Briefly, the project will print out the outline of a triangle. The size of the triangle should be variable, as defined by the user. Sample output for size 5:
In future blogs, I am going to document my attempts to refactor this project. I envisage that I will follow a journey similar to:
- initial hack-up (regular and inverted triangles)
- general function to output either regular or inverted triangle
- use recursion
- use itertools
- investigate decorators?
# to be continued…