It was very confusing to dedicate so much work for such a useless project
- Made in cooperation with my mathematician friend
- Django framework
- Elements of TDD (Functional tests)
- Deployment is automatized with Fabric
- There is no database, as there is no need for one
- Styling is minimal
- AJAX enables 2 player game
Rok has just finished reading the book Test-Driven Development with Python by Harry J.W. Percival. The book was very helpful and beginner-friendly, as it provided clear instructions and also introduced some common programming tools and techniques (sorted by usefulness):
- Automating deployment with Fabric
- Controlling web browser with Selenium
- Testing Python code
- Integrating git into workflow
- 'Staging server' and 'Production server'
Around that time Luka, Rok's friend was visiting. He had something to show. Simple game, nicknamed 'Sticker',
which 'is interesting only for the first 5 rounds'.
Rok then had the idea to turn the game into a web game and Luka agreed: one would make the Sticker game module, called
and the other would make a Django web project, which would use
Rok already had experience with delegating programming tasks and writing specifications. They sat down and decribed data that will enter and exit from Luka's module.
After that, each of them went to work. Rok attempted to code the whole project using TDD. It didn't matter if there was no Sticker module yet, as he could always just use mock data. So he tried to do that for 2 weeks. Following the TDD methodology was very hard whenever the project was different from the project done in the book. Writing the unit tests was the hardest part, but Rok kept at it, as he desired to apply the newly learned skills. He started to learn from other resources. He spent several days studying other material on TDD (Book by Kent Beck, uncle Bob's video, Ian Cooper's talk, etc.)
But after some time Rok had to admit the defeat. He was just too unexperienced to move forward with TDD. Out of frustration, he started the whole project from the beginning, but still keeping some things he did understand (Functional tests, deployment with Fabric). Rok worked for 3 - 6 hours per day (but not on weekends), and after 2 weeks the project was deployed.
However, the project had a major flaw. 2 player game mode was highly unpractical, as the players would have to meet in another service, share the game URL, and on top of that both be online at the same time. Rok decided to improve this. He was brainstorming, but the plans changed every day. It was very confusing to dedicate so much work for such a useless project.
Finally, Rok finished the project, despite its disadvantages. He showed it to a senior programmer who said: 'Why are you making AJAX call every 0.5 seconds, when you can just use the web sockets?'.
Rok did some research and found out, that Django channels is officialy part of the Django project and it enables the use of web sockets. He began studying the technology with the goal to apply it to the Sticker project. He realized, that the use of web sockets would make his project much simpler and better to use!
But right after setting up and starting to mess with the Channels, Rok had to make a break from programming, since he had to study for his Matura exam, as it included 4 years worth of subject matter for 5 different subjects.
The game on homepage runs entirely vanilla JS. There is only some JQuery code that retrieves information from a specific view about the next 'machine move'.