I took the belt exam on Wednesday of Python week 3. I was a bit nervous going in that there would be something I had never seen before and I would not be totally prepared for it. Or maybe I would screw up the deployment. I was actually right on both counts, lol. After starting the exam I quickly realized that I would need to do some stuff with dates and, well shit, I don’t know anything about using dates in Python. Off to the google I went, and I was able to find a solution to satisfy the requirements of the project using standard HTML datepicker fields and and the strptime() function from Python’s datetime module. With Google on my side, there’s no need to worry!
I managed to reuse quite a bit of code for the belt exam. I won’t spoil it in case any future Coding Dojo students are reading this, but the belt exam was definitely easier than the belt reviewer. Some of the requirements were actually the same as the belt reviewer, so the same code can be used with just a few tweaks. I reused as much CSS as possible as well. Though CSS is technically not required for the exam, I couldn’t help but make it pretty.
When it was finally time to deploy I still had about an hour left on the timer, so I started walking through step by step using the instructions laid out on the platform. When I executed the last command to restart the server it was the moment of truth. I navigated to the public IP and got a big fat nothing. Uh oh. Seeing as I had no idea how the deployment actually works, I looked back over my terminal but nothing really stood out as something I could have messed up. I had no choice but to start over.
There were 40 minutes left on the clock when I started my second deployment attempt. I paid attention more carefully to everything I was putting into the terminal this time around. On my first attempt I must have made a typo while I was editing some file in vim, or I could have executed some command in the wrong directory. When I got to the moment of truth the second time around, it worked. My belt exam was completed with 20 minutes left on the clock. I zipped up my code for upload and pasted in the link to the project on the exam app and I was good to go.
The rest of the day was spent helping out my cohort-mates with ORM stuff and reviewing inheritance/composition/polymorphism in Python. Seems like taking advantage of composition and polymorphism over inheritance is the way to go these days. Using straight up inheritance usually involves overriding a bunch of the parent class’ methods, so it doesn’t really help when trying to write DRY code. I never really thought about it before, but I suppose it does make sense. After learning more about this kind of stuff, it makes me realize that Swift’s protocol-oriented-programming design really is pretty awesome!