I Learned Coding & Built A Fantasy League In 4 Days


A Little Disclaimer

  • It’s a really basic Fantasy League. No fancy manager budgets, transfers and graphs. Just create your team, select ‘em players and watch the scores go up and down. A true blue, barebones minimum viable product.
  • Even though I’m a designer, I’m not entirely code ignorant. I do know my variables and functions. Some ActionScript experience, when Flash was still a ‘thing’, helped too.
  • I had the light html skinning done up prior. These 4 days are spent learning how to code to make things ‘work’. Then hooking it up with a backend database.
  • On record, I’ve spent 2.5 days learning the framework of choice (Meteor.js) from scratch. And 1.5 days creating the Fantasy League.
  • The TLDR link to the finished app can be found here.

Now that we’ve got that out of the way, onwards we go!


Let’s Start With The Why

Politics has always been a hush-hush topic in Singapore. The ‘only’ time people get interested in politics is that 9 short days every 5 years (4 years this time round).

Yes, during the election campaigning and its rallies.

Although there’s a total of 181 candidates participating in the Elections. Depending on where you stay on the little red dot. It’s quite possible that you only have a choice between 2 candidates.

Now where’s the fun in that?

Credit: https://www.facebook.com/AGoodCitizen

That’s why I decided to create the Election’s own Fantasy League. You get to pick 6 different members from the entire 181 slate to form your very own dream team 🎉 ! Each candidate will then receive points, judged by the amount of hype (news, likes and shares) they generated daily.

The scores are definitely not representative of the final election results. Especially now that the elections are over, we saw how oh-very-true that is. Still, I think it’ll be pretty interesting to see how the candidates sling mud at each other. Try to work ‘em emotions in the rallies.

And make un-un-un-un-unbelievable comments as they rise and fall on a little fantasy chart.


You know how they always say, what can go wrong, will go wrong? This is a prime example here. I’ve managed to convince a developer friend to collaborate on this project together. Our meetings went well, I did up the user flow, html skinning and game design.

We’re all set.

And then, we’re not.

He can no longer commit to this project as there’s an urgent job he has to rush on. This is 1 week before the Elections start. I was devastated. This whole idea was devised specially for the Elections. If we’re to miss it, I would have to wait another 5 years before I can try this again. I asked around, but other developer friends are either packed or felt it was a little too last minute.

I had intentions to learn full-stack programming for some time now. But from my estimates it would take at least a few months before I can try out something on my own. With only a few days to spare, I didn’t even considered doing it myself.

Then I came across an article that said that if Rails could help developers shorten prototype development time to a few weeks, Meteor.js could help them do the same in just a few days.

Wait, what sorcery is this?

A prototype is all I needed! After all, the campaign would only last 9 days. Maybe it’s out of desperation but I managed to convince myself that it is possible. If I started after work on Friday, I would have around 4 days to do this. I started stripping out all extra functions to bring the idea down to its very core. Something basic, yet playable.

Let’s do this!


How Did I Do It?

Day 0

I kicked off with - Your First Meteor Application. As I followed along, I remembered thinking, ‘I must have picked the right book to start with. We’re gonna to make it’. The book was well written, simple to follow and explained core concepts right from the basics.

Then as I worked my way well into the night, I remembered thinking, ‘I must have picked the wrong brain to work with. We’re honestly going nowhere here’.

I went to bed defeated.

Day 1

I was pretty sure I gave up the night before. But I jumped straight back to where I left off. From the book, I’m learning how Meteor works. Or should I say, how I can work Meteor. There’s also two key functions I can rip straight out for my little app. How to sort a table according to points and how to add points to players.

I’m all hyped up again!

I decided to venture further and started reading Meteor Tutorial by Matthew Platts. This book is definitely tougher. We’re dealing with CRUD, database schemas and routing concepts here. Argh.

\o.o\ /o.o/ \o.o\ /o.o/
I waved my hands in the air as a quote crept into my mind:

If you don’t try, you won’t fail.

Sounds good. If I stop now, no one would know I even tried!

Day 2

If you haven’t noticed the trend yet, this whole journey is one of constantly giving up and starting again. I ploughed my way through the text at least 3 times over to get those important concepts into my thick skull. From the book, I also copied out the functions to create a custom team and add players into it.

Hey, my app’s almost set up and I haven’t even started yet!

From here on though, it was a blur. I know I have to start coding the next day or it would be impossible to complete. So I sped through the list of articles mentioned in Ben Strahan’s blog post. Then searched and watched any video related to Meteor on YouTube.

I had psychedelic dreams of Meteor that night.

Day 3

It’s my Birthday today. I remembered asking myself what’s the meaning to life, the universe and everything? It’s 42 by the way. The answer to the question, not my age… But I digress.

Houston, we have lift-off!

I was able to get the foundations up rather quickly due to the ready-made functions and concepts from the first two books. But as you may have guessed, I’ve soon hit a brick wall. Time to flex my Google muscles. Yes, that’s how most developers do it too.

It was a tough day hacking and slashing to piece the app together. Many thanks to the generously helpful coders answering questions at Stack Overflow and @praneybehl from Code Buddies Meet’s Slack channel. Special shout out to @Chardy who helped explain some looping and data searching concepts to me. Also Morby from MojoForest who did up a quick logo for the site.

Day 4

The last few issues of the app were solved by what I would call dirty code. It’s ugly, repeated and definitely not scalable. But I told myself, it’ll do for now. I pushed the app to Meteor’s server just as noon hits.

Though the game officially ended, you can still check out the finished app here. Note that new teams created would no longer gain or lose points.

Boy, it’s been a long 4 days.

Summary

Here’s a cheatsheet to the links I’ve mentioned above:


What I’ve Learned Along The Way

  1. Meteor.js simply rocks. It’s easy to pick up, removes the tough parts of coding so you can just focus on having fun and making things work. I really can’t recommend it more. 😍
  2. They really meant it when they say nothing is impossible. Honestly, if you told me a week back that I would code and launch a working app on my own, I would have called you crazy. But look who’s crazy now? Crazy cool that is. 😎 Hint: It’s me!
  3. I live and die by deadlines. I know that if I missed the Nomination Day, the boat would have sailed and it would all be pointless. After all, a goal without a date is just a dream. Seriously, set deadlines guys! 👍
  4. The amount of free knowledge out there never ceases to amaze me. The tutorials from countless generous authors. The wonderful people at Stack Overflow answering my dumb questions. And the it’s-too-good-to-be-true open source community. Oh, what culture shock when I first found out about open source. 😱
  5. I do have friends asking me to thrash the idea before I even started. They’re afraid I would be locked up for creating ‘sensitive’ content online. It comes to show how the general mindset is like in regards to politics here. 😅
  6. Then there are those who asked if I have too much free time. 😑 No, I do not. In fact, I’ve slept less than a few hours a day and burnt my Birthday for this. But I’ve learnt something new, had loads of fun, and created something out of nothing. Isn’t that the whole point of life? Booyah.

If you liked what you read; help recommend the article by hitting the ♥ button below and follow me as I try my hand at sharing my thoughts and various musings. You can also stalk me @kelvin___, where I post things that I find interesting and occasional rant at life. Till next time… Stay hungry!