• RSS Feed
  • Wagaman Family

  • Categories

  • RSS Web Wanderings

Core of the Core: Reflection Talk

May 17th, 2010 by Ben Wagaman.
Categorized as Ruby on Rails, programming.

ruby reflectionTonight at the Columbus Ruby Brigade meeting, I gave part two of my “Core of the Core” speaking series.

Part two was on Reflection in Ruby.

Core of the Core: Reflection Presentation

Core of the Core: Class Class

April 19th, 2010 by Ben Wagaman.
Categorized as Ruby on Rails, programming, technology.

Here is the presentation from my Class Class Talk at the Columbus Ruby Brigade tonight.

My CodeMash 2.0.1.0

January 16th, 2010 by Ben Wagaman.
Categorized as programming.

CodeMash

I thought it would be good to write down a few of my thoughts from CodeMash before I forget about it. There’s certainly more that impacted me, but something is better than nothing.

Pre-Compiler: Test Driven Development: From Concept to Deployment by Leon Gersing

Leon did a great job of somehow getting 50 people in the room to contribute to the same project. I was also amazed that the same number of people were able to share “what they did yesterday, what they are going to do today, and any blockers” in under 15 minutes. It was actually closer to 8 minutes on a few of the stand-ups.

I came away with some more GIT experience and a better idea of how to run an agile team. I liked the idea of starting from story cards and decomposing them into tasks and then allowing them to be spread out amongst the crowd. The one thing that was a little haphazard was the coordination of connected tasks.

The Not-GIT Talk by Jim Weirich

Jim is definitely one of my A-List speakers. He always prepares so well, knows his stuff, but also knows how to communicate it so dummies like me can understand it. I loved the way that he built up a so-called source control system from scratch (conceptually), solving problems along the way. This is top-of-the-line material. Oh, and you can see his presentation at the Pragmatic Programmer’s store in a screencast format.

NoSQL: Death to Relational Databases by Ben Scofield

There are a lot of non-relational databases. Need to explore them on my own to discover pros and cons of when they are beneficial and non-beneficial.

Ben encouraged us to start with a non-relational database from the beginning of a project to see how you would do things differently. He also mentioned the idea of polyglot persistence, that is having many different storage means for different purposes. This could be an interesting idea to explore as well

The Five Habits of Successful Lean Development by Mary Poppendieck

Purpose, Passion, Persistence, Pride, Profit

Mary gave a lot of examples of how these P’s play out. Persistence stuck out to me the most. She asked the question “What makes people really good at what they do?” The answer she gave was deliberate practice, and expert performance over a long period of time (10 years or 10,000 hours). This corroborates what Malcolm Gladwell talks about in Outliers.

  1. Identify a specific skill that needs improvement
  2. Devise (or learn from a teacher) a focused exercise designed to improve the skill
  3. Practice repeatedly
  4. Obtain immediate feedback immediately and adjust accordingly
  5. Focus on pushing the limits and expect repeated failures
  6. Practice regularly and intensely, perhaps three hours a day.

User Stories: Closing the Agile Loop by Barry Hawkins

You’ll never be as ignorant while building software about what is required for a project then when you negotiate the contract of what is in scope.

Treat a User Story as a placeholder for interaction, not a substitute for interaction. Here’s how User Stories differ from a Use Case.

  • Smaller in Scope
  • Not permanent artifacts
  • Too brief to stuff with UI requirements
  • Focus on functionality
  • Facilitate iteration planning
  • Analysis catalyst, not an analysis product

A User Story follows a format such as

Description of what’s needed

As a ________ User, (who is doing the action)
I want to ___________ (what do they want to do)
so that ______________. (to clarify the purpose and business value)

Conditions of Success (Acceptance criteria)

Scenario: _________
Given _____________
When I ____________
Then _____________

SOLID design principles

October 7th, 2009 by Ben Wagaman.
Categorized as Ruby on Rails, programming.

I’m electronifying my notes from conferences and such. Here’s my notes from Jim Weirich’s SOLID design principles in Ruby talk from eRubyCon 2009.

1.) Single Responsibility Principle
a class should have 1 reason to exist
describe the purpose of your class in a single sentence (you shouldn’t need and/or)

2.) Open/Closed Principle
you should be able to extend a class’ behavior without modifying it

3.) Liskov Substitution Priniciple
require no more, promise no less

4.) Interface Segregation Principle

5.) Dependency Inversion Principle
depend on abstractions, not concrete-tions

** Note that my notes are a little bit shotty, because the days prior to the conference I was totally totally strapped at work and thus rest-deprived.

Testing my patience. A skeptic’s thoughts on beginning to write tests

January 29th, 2009 by Ben Wagaman.
Categorized as Ruby on Rails, programming.

It’s been a long time since I posted anything in my blog, so I thought I ought to break the silence. Lately, I’ve been trying to get myself caught up on the test-driven/behavior-driven development philosophy. If you are a programmer, maybe you can relate to my struggles of learning how to get it right.

