What the heck does capybara have to do with Sinatra? Maybe they both like donuts?
Well…they are both gems, and free!
I am continuously amused by the variety of wicked names for gems that we come across in the coding world. For those of you who are new to software development, gems are libraries that make developers’ life so much easier.
As a visual learner, I found it really difficult to grasp the ‘big picture’ when we are learning the concept of web development . There are so many different components and frameworks – honestly I struggled to picture how they ‘talk’ and relate to each other. The below diagram is an example of said attempt to understand how everything fit together.
Today I Learned
Web application is very much a request and response mechanism between the client and the server, period.
The client is usually the browser (sends request), and the server (receives request and send response back) can either be a remote server in another part of the world, or it can be a local server on your computer. This week we are learning to use Sinatra (not the jazz singer) as a web framework that enables us to write our web application, acting as the local host. Words on the street says that Sinatra is lean but powerful, when compared to other ruby based web frameworks, such as Rails. Guess we will find out later in the course when we play with Rails but I have done my due diligent research.
TDD to BDD
Continuing the practice of Test Driven Development, in which every line of code we write is conceived first with a test, we are testing that our web application works with Rspec, which speaks ruby to Capybara, who then talk to many different web automated drivers to execute the tests we have written.
We are working on a fun challenge that makes a battle game, (an un-animated dumbed down version of street fighters) between two players, where one can attack by pressing a button.
It’s very interesting how we are writing the tests now that’s largely driven by the behaviours of how a user would interact with the application. It takes a little while to get used to writing tests in Capybara syntax, though I find it very helpful to break down the user story and picture how I would have wanted to use the application step by step with a diagram.
It’s sort of like walking through the different rooms of a house, it’s all about how one moves about and interact in different spaces.
Daily Inspiration
Wow, there is no way I could have written the above at the beginning of the day, when all my research led to funny youtube videos such as capybara being punched double fisted by a monkey.
I am sure the afternoon sleep meditation was a huge bonus to today’s productive learning, a special Wednesday treat.
Today no one snored, or at least I didn’t wake myself up. 🙂