Code Efficiency Question

I don’t expect to be some coding expert right off the bat. However, I have noticed that some of my code is extradinarily long compared to the answers given in the hint section. They both complete the same task, just mine is less efficient.

  • Does this improve over time?
  • Is there something I should be doing to increase my code efficiency?


There are 3 key metrics in code:

  1. Readability
  2. Performance
  3. Patterns

Readability relates to things like naming and usage of cryptic code, on early stages pay attention only to naming things (beginners won’t be able to produce a lot of cryptic code anyway)

Don’t pay attention to performance at early stages

There are a lot of patterns, but ones that would be useful in FCC scope:

  1. DRY - do not repeat code you’ve written couple lines earlier. If this is a case - there is always a way to refactor
  2. Use declarative functional programming - there many many standardized functions (methods) premade for you to use - a lot of people building huge custom logic around something that can be solved with one or two native methods. This is the main reason why there are hints.

Also note, that there is no such metric as a length of the code and it definitely doesn’t mean the code performs bad


Hey Snigo,

Thanks for your response, that helps me understand this a bit better.