Be dynamic, be be dynamic

If you do not know I have been working on about one problem a day on Codewars. As I have worked my way up the rankings, I realized these problems are not always the usual logic coding problems. Some require a very specific solution. To get the best solution for some requires specific knowledge of classes. methods, or even regex. First lesson, know your languages docs inside and out. I skim the docs all the time looking for a better method to use.

Over the last couple of weeks I learned two things more than any in doing problems on Codewars. One, make your code dynamic. Why? Because two, there are two separate sets of tests for each problem. The first set of tests are lenient and ensures you are following the directions in a cursory way. The second set of tests ensures you have efficient code. Some requires you to solve the problem with a speedy solution and might add more edge cases.

As I started to run into more tests that required more from my code, I had to scrap the code that I spent the last half an hour working on and start from the beginning to get it to pass. So the lesson here is to make a habit of writing as dynamic code as you can. This sometimes leads to a refactor instead of a restart.

Working through these problems has conditioned me to write better code. Thank you Codewars. Writing code just for your use-case is easy. Going the extra mile and keeping it as dynamic as you can is just about putting in the effort to do so.

Dynamic good, not dynamic bad.

Thanks for reading. Questions and comments are welcome below.

Happy coding!