Qt's Home

The Story of a french guy discovering the world

Week 7 - Day 3 - Test Driven Development, the New Guys, and My First Full Project

| Comments

Test driven development

After a few days of testing, we started the test driven development on Rails.

The idea of test driven development is to make tests before you type any code. Let me give you a small example :

  • Situation : I want to give a user the possibility to create an account
  • I write tests, from the biggest to the smallest:

    • Test 1 : Fake an user that clicks user creation, then fill in the fields with correct info and click on the create button. The user should be taken back to the first page, and now he can login with these infos. (Integration tests)
    • Test 2 : Fake a request on the creation page, it should be defined and give a form.(controller test)
    • Test 3 : Fake a request on the route it takes after you click on the “Create” button. It should add a new User to the Database (Controller test)
    • Test 4 : The DB should not accept info that is not correct, so you test if it adds something when you try and push random invalid info to the DB (Model Unit Test)
  • Now I have that behavior, that I specified more and more, while writing the tests. Now, I can make the tests pass one by one. I start with Test 4, make these limits, then 3, 2, and finally 1.

W00t? You have code that does exactly what you want, and that does not break! If you want to add code later, you just have to run the tests once this is finished, and make everything pass according to plan.

It tends to take a bit longer, but then you have a “perfect code!”. So do that!

The new guys

I spent a bit of time with the new cohort. They are awesome!

It is amazing to see that the tribe spirit is actually very different, once again. We had the “University students” Sea Lions, the “Overachieving Kids” Banana slugs, the “Shy kids” Golden bears, and now I think we have the “Against-all-odds team” fiery skippers.

Many of them don’t come from computer science backgrounds, many are not the usual start-up 20-something american bearded dudes. But then, I am really impressed with the effort, and especially the team spirit they have. If one knows, one shares. Pairing is optional today? I heard : You can make bigger groups.

That is something I really resonate to, I just love it. They ask questions, try to know, show, learn, share, every verb I love ;)

I think I’m gonna hang around a lot even after graduation, because I think these skippers are going to impress me big time!

And Golden bears are good too, but I just think that individuality and shyness makes it harder. I am expecting good things to come out of the final group projects of the Bears, but I feel like they will struggle more than the skippers.

My first full project

So, I finished my project. You can see it live on : Heroku, and the code on Github. You can also check some of my tests on Jasmine.

It shows you a list of movies that have been shot in San Francisco. You try typing a movie title, and it autocompletes the movie title. It then geocodes every location where it has been shot, from the address that I am given by Sfdata, and pins them on the map.

Then, I make small popups info windows for when you click on the pin, with the director, location, name, year, and a link to IMDB to find the movie.

It is not that impressive, but I f*cking did it! I took 2 days (Plus 2 slacking with only one commit… oops), and I learned about things I did not know about :

  • Flask
  • Jasmine + Sinon
  • Backbone
  • Google Maps API
  • Google Geocoding

And now I feel good about it!

Comments