Category Archives: Programming

Learning a new language this year: javascript

Over the next few weeks, some people on the team at Trunk Club are going to be working with Ember.js and Backbone, and maybe some other libraries and frameworks. The goal is to choose one that will, among other things, help us build faster applications. I’m simplifying here, but the basic idea is to improve user experience through speed.

We use coffeescript, I’ve dabbled with jQuery and paired with people on Backbone but I am frustrated with not understanding enough, with not knowing the foundations. So I’ve decided that I would seriously learn javascript, starting right now!

I’m excited because this is the second language that I learn after Ruby. I’m hoping that it will be an interesting challenge, that it will benefit my work and my personal projects, and that it will feel easier after having spent the last year learning programming.

Here is my three-pronged approach: screencasts and exercises (Treehouse and Codecademy) and books (I started with Eloquent Javascript). I will update my blog as I find more books and exercises, online help and reference, and when I pick a project to use my new skills.

Jean

Quick update since drafting this post: so far it feels much easier than learning a first language. It’s also nice how Codecademy and Eloquent Ruby seem to follow the exact same curriculum (at least it feels like what you learn in one is reinforced by reading it again or by practicing it on the other).

Apprenticeship week 26

This post was originally posted on Trunk Club’s tech blog at http://techblog.trunkclub.com/post/43453434602/trunk-club-apprenticeship-week-26

So … it’s been eight weeks since my last blog post. The last blog post I wrote said: “Next week: Review, working in a smaller team, Kissmetrics and Trunkboards version 2.” The review went very well, the second part of my apprenticeship was eye-opening and I definitely felt like I turned a corner. Concepts and patterns were easier to understand, I felt more useful when pairing, and I was able to get more done.

Teams have been broken down into smaller team focused on specific functions within the company, and I completed the Kissmetrics and Trunkboards v2 projects.

To be honest, the last eight weeks are a big blur. It’s been very intense, a race to the finish to accomplish as much as I could during this apprenticeship. I wish I had blogged more but it was not a priority: If I were to graduate from my apprenticeship and become an engineer, I would no longer have the luxury of being an apprentice, i.e. spending so much time learning. So I made the most of the time I had left.

I had my final review at the end of last month. Everyone from the tech team was there, plus a few people from the product team. I did two presentations: one just for the tech team, highlighting everything that I learned, and a second presentation for the larger group talking about the apprenticeship itself, how I got there and what I got out of it, followed by questions and answers.

It was awesome to list the stuff that I had learned, and also see how much more there was for me to learn. I appreciated getting feedback on my performance and hearing what people thought I should focus on next.

I left the room to let the group discuss what was now my application for an engineering position. I would be leaving for a pre-planned trip to Europe just two days later and would be gone for almost three weeks, so I was eager to hear the outcome of the apprenticeship before leaving. The day after the final review, before a happy hour event with the sales team, I got the great news from Mike Cruz that Trunk Club was offering me a position as a Software Engineer. I’m very happy and excited to have accepted that offer today.

Apprenticeship week 18

This post was originally posted on Trunk Club’s tech blog at http://techblog.trunkclub.com/post/26299721840/trunk-club-apprenticeship-week-18.

Now that felt great: I worked on a project that was very similar to last week’s Kissmetrics project, except this time it took me two days to finish it instead of five! I’m now completing projects regularly and I have code to commit to the release every week. My contribution level is definitely increasing on a weekly basis.

Part of it is understanding our code base better, but part of it is also having a much smoother workflow. I program, test, commit, present/test with stakeholders with much more ease now, which allows me to focus more on my code. Things are easier with the product team. I feel like I’m more helpful and pro-active with them, and we get more done.

I’m also able to quickly build upon what I have just learned, needing less time to digest. Tuesday night, at the end of the day, I received a request for a feature and was able to get it done just a few hours later. A few weeks ago such time constraints would guarantee not finishing on time, but this one was doable thanks to the projects that I worked on the last few weeks. I feel like I can take on a much wider variety of projects now. I probably just need more time to complete them than others (which I don’t mind taking), and even that is slowly getting better. It’s all about adding more value.

I finished reading Seven Languages in Seven Weeks. I’ll post my notes on Seven Languages shortly, but the short take on it is this: Great book, helped me understand how other languages (non-OO, functional etc.) function, and what the best use for some of them is. Sometimes it was a bit above my level, but never enough not be understandable and useful. I’m going to pick one of the languages to play with it (Scala or Haskell?) and I’ll probably read the book again in a few months. This week I went back to a non-coding book and started reading Agile Samurai by Jonathan Rasmusson.

This weekend I will be finishing up preparing for my four month review on Monday. The last couple of months have been awesome, with an acceleration of my learning mid-way through, and I’m excited to present it to the team.

