Space Age

(solving an exercism.io problem with metaprogramming)

exercism.io

  • (*I am not afilliated with)
  • do small things well

exercism.io

Problem


space age problem

Repetition


space age problem 2

Solution (long)


space age solution long

from http://exercism.io/submissions/c3a325ee71e6fbae05a2891e

Issues

  • Repetition (ok in tests (maybe); not ok in non-tests)
  • Magic numbers (context kinda makes it ok?)
  • Separation of concerns (lack of) - coefficients should be together
  • No trailing comma

Solution (short)


space age solution short

http://exercism.io/submissions/68c2e5f2c6bd3da3725598ff

Issues

  • Spacing/formatting
  • Planet map is not named
  • Hardcoding a value derived from the original numbers, not the original data

Lessons

  • Style is important
  • There are many ways to write anything

?