Friday, December 30, 2011
Yet another move
I migrated all the posts (manually as the export thingy didn't work). I even moved over comments that weren't spam. You'll notice a lot of "Originally from ...." if you look at the comments. There's no way for me to add a comment on someone's behalf it seems so I just added them all myself.
Hopefully I'll have more to say soon.
Wednesday, February 16, 2011
Mocking Out Omniauth for Cucumber Testing
A few months ago some friends and I got together for Cleveland Startup Weekend and started building our "next big thing" DreamKumo.
We had a couple challenges. First we knew from the get go that we wanted the site to be 100% facebook integrated. That meant implementing Facebook Connect and the Facebook Graph API. We also are a group of people who throughly believe in ATDD, TDD and agile development principals (and practices) in general. This led us to building up cucumber features for every area of the site.
We hit a snag though when we tried to cuke our login process. We're asking our users to login through Facebook connect, which means when they click the login button they are redirected to facebook.com, and then sent back to us. Implementing the requirement was pretty simple using the omniauth gem with a little help from the folks at Rails Rumble. Cuking it is another story. Since facebook connect actually redirects the user we can't mock out the request using fakeweb and we don't want to cuke what happens on Facebook.com since 1) we can't control it, 2) it isn't consistent (sometimes you get a screen to accept the permissions that your app is requesting, sometimes you get the facebook login screen and sometimes you get redirected straight through) and 3) we don't want to setup a dummy facebook account for our cukes to use.
So we needed to prevent the site from redirecting to facebook, and dummy up the site cookie so it looked like we were authenticated. We also needed the failure case to test what would happen if our user was sent to facebook and they decided they didn't want to grant us permission to their account.
Enter monkey patching.
Ruby has this wonderfully powerful ability to override the native functionality of a method or class at runtime. It's part of it being a dynamic language and it let's you do some really cool things, like manipulate the functionality of any class, including library classes like those in omniauth, at any time. So we dug through omniauth's code to find the point where it did the redirect to facebook and mocked out a response. We then had it immediatley redirect back to the callback url, or the url in our application that responds when facebook redirects back to us. So the result is we never hit facebook and omniauth sends along what we need to determine if the authentication was successful or not.
Ok enough talk - here's the code.
These steps are in a generic_context_steps.rb file in our step_definitions
Given /^I have valid facebook credentials$/ do module OmniAuth module Strategies class OAuth2 def request_phase redirect callback_url end def callback_phase @env['rack.auth'] = {"provider"=>"facebook", "uid"=>"123", "user_info"=>{"first_name"=>"John", "last_name"=>"Doe", "nickname"=>"JohnDoe", "email"=>"john.doe@test.com"}, "credentials"=>{"token"=>"abc123"}} call_app! end end end end end
Given /^I have invalid facebook credentials$/ do module OmniAuth module Strategies class OAuth2 def request_phase redirect callback_url end def callback_phase fail!(:invalid_credentials, nil) end end end end end
Friday, January 14, 2011
Codemash 2011 Recap
In mid January I attended Codemash 2011. Codemash is a semi-regional software conference that, in my opinion, holds its own against any of the larger, more funded, and considerably more expensive to attend conferences that I have been to in years past.
I say semi-regional because while the conference is mostly geared toward the mid-west attendees ultimatley come from all over the country and several are international.
Every year a great deal of care is put in by the organizers to ensure a diverse selection of topic spanning multiple technology stacks and technical communities. I usually split my time between reinforcing the skills I find valuable in my own career and looking into new (to me) technologies that I may not have given enough attention to in the past. This year my "comfort zone" sessions were on git version control, ruby on rails and a couple talks on utilizing agile in somewhat untraditional ways. The "new" stuff for me was a fantastic talk by Gary Bernhardt that was really on the value of Bash and Unix (like i said "new"), android development and javascript BDD.
Gary's "A Modern Open Source Development Environment" talk was the most interesting to me. His overview on the tools and utilities he uses to code efficiently brought to light a number of areas i could stand to improve in on unix, oddly identifying your inadequacies is a common trend when watching Gary code - and I say that with the utmost respect. In the talk gary cited a study that indicated the usefulness of a test suite is inversely correlated to how long it takes to run. It inspired me to go back and look at how I could make our test suite faster on a .NET project I'm on.
Jim Weirich's session on writing and maintaining better tests brought answers to a number of questions I have about test suites in the projects I write and maintain. It also introduced a few new tools I didn't know existed in the Ruby testing space.
Jon Stahl's Agile Enterprise talk was fantastic as well. The general concept being that enterprises have started to adapt agile for their development and IT teams but a lot can be gained in applying many of the same principals of transparency, collaborative work flow and open communication to executive level management and management in general. Organizations Jon has worked with now hold standups for their managers, post information publicly including such sacred and secret information as salaries and perceived level of experience. Most importantly though he highlighted the fact that practice by itself does not make an organization agile. Agile is a combination of culture and practice and without both it really doesn't work.
Of the best keynote presentations, thus far (there is one more to go as i write this) Chad Fowler's keynote on process, apprenticeship and offshoring was the best. A lot of the topics were taken from his book The Passionate Programmer (which I previously reviewed)
Scott Chacon from Github also gave a exceptional keynote on how an open source business operates, giving examples from Github's organization and how it has helped them see success. In many way's Github is the anti-Agile shop. That isn't to say they are rigid or slow to react, quite the opposite, that respect they remain agile but they are very much not Agile. Cap-A Agile usually indicates a very specific process which in itself is designed to make change easy, but still manages projects in a careful way. Think Scrum, XP, Kanban. Github simply lacks established and firm process. They don't commit to dates, they don't follow any sort of project roadmap and they don't hard assign developers to projects, their teams are purely self-organizing. So.. github is agile, the right kind of agile without being Agile.
Wednesday, January 12, 2011
2011 Goals
Well a week in and I'm off to a great start. Said I'd post a follow up on Wed the 5th, it's now Wed the 12th. Awesome.
So as mentioned in my last post, in the beginning of 2010 I posted a list of goals for the coming year. That list became a guide for the year, some worked out, others didnt. Either way I found value in the post so to start 2011 it's time to do it again.
So first off:
Renewed Goals
1) Update this blog twice a month.
2) Seal the floor in the garage
3) Pay off the credit card(s)
4) Take a vacation outside of a border state
All of these are pretty much the same as last year.
Ammended Goals
1) Continue speaking, but more importantly prepare a talk that can be presented multiple times for multiple audiences.
This will probably be an intro to ruby or rails talk which I can give for work and possibly the CleRB group if we want to do another newbie night sometime soon. But If i can polish it and there's still interest in that basic of a talk I'd be happy to present elsewhere.
2) Learn some new stuff in .NET
This years list: Fluent NH or ActiveRecord NH, Dynamics and the DLR, MVC3, Cuke4Nuke or Specflow
3) Diet plan. I'm working with a personal trainer it's time to get better at nutrition. I'm terrible at it (food is kinda amazing.)
New Goals (Professional)
1) Build a series of blog posts or a mini-book on using the techniques i've learned in Ruby development and applying them to .NET
2) Be a good team lead. I have 2 guys working with me now and it's pretty new. So far it seems to be going well but theres a fine line to walk between being adamant about quality and being a jerk. Hoping I can manage the tight rope.
3) Get serious about javascript testing. It's a first class and hugely important language and it's irresponsible of me to spend a ton of time testing c# or ruby or php and not pay attention to javascript.
4) Get serious about ATDD. For .NET projects it will be cuke4nuke or specflow (or possibly cucumber but probably not), for ruby its cucumber.
5) Finish and launch Dreamkumo. More about this one at a later date.
New Goals (Personal)
1) Get a budget in order and start tracking expenses. I've tried this a couple times using mint but so far I've given up after a short period of time. Need to get the wife on board with this one cause its a bit bad to not really know where your money is going.
2) Finish the upstairs flooring. Seriously they are plywood floors right now, kinda embarrassing if this doesn't get done in 2011 there's seriously something wrong.
I think that's all for now. Time to get back to codemash (another upcoming post.)
Tuesday, January 4, 2011
2010 Wrap Up
So at the end of 2009 I posted a list of goals I wanted to accomplish in 2010. This post serves as a recap of what I accomplished and didn't accomplish. Tomorrow I'll post my goals for 2011. Yes it's a bit cliché but it's good to have a picture of what you want to do.
2010 Recap
1) (Partial Credit) Update this blog with a new topic at least twice a month. I managed this for about 3 months, then it vanished. As usual when the schedule got hectic this fell by the wayside. So this goal gets renewed for 2011. I just moved the site over to squarespace (and i'm loving it) and really want to keep it useful.
2) (Success) Speak at something, anything, and codemash doesn't count. I pulled this one off. I spoke at CleRB once this year about geolocation in rails and also pitched at Startup weekend. Not huge events by any means but its the start of public speaking. I need to try and get out there more this year, but its surprisingly hard coming up with interesting topics.
3) (Success) Continue developing a Kanban approach for consultancies and apply it to my current job. Well so kinda. I didn't pull this one off at the "current job" but i did switch jobs and have moved to a company where helping establish Kanban was one of my first priorities. I'm very happy to report we now have a working process with a mostly remote team and all seems to be going well. My goal is to expand on this in 2011 and bring in more Agile techniques to our consulting practice.
4) (Success) Learn some of the new development techniques and technologies in the .NET world. So of my original list I can say that I now have experience in NHibernate, Fluent NHibernate, WPF and an academic knowledge of MVC. I'm confident in the next few months MVC will move into the "very comfortable" stage. In addition to that I've learned quite about about MVP pattern and EF4.
5) (Success) Continue to get to know Ruby. I'm really proud of the experience I've gained in ruby this year. It's truly gone from a hobby to something I am comfortable using professionally and recommending to clients. The specific bullet points from last years list aren't necessarily all filled in yet but overall I'm happy standing in as a defacto ruby expert on projects. Goal for 2011 is simply keep going, i love the platform more and more as i use it and there are some great rubiests in cleveland to learn from.
6) (Complete, not really success) Get things squared away with Greenfield Studios. Well Greenfield Studios is no longer in use but for quite a few months i used the name Greenfield Consulting (and technically still do) for side project work. The new gig has brought a bit more intensity so I've stopped doing side work for now but things are straight on this one.
7) (Epic Fail) Finish EventCasts and one other side project. Eventcasts was shuttered and the codebase made open source on github. Started a new project, Questering, but that too has languished. Now I'm working with a fantastic team on the project we started for Startup Weekend - Dreamkumo. This one seems to have legs, we'll see how 2011 goes.
House /Personal Goals
These didnt go so well
1) (Fail) Finish remodeling the basement Nothing has really happened in a year. The tiles up but that's about it. Too much time & month for right now.
2) (Fail) Seal the floor in the garage - I forgot about this one
3) (Depressing Fail) Take a vacation somewhere outside of Ohio or any state that borders Ohio. This is my most depressing failure. In 2011 we are going to Boston for a friends wedding so that could serve as a kickoff for a decent vacation though, we'll see.
4) (Consistent Fail) Pay off my friends at Discover Card. Ya.... i'm going to be paying these people forever. The notion of debt reduction doesn't seem to be in my vocabulary.
5) (Shocking Fail) Figure out a "diet plan" and stick to it, lose 10 lbs a month. Ya that was sarcasm (the shocking part) this didn't happen. I did start working out with a trainer and am doing pretty well, i think, but haven't really lost much weight.
So that's 2010. Tomorrow I'll post what I want to do in 2011 including a new blog series I want to write and some other goals.
Sunday, January 2, 2011
New Host / New Theme
Well after a couple years hosting the site through GoDaddy I decided to move it over to squarespace hence the new look and feel.
Sorry if this broke anyone's RSS feeds.
As for why SS. Well their editor is actually really nice, it's impressive how much control they give you over the site and still have a WYSIWYG format. Also they support some of my favorite podcasts (to be fair so did godaddy until recently) and I appreciate that.
So here's to a year of trying out a new service.