Bootcamp Week Eleven: Quizmaster
Well now we’re really in the home stretch — the second-to-last week of bootcamp and just days before we are set free to sail the open seas of the Tech World. And so we start our Final Project.
Thomas brainstormed for about three seconds before he suggested we make a quiz app that could, in theory, be used to run Pub Quiz. (The fact that you’re not allowed to use your phone during Pub Quiz didn’t seem to phase anyone, so we pushed on.) We’ll be debuting the app at our graduation party, which will have a Halloween theme — hence all the orange and “spooky” font and such.
The data structure would be simple: the Quizmaster would create Quizzes and Questions for them. Teams would submit Answers. The Quizmaster would mark the correct Answers and the app would, of course, add up the final scores. Simple. Until you throw in… bum bum bum
Action Cable. Action Cable is new with Rails 5 and as such is on the cutting edge of what people are doing with the framework. We quickly realized that, as opposed to other things we had built, it was relatively undocumented online. A number of examples, most of which seemed to have directly copied from each other, explained how to build a chat app. Another built a really cool-looking chess game.
Action Cable is a nightmare for Agile developers
An aside: In the design phase of this project (that is, Monday), our coach “tested” us by saying he wouldn’t make a big deal out of it if we decided not to unit test everything. “Uh, why are we even having this conversation?” I asked. “Of course we’re going to unit test everything.” He has indeed molded Test Driven Developers.
He has also written up a blow-by-blow of how this app was developed this week and the steps it took to get there. (Though I feel he’s being too humble, seeing as apparently no one else on the entire internet has managed to actually test ActionCable.) I’ll summarize.
Thomas got us started on ActionCable with help of the chat-based tutorials — everything was in place to send a cable. Then we set out to make our first broadcast from the controller, as the Teams were first loading the Quiz page. We worked at it all day, no dice. We realized towards the end of the day we couldn’t do what we wanted to do. No problem. We just won’t do it.
Wednesday, bypassing tests for a minute as we spiked up the functionality, we quickly got a message sent from the Quizmaster page to appear on the Quiz page. Success! The app worked great, now we needed to write a test. (Of course, as Agile developers, we had already written a test, but now we needed to get our test to perform the same actions as someone actually interacting with the browser.) This is where things got nasty.
At first, we simply clicked buttons as we normally do. But no, we did not “see” our pushed question. I, personally, spent at least six hours working on this problem. I read tons about ActionCable and found plenty of evidence that we would not, in fact, be able to test it at all. (More info and links on Thomas’ post). I found out how to read logs (which Atom was hiding from me) and watched, fascinated, how they changed as we clicked through the site and then ran our tests. I believe working with the logs allowed me to remove a few small obstacles. The real insight came when Thomas realized we needed to be working on a server that allows threads. A little Puma magic and: boom! the test goes green.
Also, I would be quite remiss if I did not tag Raoul. However, if I’m being honest, I’m not exactly sure what he did. Anytime server configuration comes up, Raoul takes the lead, mostly offline.
ActionCable is awesome for Agile developers
I’ve learned so much working on this project and though it was extremely frustrating at the time, it was so valuable to me to be working on a project that wasn’t cookie-cutter perfect from the start. We’ve had bumps all along the way over the last eleven weeks, but none of us have had the privilege of watching our coaches flounder so extensively.
As junior (ok, babies-learning-to-crawl) developers, everything is new and mysterious and exciting, but to our coaches, most of this stuff is old hat. Not so with ActionCable! We got to watch them work for an entire day to send a message from the controller as the view is loading, to realize the technology doesn’t work that way. And we got a front row seat to see how an extremely experienced developer approaches testing a new technology. And since it actually worked, we now get to develop with that technology in a Test-Driven Development environment — something it’s clear almost no one else is doing. Very exciting!
The future for Quizmaster
You can see our app in action as we develop it. No doubt we will soon create the ability for the Quizmaster to log in and write his own Quiz and Questions, but for now there are seeded Quizzes and Questions. You can play at:
We’ve wrapped the first week for this project, but we will continue to work through the weekend and next week. The goal is not just a functioning web app but a mobile client so that everyone can play on their phones. I’m personally hoping to get the thing on the Android store, so fingers crossed I’ll have a link for you next week!
One last thing
My lovely classmate Viktoria popped up in the middle of this with one of the best finds ever: Bitmoji. It’s everything and you must participate. So farewell friends, and wish us look on our last week of bootcamp!