DEV Community

Ellie Manifold
Ellie Manifold

Posted on

Web apps: Battle and RPS

This week we were looking at web apps, which involved creating an app hosted on localhost with Sinatra and tested with Capybara, using RESTful routing and MVC (Model/View/Controller structure).

This was the week that I enjoyed the most so far, as there is something so satisfying about seeing your code come to life in a more 'physical' sense than simply running the program in IRB. Over the last few months I have been leaning heavily towards front-end development as a career path within software development, and this week was a great continuation of the knowledge I had built from my previous independent projects.

Our afternoon challenge consisted of making a 'Battle' game, using Ruby, HTML, and some CSS. This was actually a more difficult challenge to complete than the weekend challenge. The premise was that each player attacked the other, and when they did so the opponent lost 10HP (hit points). While I completed the functionality, unfortunately I did not have time to do any CSS, so I will try and revisit this in future weeks if I have time.

The weekend challenge was my favourite so far. We built a game of Rock, Paper, Scissors, again using Sinatra and Capybara with Ruby, HTML and CSS. This was similar to the Battle app that we did during the week.

Something that I'm struggling with and was prevalent this week is to always stick to writing my tests first, before I touch on writing any code whatsoever. Personally, I begin to understand the task so much more after I begin writing the code and it starts piecing together in my head, so only after this I know what to write tests for. This means that I accidentally start writing the code while I'm trying to work out what to test for, and before I know it, I've reversed the order that it should be done in. I have found that there are quite a few people in our cohort that have this problem. However, I discussed this with a coach on Friday who suggested 'spiking', the idea of writing a part of code first in order to know what to test for (if you're unsure), deleting it once you've worked this out, and then writing the tests. I'll try this in my future work, hopefully it'll solve my problem.

Top comments (0)