Wednesday, July 16, 2014

Day 48: Rails TDD (Rspec, Capybara, and Selenium)

Now I'm getting into the meat of what Test-Driven Development is all about. It's really about making sure that everything that you intend your program to do is done properly. Although it's initially slower to make these tests, in the long run you run into much less debugging issues and is better in the long run.

Here's a quick snapshot of my code for testing.



What my Selenium code is actually doing is actually visiting the intended external site and doing whatever I tell it to do. In this example I'm telling the code to put in information in the email and password input fields and click submit.

The crazy part is that it does the whole thing right in front of my eyes. The code literally opened up my Firefox Browser, filled-in the proper input fields and clicked "log in"



It's quite amazing how sophisticated these tests are capable of. It'll probably take me another half of a day to solidify this. Once that is done, I'll be learning deployment to make this Ruby on Rails stack full circle.

Day 47: Intro to TDD (Test-Driven Development)

I couldn't get much done today because of some prior engagements but I did manage to get as much done in terms of dipping my feet into the world of TDD. Ultimately TDD is a way to test your code as you're writing code making sure that the code acts as expected.

It's really crucial that you are constantly writing good code and making sure that your code isn't bugging along the way. It really comes in handy when you are debugging your code as well.

Furthermore TDD has gotten so popular that it is widely accepted in the Rails community as well as in the workplace. It's definitely something to have in your resume.

Monday, July 14, 2014

Day 46: Ajax with Rails

Back to Monday again!

Today I finished the giant Wall assignment in Rails and moved onto utilizing Ajax in Rails. I didn't think I would see Ajax again because of the technologies in Angular.js and other front-end frameworks. But it is good to re-learn Ajax. I must admit that I forgot how to actually do an Ajax call in the traditional way and had to go back and relearn it. Thankfully it was like riding a bike and I was able to do the assignment without too much trouble.

Here is the good ol' Ajax assignment back when we were still doing PHP. The only difference is we're doing it in Rails.



Up next we have TDD with RSpec and Capybara.

Friday, July 11, 2014

Day 45: More Rails Applications

Today was simply more iteration on creating Rails application. This time we were to create the infamous "Wall" assignment.

I thought I was going to blaze through this assignment like I was doing with the previous assignments but this is taking much longer than I expected. It mostly took me a long time to figure out the logistics and what the steps were that I needed to take.


Here's just a quick glimpse of my workstation with my code, rendered view, terminal, and assignment.

These weeks have been going by really quick and I can't believe it's already Friday. Had an intense week of coding and will definitely do my best to relax this weekend so I can finish the Rails section strong!

Thursday, July 10, 2014

Day 44: Rails (Controllers, RESTful routing)

Index, new, create, edit, update, show, delete are the 7 routes that are part of the RESTful architecture. Pretty much stating that all users need these 7 functions.


This morning we had a lecture about this RESTful architecture originally thought of by a Stanford Ph. D. The rails community has heavily accepted this and have created routing rules so to make it easier to organize your code.

Today we continued working on assignments by building application. This time actually using a SQLite database to connect with the Views and Controllers.

The true beauty of Rails is how quickly I am able to build this application as opposed to Codeigniter or Express. It's no wonder that it has such popularity amongst the startup community!

Wednesday, July 9, 2014

Day 43: Rails (Controllers)

Now we're on to the Controllers and Views portion of Rails.


Here's the "smoke page" to let you know that the Ruby on Rails server is running and you're clear to start making your application.


One of the best parts about Rails is how easy it is to install dependencies using 'gems'. I am easily able to install Twitter bootstrap and make it available to all the view files.

The type of applications that we make as part of our assignments are similar to the ones we've done in other languages but this just time we're doing them in Rails. It really makes you think that languages are just different ways of accomplishing the same thing. Although each language and framework does have their strengths and weakness, they are much more similar than different.

I'm really loving how I am understanding what exactly is going on when Rails is generating a model, view, and controller and how the routing rules dictate how the application is run. It's probably the best framework to build a prototype because of how fast it is. You really do save a lot of code because of how Rails does a lot of connecting and rendering for you. You have the follow the "Rails Way" else all the functionality doesn't work at all!

A lot of my classmates as well as I are definitely feeling burned out. I try my best to take periodic naps and breaks and remind myself of why I embarked on this journey in the first place. This bootcamp-style learning was never meant to be easy, but in the midst of it it's often difficult to keep the drive strong. Definitely not for the weak-hearted!

Tuesday, July 8, 2014

Day 42: Rails (Models)

Coding Dojo teaches you how to work with Models first when learning Rails. I especially thought this was clever because models do take some time to learn and can be learned independently. The other components (controllers and views) are heavily reliant on each other along with the routing, so it's best to chip away at these as simple as possible.

Rails uses ORM (Object Relational Mapping) to communicate with the database. Regular SQL queries can be used however it is frowned upon in the Rails community. When possible, we should always be using ORM.


Above is just a picture of me working with the database in the Terminal. Eventually these queries will all be made in the application code but its good to get comfortable with queries using the terminal as practice.