Baby Shark AMPScript Challenge Winning Solutions
Published on 07/16/2020
First, thanks to all of our Baby Shark Challenge participants. There was an overwhelming response to this challenge; 120 submissions! After sifting through all of these great submissions, winners for each of the three categories were found. These winners claimed a signed copy of the AMPscript Guide book by Adam Spriggs and Eliot Harper.
The three categories were:
The concentration in this category was how easy it is to pick up and read the code. This includes adding comments, using more ‘basic’ and understandable functions as well as formatting it in a clear and readable way.
For my solution, my wish was to showcase that it is not always necessary to comment your code when your code itself reveals all about itself! I wanted to make it such that anyone who would take a look at it would be able to understand what is its purpose and how it is achieving it. It comes from some of my experiences that people who love coding do not necessarily like to comment on their code all the time, which in turn introduces gaps in understanding for other individuals.
Ivanjan Chattoraj
For innovation, the challenge was to come up with the most unique or ‘out of the box’ approach to output the Baby Shark lyrics in the specified format. However, you had to keep in mind that complexity alone does not equal innovation. Efficiency and elegance were also a consideration in this category.
I looked at the structure of the song and it made me realize it will look very nicely organized if we put it in an XML format. Then I used XSLT to easily format the song as I needed.
Pato Sapir
The efficiency category was based solely on character count. The challenge to the community was to output the full lyrics in a specific format with as few characters possible. ‘Hacks’ and abnormal structures that go against best practice were allowed and encouraged - the end result was all that mattered.
To get started, I had 2 ideas in mind, whether to use one FOR loop or 2. I started off my approach using a single FOR loop, modifying the AMPScript as I went through using functions like REPLACE to reduce the character count. After a while, I found that I reached a limitation towards the single FOR loop process, which is when I decided to switch to a 2-loop process, which drastically decreased the count. I did enjoy the competition, especially the Efficiency method having a clear goal to achieve, being based on just the minimum character count possible, and competing against fellow SFMC developers in the community posting their latest character count submission to motivate others into exploring other means. I was constantly looking for methods to reduce the script down as much as possible, understanding limitations within AMPScript and measures that normally would not be used, such as replacing whitespace with line breaks which did not count as valid characters on the character count site yet stills renders the AMPScript as valid, or inserting a single character into an IIF statement that does not render a value.
Nathan Stone
There were a few other amazing solutions other than our winners that we wanted to share. The hard work and great efforts they put into their amazing solutions deserves recognition. The two stand-outs are below:
A shining example that shows just how a thinking outside of the box can create a beautiful AMPscript output. This submission unfortunately, didn’t meet the printing lyrics requirements of the competition, therefore was disqualified from winning a book - but, it is a complete piece of art. It would be unfair to say just how long she spent on the code for this, but there were definitely some long days involved!
It’s stunning, it’s clever and it’s a submission that was completely unpredictable.
Akin to the example above where the code outputs the lyrics in the form of a shark this individual took the concept of printing out the Baby Shark lyrics and flipped it on its head. The code submitted to the innovation category in itself was written to look like a baby shark. Another stunning example of making code look awesome.
We hope you enjoyed this contest as much as we did. We were absolutely blown away by the sheer number of participants, the creativity and also in some ways, the commonality between some submissions. There were a few techniques that were used in multiple submissions that we’ll share some of our thoughts on in a future article. But we have to say a huge thank you to everybody who got involved. We have more tasks like this coming in the next few months, so keep an eye out for us on socials and on here. But until next time, thank you!