January 29, 2020
Trying out CFML on CodeWars.com
Comments
(2)
January 29, 2020
Trying out CFML on CodeWars.com
Wizard 19 posts
Followers: 4 people
(2)

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.

There a box is shown “Your Next Challenge…” where you can choose your language and the type of challenge you want.  I did “Fundamentals” as I just wanted to see what the site is like and how it worked.  I figured fundamentals would let me get an easy problem to get my feet wet.  After trying a few times it seems that the “Kata” is randomly chosen as the problem you are given changes each time.  From what I can tell these “Katas” are across all languages so you can try the same one in CFML, C, JavaScript, etc.  I got “Is n divisible by x and y?”.  There is an instruction pane and a results pane to see your attempts on the left and a solution and test panes on the right.  The solution is where you write your code.  Once you write your code you can run sample tests before you actually attempt a solution.  Once ready you just click the “Attempt” button which runs the tests again and lets you know how you did.  I should note that the “kata” I got was in script and not tags which I am assuming is true for others.  So I like that it is going to modern styling and I can see this as another help for those, like me, trying to switch completely over to script moving forward.

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.

https://www.youtube.com/watch?v=6DCMjPbDboQ

2 Comments
2020-01-29 22:21:14
2020-01-29 22:21:14

Great overview!  I’ve leveled up on Codewars enough I can translate katas to CF so I’m working on getting some approved already to add to what’s in the CF pool!

Like
(1)
2020-01-29 22:15:25
2020-01-29 22:15:25

Nice write up.

Their UI isn’t the most intuitive, I admit, Brad had similar issues.. but if you get past that, its a great tool, although addicting!

Brad needs to be banned, so he’ll get some more work done He’s already got a million honor points 🙂

Like
(1)
Add Comment