CFML was successfully added to CodeWars.com so I decided to try the site and see what it was all about.
So Gavin Pickin posted the other day about getting CFML up on CodeWars.com (https://coldfusion.adobe.com/2020/01/help-us-get-cfml-coldfusion-added-codewars-website/). If you read the comments you will see he was successful. Congratulations again Gavin and thanks for the work, and those that helped, on getting CFML added to CodeWars.com.
I won’t go into detail on CodeWars as Gavin does a good summary in his post and if you go to the CodeWars home page there is a good run through of what the site is and what it is trying to accomplish. The site name sounds familiar but I had never visited the site itself. Maybe I had heard someone talk about it or mention it online somewhere or at a conference. So this was a whole new experience for me.
The first thing I found is that if you click “Sign Up” you are taken to a screen screen where you have to choose a language and pass an “entrance exam” just to get in. So right there the site is giving you a sample of what you are going to be doing and what to expect. I was surprised by this and unfortunately CFML is not one of the choices out of the gate. I chose SQL because as a CF developer I’m hitting databases all the time so I think i’m pretty proficient. Well guess again because what looks like a straight forward query turned into a what the heck is going on here. I’m outing myself a little on having a hard time just getting into the site but oh well. Like all good tests I finally caught on that the test wasn’t what i thought it was as I focused on the syntax and not what it was trying to accomplish. My wrong assumption at the beginning just spiraled me down a path that for some reason I wouldn’t let go of. Eventually I got in and to the home page after what was an embarrassing amount of time spent on a simple SQL query. I’m not bitter and it probably wasn’t really as long as it felt like.
Once in the the site asked was what languages I was interested in. I can’t remember the exact question and should have written down before moving on but it was this screen where CFML showed up and I was able to choose it. There were lots of other listed as well. Then it went through a guide of the site and what not before I ended up on the home screen.
Once you have it working and passing all the tests it suggests that you can refactor and comment before you submit your final solution. Once you submit your solution you get to view other user’s solutions to the same problem, comment on them, and vote on them which is pretty cool. My solution worked fine but I found in other’s solutions I could have done everything I did in mine in one line. This is something i really like as it showed me ideas I hadn’t considered and can learn from. Of course this means your not very elegant solution which worked is also there for everyone to see. But hey, that’s ok because that’s how it goes and you learn from those that are better for next time. I forgot I could use % instead of MOD and even saw an elvis operator in one of the solutions.
It’s going to take me a bit more playing to get the hang of how CodeWars works but I can already see a value in learning some new tips and tricks based on other peoples answers. Which means the value will go up by having more CF developers getting in there and trying these katas out for more solutions for everyone to see and learn from. So go give it a try, I think you’ll find it pretty enjoyable and a fun way to pass the time. I’ll probably post a bit more down the road when i get a few more challenges under my belt. Also apparently I need to work on my SQL knowledge as well.
Update: I just saw on Twitter that Gavin did a great video walk through and actually ended up demonstrating the same Kata that i got so I wanted to add a link to his video so you can see it in action. I’m a visual guy so like that Gavin did this quick video and wished I had seen it before stumbling around on my own.