IBM Bluemix and Node.js Battle – Part 3: I Stand Bleeding Code

IBM Bluemix and Node JS Battle

Welcome to Part 3 of my IBM Bluemix and Node.js Battle blog series. Here you’ll learn valuable lessons from my experience taking on the first 2 challenges.

In Part 1 and Part 2, I introduced you to the competition and took you through the necessary preparations to get to the point of taking on challenges. This post, however, is what it all comes down to and it’s in your best interests to continue reading before moving forward with the competition.

Please read this post before taking on the IBM Bluemix challenges

I learned some hard lessons taking on the first 2 challenges and I BEG you to please learn from my mistakes and give yourself a fighting chance of winning one of the 7 prizes up for grabs. If anything, read the bottom part of this post under the heading “What you need to know before starting a challenge“.

The good news is that once I got the gist of Coderpower and this competition, I managed to hit 5th Place in the 4th challenge, which could easily change, but at least below I have proof I made 5th place at some point 😎

IBM Bluemix and Node.js Battle - Leaderboard

 

The glitch in the Matrix

So my first challenge was a complete bust. As you can see below, I earned a lovely score of 0 points.

IBM Bluemix and Node.js battle - Challenges

Why is that? Well, let’s take a step back. My first problem is I had no idea what to expect. The discovery modules are great in giving you a glimpse of the environment you’re going to work in, but the video tutorials in the discovery modules made me thing I’ll be working within the IBM Bluemix environment at times. Let me assure everyone…you only work in an environment very similar to what is shown in the discovery modules section.

I completed the code for the first challenge in about 20 minutes (each challenge has a 1 hour limit). When I tried to compile and submit my code…CRASH. Everything froze (except for the countdown timer of course). I tried to access the landing page a few times and nothing. Coderpower’s site crashed!!!

After about 30 minutes, I tested again and woohoo, Coderpower’s site was up and running again. I immediately jumped into my challenge and….NOOOOOO!!!! 6 minutes left on the timer!!!!!

What a complete disappointment and terrible start to this competition. I was broken!!! But, I’m fine now because I get to transfer my experience to others before they take on the challenge.

So, after licking my wounds, I take a deep breath, and move forward with challenge 2.

Learn by doing

Challenge 2 started off much better than challenge 1. I now know what they’re expecting from me, so it’s down to delivering the code and hoping for a successful compile.

Well, first things first. The online editor sucks. Yes, it’s on a browser and could be worse, but it still sucks. Syntax validation and indentation are non existent. After writing all my code, I accidentally forgot to close one of my loops, yet the code editor tells me nothing, which I feel is very rude. Anyways, 1 lesson learned: Don’t use Coderpower’s online editor.

Then, debugging. When it was too late, I finally realised that you could print results from your code to the console. This is extremely important because you don’t know what data they’re feeding your compiled script. There was a case where I need to check for a JSON Array, which I did, only for the compiler to tell me that the Array in certain cases doesn’t exist. Ok fine…I didn’t realise we were entering that level of defensive coding. So I start placing console commands in everything to get transparency of what data’s being fed to me, only to find out that I cannot get full transparency of the data until most of my code is running fairly well. Shees!

Anyways, Lesson 2 learned. Throw in console commands and compile your code often because some of the rules only show themselves during a failed compile. You have no specs that tell you otherwise.

Finally, What you need to know before starting a challenge

You can see by my stats below that as I progressed through the challenges, I got better, simply because I understood the competition more and more as I took on each challenge.

IBM Bluemix and Node.js Battle - Challenges

 

Here’s where I want to give you a sporting chance to make a serious impact in this competition. Make sure you fully understand the below bullet points before starting any of the challenges:

  1. Each challenge is an hour long. The timer starts as soon as you begin the challenge and it doesn’t stop.
  2. The fact that it’s a Bluemix and Node.js competition means very little. The challenges are based on Node.js JavaScript concepts using Bluemix APIs, but in the end, 99% of the skill you require is basic JavaScript and JSON.
    • If you know JavaScript and JSON, like really know it, you’re good to go.
    • The instructions help you with the Bluemix components.
  3. You are measured on how long it takes for you to compile and submit a successful function, nothing else.
    • Don’t worry about best practice, performance, commenting, etc.
    • Don’t worry about compiling multiple times.
  4. Compile and test your code as often as possible during the challenge (this is the process of submitting your code – the button on the top right of the code editor).
    • The initial instructions do not provide you with all the rules.
    • Many of the rules you’re going to learn as you code.
    • The compiler is your friend. Let it tell you what it wants.
    • I say it again. Compile as often as it makes sense, keeping in mind the clock it ticking.
  5. console.log() is your other friend. It will log your messages to the same console the compiler sends its results to.
    • You need this to understand what kind of data is being passed to you.
    • Again, the initial instructions are vague in what data is submitted to test your code.
  6. For each challenge, you are presented with a scenario and an overall goal. The instructions are easy enough to understand and they do give some examples of what they want your code to do.
    • But be warned. The instructions don’t dive deep into the type of data being passed to your function.
    • Data used to test your script can have missing properties, so be defensive, but not too defensive…the clock is ticking.
  7. Do not use the online Code Editor on Coderpower for your primary coding. Instead, use your own preferred JavaScript editor and paste the code into the online code editor when you’re ready to compile or test. (I used JetBrains Webstorm to make sure my code had not issues)

Closing

It’s a bit late for me to challenge the grand prize of 500 Euros and sadly I’m not in line to win a Smartplane in the first 4 challenges, but you all have a powerful chance of going for gold. You can agree that this article is not a means of cheating. I just identified grey areas of the competition and made sure they aren’t the reason you don’t win.

So I wish you all the best of luck and please, communicate with me on Twitter if you have any questions or if you want to boast your winnings 👏.

Till next time
John

Leave a comment

Your email address will not be published. Required fields are marked *