Pairing Post Mortem - @_zph - VIM and a Gem

Last night I had a great #pairwithme session with @_zph. He’s been doing Ruby on nights and weekends for the last few years and he’s been using VIM much longer than I have. I learned a lot of little tricks about VIM that I just hadn’t quite worked out before. We also refactored some of his Buff Gem. Setup: Zander had a VPS already provisioned with my ssh keys installed. Super Easy setup. TMUX + VIM for our editors RSpec for testing the Gem We started off trying to think of what to pair on within Zander’s gem. He was concerned about the tests, so we actually spent a fair amount of time just looking at the WebMocked tests and discussing the pros and cons. Eventually we decided that WebMock might be a good way to start off your TDD of an API wrapper since you have complete control of the response, but VCR gives you the best long term support since you can both get fast tests and confirm that you’re still working with the API correctly and that you didn’t just magically stub out the wrong thing–just delete your cassette and you’ve got “free” real API tests, followed by nice fast tests. ...

June 5, 2013 · 3 min · Mark Simoneau

Pairing Post Mortem - @Shicholas - Real World Lessons and Bowling

Last night I had my first pairing session with @shicholas. Nick recently graduated from law school and is looking to pass the bar, but somehow programming calls to him. It’s a good thing too, since he’s clearly gifted and a fast learner. Setup: ScreenHero Sublime Text 2 shuhari by @jarhart While we were kicking things off with the “get to know you” talk, I found that Nick had a Rails + Angular.js app he was working on. I’ve not done any work with Angular and asked him to show me what was going on. He pointed out the general structure as well as the custom directives that Angular.js allows you to create. I’ve watched the Ember.js Peepcode Intro, and found it difficult to get excited about it. Being introduced to Angular.js in this particular manner gave me real world applications and it seemed much more intriguing. No verdict yet on either, just initial impressions on both frameworks. ...

June 4, 2013 · 3 min · Mark Simoneau

Pairing Post Mortem - @kmeister2000 - Refactoring and MiniTest

Had a great 4th pairing with @kmeister2000. Always a pleasure to work with him. Interesting Parts of our session setup: Worked on a real world app Karl was developing Used MiniTest instead of RSpec Refactored existing code MiniTest Takeaways: MiniTest expectations about method calls are not as clear as in Rspec and the documentation/examples aren’t as readily available. MiniTest is a lot like RSpec in nearly every other way. I’m not a fan of Mocha. I think it promotes antipatterns for how to really test. I actually like the explicit mock.verify in MiniTest::Spec General Takeaways: ...

May 29, 2013 · 1 min · Mark Simoneau

Pairing Post Mortem : @hinbody - TicTacToe and TMUX

I just finished my first #pairwithme session with @hinbody. It was my first remote session to use TMUX+VIM instead of ScreenHero – I have to say, it was quite easy to use and given the fact that it’s free, fast, and cross-platform, I’ll be using it with any vim users I pair with who are willing. I’d love to get CoVim working since it allows you to use your own vim setup. I drool a little bit at all that. But I digress. ...

May 29, 2013 · 3 min · Mark Simoneau

Pairing Post Mortem : @thecommongeek - Ruby Koans

I paired with @thecommongeek last night again. This time we were more prepared and I think the session went much better. In our first session I misjudged where Dennis was as a coder and struggled a bit with how to pair with him effectively. This time we had him drive through ScreenHero and decided to start from the “basics” by doing the RubyKoans. The RubyKoans are meant for Ruby 1.8.7, but 1.9.3 is commonplace now, so we struggled a bit at the beginning. For anyone going through the RubyKoans on 1.9.3 getting a value19 in nearly all your errors, I’d suggest making the following changes on neo.rb (starting on line 34): ...

May 28, 2013 · 2 min · Mark Simoneau

Pairing Post Mortem - @javichitone - Improving a Gem

I had my first international pairing session with @javichitone tonight. He’s from Peru and will soon be graduating. He should have no trouble finding a job based on the code I got to read of his :) We talked for a bit and settled into looking at a gem he recently published. Since it was his gem, I elected to drive. I’m familiar enough with gems that I’m comfortable in general, but he knew the specifics of his gem, so to get the most out of it, he needed to be commenting on the specifics he knew and I needed to be diving into figuring out those specifics. ...

May 22, 2013 · 3 min · Mark Simoneau

Tic Tac Toe TDD

I spent a little (longer than I thought… maybe 2 hours?) implementing Tic-Tac-Toe in the TDD As If You Mean It style. Ended up with a VERY different implementation than I ever would have done if I just “started coding” – everything was only in one class, including the AI to “play” against itself. Observations: It was quite different to implement things inside the test method. I ended up coding like it "does something..." do player = Player.new def player.something # do work end player.something.should be_true end It was difficult to not refactor as I went. Many times I would see the duplication and want to refactor immediately. I resisted this urge until I felt the implementation was done, then refactored out duplication, ensuring that the tests continued to pass after each change. I’m still not quite sure how you’re supposed to improve design without breaking the rules. Doing pure method move seems limiting and doesn’t allow for you to see duplication. The only thing I could think of is that there can be additional refactoring after you’re “done” All in all, a very interesting exercise. I want to do it now on something broader, and eventually on something that has a core with a wrapper so that the core is purely TDD’d and the wrapper is thin, but swappable. I think Dominion is my next big attempt.

April 25, 2013 · 2 min · Mark Simoneau

ImageMagick, JPEGs, and Orientation, Oh My

I’ve been working on a new project and decided to use CarrierWave to handle image uploads (and minor automatic manipulation). Everything looked great, but then my new boss, who has a penchant for finding the one or two things wrong with your latest well-tested feature uploaded a JPEG that looked fine in Preview, but automatically rotated on upload. After checking through the directory, it seemed that only the processed images were getting rotated. Actually, ‘rotated’ is a misnomer, they were actually just losing their orientation. JPEGs have EXIF meta data that can contain the orientation of a picture, no matter how it’s stored. This allows cameras to store everything as a 640x480, but display some in the reverse (480x640). The only thing different when the camera writes the image is what orientation the gyroscope adds to the meta data. ...

June 13, 2012 · 2 min · Mark Simoneau

DCI Generators in Rails

Recently, in my new project, I decided to take the DCI approach that Mike Pack outlined, which has been really cool. I’ve been able to keep my tests fast, and have very distinct buckets to put data (models), specific roles of that data (rather than cluttering up the models), and an easy way to take a use case and map it out programatically (contexts). I noticed that I was generating roles and contexts regularly and copying from previously written code examples so I decided to make role and context generators. The process wasn’t bad, but it did take a couple of steps that took a little digging to understand. ...

May 22, 2012 · 3 min · Mark Simoneau

Best Way to Bundle

Thanks to the RubyRogues Episode on Bundler, I learned the best way to use bundler. You want to always use the “pessemistic” version numbers for a handful of reasons. gem 'rails', '~> 3.0.3' gem 'rspec', '~> 2.7.0' This allows the most efficient resolution of gem dependencies (in this case, any version of rails from 3.0.3 up to and not including 3.1, and any version of rspec from 2.7.0 up to and not including 2.8) and the added benefit of allowing you to easily patch everything safely using only bundle update. ...

March 14, 2012 · 1 min · Mark Simoneau