Next week: Review, working in a smaller team, Kissmetrics and Trunkboards version 2.

Apprenticeship week 17

This post was originally posted on Trunk Club’s tech blog at http://techblog.trunkclub.com/post/25888687086/trunk-club-apprenticeship-week-17.

This week I started and finished the Kissmetrics project that was assigned to me. Pairing with Mike on Monday helped get me started and after that it was just a matter of going through the stories that were assigned to me one by one. We’re also improving our testing methodology and testing earlier in the week, testing with the product manager both locally as soon as possible and on staging after the weekly code freeze. Of course some things were not working while testing. Sometimes the logic hadn’t been thought through, and sometimes my environment wasn’t set up properly for testing. And throughout the week we were getting feedback from end-users that meant changes in the specifications. But I am happy that even with all these bumps on the road I managed to deliver the finished project on time for the release.

I’m also getting more comfortable with releasing, using apache, figuring out log files and understanding errors. While I may never become a dev-ops, I do want to master that area of expertise so that I can help with it whenever necessary. I’m using heroku for the moment for my side/learning-project but as soon as the mvp is live I want to move it to AWS or Linode and learn how to deploy and maintain applications on a VPS.

Finally, I’m getting ready for my four-month review, coming up soon on July 2nd. I’ll be at the office this weekend working on the presentation itself and the web application that I will be demoing. I’m nervous but also excited because while the last two months have been very busy, I feel like I didn’t get enough apprenticeship tasks done. At the same time, I really turned a corner: things make sense, learning is easier and faster, and I’m so much more productive. I’ll continue working on making a great presentation next week.

Also next week: Implementing Iron workers on Trunkboard, using Redis better for performance, fixing sales report bugs before the end of the month.

Apprenticeship week 16

This post was originally posted on Trunk Club’s tech blog at http://techblog.trunkclub.com/post/25459834520/trunk-club-apprenticeship-week-16.

I started working on the Kissmetrics and Leviathan integration this week. It’s the first time that I have worked with our www application. Browsing the code and finding what I’m looking for takes a little bit of help but it’s definitely much less cryptic than I thought. Familiarity with our business and our code base on the API side is definitely helping.

I also started using Resque for queuing background jobs. That’s another thing that feels really straight-forward now and was difficult to implement a few months ago. We’re sending the data to Kissmetrics asynchronously to reduce the load. This is a good use case for asynchronous jobs and we’ll be looking into more jobs that could use this method and speed up our application.

I finished reading the Sinatra book that I picked up a few weeks ago. I put it down for too long after moving away from the Sinatra app that I was working on but finally finished it. I started reading the next book on my list: Seven Languages in Seven Weeks by Bruce Tate. Going through the Ruby chapter was quick, a nice refresher. I’m moving on to IO this weekend.

Next week: finishing the Kissmetrics project, improving Trunkboards and getting ready for my four month review.

The :assets group in your Gemfile

I was looking at our Gemfile at work today and noticed that we were not using the :assets group that is in the default Gemfile. When you create a new Rails application, that group will look like this:

group :assets do
 gem 'sass-rails', '~> 3.2.3'
 gem 'coffee-rails', '~> 3.2.1'
 gem 'uglifier', '>= 1.0.3'
end

A quick search helped me understand the purpose of this :assets group: it basically acts as a shortcut for other groups based on what you set in your config/application.rb file:

if defined?(Bundler)
 # If you precompile assets before deploying to production, use this line
 # Bundler.require(*Rails.groups(:assets => %w(development test staging)))
 # If you want your assets lazily compiled in production, use this line
 Bundler.require(:default, :assets, Rails.env)
end

Because I didn’t need the convenience of the assets group, I can comment out line 3 and uncomment line 5. Then I move the gems out of the assets group and delete that group. It helps me keep my Gemfile clean and allows me to organize it more freely. I usually group gems that do not belong to a specific group based on their role: # carrierwave, # front end, # authentication, etc. For example:

# mongo
gem 'bson_ext', '1.6.1'
gem 'mongo', '>= 1.4.0'
gem 'mongoid', '2.4.7'

Source: http://stackoverflow.com/questions/7351607/how-is-the-assets-group-in-rails-3-1-handled-by-bundler

Apprenticeship week 15

This post was originally posted on Trunk Club’s tech blog at http://techblog.trunkclub.com/post/25443016021/trunk-club-apprenticeship-week-15.

This week we had our second hack day: different teams, different projects, same goal to build something in a day that could benefit the business. This time we had several themes to pick from, including Salesforce integration, social graph and inventory management. Our team built a notification system for stylists to be notified when an item that is not in stock becomes available. We also built a neat tool to search items in our inventory while building a trunk. The notification feature will soon make its way to production, which would make it the first feature coming out of hack day to make its way to our main application. The other team built an iPad app that lets you vote for your most stylish friend after pulling them from Facebook, a fun game that could help us with lead sourcing. The rest of the company will get to pick the winner next week during our demo time.