Test-Driven Development is a programming philosophy that encourages the developer to specify test test conditions before writing the code to meet the specification. To me, this is counter-intuitive. I guess I am naturally a brute and think the best way to figure something out is to play with it, and than after a while it should just work.

Ironically, the chapter on Testing in the Agile Web Development with Rails book comes well after the first attempts at hammering out Rails code for a shopping cart application. I understand why the book is written the way that it is, and am greatly appreciative of the book, but there ought to be a Test-Driven version of the same tutorial, so that people can see first-hand how to test-first in development.

It also hasn’t helped that my first attempt at writing tests have been less than perfect too. I’ll end up writing 6 or 7 lines of test code to test one case for a method. The verboseness of tests has negatively reinforced me in to thinking that testing is hard.

What’s more frustrating is that I’ve heard expert developers talk about only having a line or two of test code to test a method. This has seemed to me to be an unatainable ideal. How are you supposed to test code that is ten lines long (or more) with one or two lines of test code? That’s unpossible.

But, recently I came to the realization that if the methods I am writing are smaller and do more specific things, then they are a whole lot easier to test. This is mostly because the tests can move towards the ideal of the expert: short, meaningful, specifications. This in turn helps me to actually write the test first, because I know I can specify the behavior of code that is less complex.

Some of the recent developments in RSpec have helped this ideal even further. For instance, see David Chelimsky’s post on RSpec 1.1.12 He notes that what you could have done

In order to test this:

class Person
  validates_presence_of :email
end

You would have in previous versions of RSpec written:

describe Person do
  it "should validate presence of email" do
    person = Person.new(:email => nil)
    person.should_not be_valid
    person.should have(1).error_on(:email)
  end
end

In RSpec 1.1.12, you can reduce this down to the following:

describe Person do
  it { should validate_presence_of(:email) }
end

This is due to:

  • an implicit receiver from the describe block Person.new
  • custom matchers for validate_presence_of (which are available through plugins like rspec-on-rails-matchers or you can make your own matchers
  • self commenting specification code

Three lines of code. Three lines of test. That’s pretty darn cool. Perhaps, it’s not possible to have a line by line spec for everything, but this is a lot better than before.

I’ve still got a fair bit of inertia to overcome before I’ve got TDD under my belt. The more I tell myself that test-driven development is less about testing than it is about developing well-written code, the more motivated I am to do it. I hope this is an encouragement to unit testing newbies.

MyRubyClass.reload!

August 8th, 2008 by Ben Wagaman.
Categorized as Ruby on Rails, programming.

Today I was writing some specs with RSpec, the Ruby BDD Testing Framework. In between tests, classes aren’t reloaded by default, so I went about try to figure out how to reload a class for certain tests.

Active Support defines a method on Class called remove_class. This provides half of the equation. The other half was to reload the class again. So, I wrote a method on the Object class that should handle most cases. Note, this may not work with namespaced classes, but it did the quick and dirty job of helping my specs to reload the class.

# Call this method like
# MyRubyClass.reload!
# or
# MyRubyClass.reload!('/path/to/file/my_ruby_class.rb')
class Object
  def reload!(file = nil)
    remove_class(self)
    load(file || "#{self.to_s.underscore}.rb")
  end
end

All I needed to do was then call this method when I needed to reload the class.

MyRubyClass.reload!

Upgrading to Rails 2.0

December 15th, 2007 by Ben Wagaman.
Categorized as Ruby on Rails, how to, programming.

With Rails 2.0 out now, it’s time to explore the new source. It’s hard to believe that it’s already been 2 years since I first checked out Rails 1.0 for the first time.

To update your Rails code, you can run
gem update rails

However, when I tried to run this command I was unfortunately greeted with a nasty error, when getting to update ActiveRecord.

Attempting remote update of activerecord
ERROR: While executing gem ... (Zlib::BufError)
buffer error

According to a Ruby Form post, I found a solution to the problem, updating ruby gems.

While you could run this line to update RubyGems to 0.9.5, I don’t recommend it.
gem update --system

Instead download rubygems-0.9.4, unzip it and then run
ruby setup.rb

This will allow you to continue to use Mongrel, because there are some incompatibilities with Mongrel running on Win32 with RubyGems 0.9.5. See the following:

and then update rails as you would expect.
gem update rails

Voila!

How to Migrate a Subversion Repository

December 11th, 2007 by Ben Wagaman.
Categorized as how to, programming.

While moving a subversion repository from one location to another is an infrequent task, it’s good to know and easy to do.

According to dot not

svnadmin dump /path/to/repo > reponame.dump
tar zcf reponame.tgz reponame.dump
scp reponame.tgz hostname:/path/to/new/repo

Then login to the new machine, and set up the new repo:

cd /path/to/new
svnadmin create reponame
tar zxf reponame.tgz
svnadmin load reponame < reponame.dump

Voila, you have moved your repository. Don’t forget to delete your old repository when you have made sure that you are correctly referencing your new repository. Thanks Scott for the help.

Next Page »