I got to play with Redis for caching. I am trying to improve the performance of Trunkboards. All of these queries add up and it took too long for the page to load in my opinion (around 20 seconds). So I started caching the data using Redis for the queries that took the longest to respond, running them if there is no data in Redis and expiring them after an hour. It’s much better, with the page load time down to around 5 seconds. But I think it can be improved more by running the queries through a background job at regular intervals and have Trunkboards only query Redis. For now, I’m waiting to get feedback from users before working on the next features of Trunkboards.

I got a new project: the Kissmetrics integration. As part of our push for data we will start using Kissmetrics to track our sales funnel. This requires me to record a variety of events throughout our applications. I’m very interested in this project because it will force me to understand our front-end application and how it interacts with our API.

Next week: Kissmetrics, Resque/Redis for queuing, finshing a book and starting a new one.

Apprenticeship week 14

This post was originally posted on Trunk Club’s tech blog at http://techblog.trunkclub.com/post/25414298215/trunk-club-apprenticeship-week-14.

This week was a little slower. It had to be after the long and intense previous week. I had put in a lot of hours to get Trunkboards released. It was great to get that done but I needed a slower week. I got to spend a little less time coding and a little more time reading, blogging and learning.

Working on Trunkboards also helped me work with the product team and stakeholders. I have always been on the other side of the equation, giving product specifications and instructions to the product team or the tech team. Now I am getting instructions and specifications for the work to be done. The benefit of working in a smaller company (although not too small) is that I can provide a lot of feedback and opinion on the final outcome. I also get to work closely with the stakeholders who are never sitting very far from me.

One achievement that I failed to mentioned last week was getting Devise installed on Trunkboards in just a few hours. Last year, during Code Academy, I tried to get it on my application and couldn’t understand how to make it work. I ended up building my own authentication system. After Code Academy, while I was looking for a job, I tried again on a new application. It was easier but it still felt not flexible enough. So I felt great when last week I got it to work exactly how I wanted it to while spending less than a few hours on it (most of it having fun with CSS styling of the login page). It’s another step that shows me how far I’ve come and how much I’ve learned in the last few months.

Next week: working on a different code base, learning REDIS and hack day – the return!

Reloading changed files during development with Sinatra

While developing Sinatra applications, to reload changed files I’ve been stopping the server (Ctrl C) and restarting it (Rackup), wasting precious time with every change. Today I finally went ahead and added the Reloader extension. Here is how:

Install the gem on your machine (I didn’t add it to the Gemfile since I don’t need it on production):

$ gem install sinatra-contrib

For the simple wedding website that I am working on, a classic Sinatra application, I’m simply requiring it through:

require "sinatra/reloader" if development?

For the modular application that I’m building at work, I added the following code to require it:

require "sinatra/reloader"

class MyApp < Sinatra::Base
  configure :development do
    register Sinatra::Reloader
  end
end

That’s it! Either application will now reload the changed files with every incoming request. If you need to restart the HTTP server on every request check out shotgun.

Sources:
What happened to reloading in Sinatra 0.9.2?: http://www.sinatrarb.com/faq.html#reloading
Sinatra::Reloader: http://www.sinatrarb.com/contrib/reloader
Shotgun: http://rtomayko.github.com/shotgun/

Apprenticeship week 13

This post was originally posted on Trunk Club’s tech blog at http://techblog.trunkclub.com/post/25244797215/trunk-club-apprenticeship-week-13.

What a great week: I just built an entire Rails app from scratch for Trunk Club. GeckoBoard was not giving us enough flexibility and the charts were too big for the largest widget size allowed. So I more or less built a custom version of GeckoBoards for Trunk Club.

Thanks to the Sinatra app that I built last week it was easy to just get the data by calling the API that we used to push data to GeckoBoards. After the initial setup, I spent a big part of the week on implementing Highcharts (fun) and I spent the other part of the week working on the look and feel of the app with SASS (more fun). And I also implemented a feature to send a daily email in the morning to stakeholder so that they see yesterday’s KPIs on their way to work, a feature to export a dashboard to pdf to share it with others, and authentication through Devise using our employee database. Woo!

I keep feeling like I need less help. I still get stuck but not against a wall, just slowly making progress and eventually getting there. However, the week was pretty long and I haven’t been really good at pacing myself or doing apprenticeship tasks such as reading and bogging. I think it’s ok every now and then but I don’t want to get burned out either.

Next week: resuming blogging, moving on to another project, planning for four months apprenticeship review.