XP Customer and Developer Bill of Rights

2 Comments

To help customers and the development team work together, XP came up with a customer and developer bill of rights.

Customer Bill of Rights

  • You have the right to an overall plan, to know what can be accomplished when and at what cost.
  • You have the right to get the most possible value out of every programming week.
  • You have the right to see progress in a running system, proven to work by passing repeatable tests that you specify.
  • You have the right to change your mind, to substitute functionality, and to change priorities without paying exorbitant costs.
  • You have the right to be informed of schedule changes, in time to choose how to reduce the scope to restore the original date.
  • You can cancel at any time and be left with a useful working system reflecting investment to date.

Programmer Bill of Rights

  • You have the right to know what is needed, with clear declarations of priority.
  • You have the right to produce quality work at all times.
  • You have the right to ask for and receive help from peers, managers, and customers.
  • You have the right to make and update your own estimates.
  • You have the right to accept your responsibilities instead of having them assigned to you.

The bill of rights were a powerful means of setting expectations with folks, and letting them know who was responsible for what.

For example, XP made it pretty clear that developers shouldn’t be making calls about business priorities. That was the domain of customer.

In exchange, customers would stop telling engineers how long it would take to do there jobs. Or anything technical in nature (like how to build the system). That was the domain of the developers.

You may not have this problem today, but if you do, pull these out and put them infront of your team to ensure everyone knows what role they are planning, and what they should be entitled to on your project.

And if these rights don’t work for you. Create your own. Just don’t let the issue fester. Get everyone together, get into a room, and make it clear who gets to own what.

Making this clear could be the most important thing you do for your project.

Ruby hashes & symbols

Leave a comment

Some notes from Michael Hartl’s excellent Rails tutorial on the differences between Hashes, Symbols, and others stuff.

https://www.railstutorial.org/book/_single-page#sec-other_data_structures

Hashes

Hashes are arrays that aren’t limit to integer indexes. Their indexes, or keys, can be almost any object. For example can use strings as keys.

user = {}                          # {} is an empty hash.
user["first_name"] = "Michael"     # Key "first_name", value "Michael"

Instead of defining hashes one item at a time using square brackets, it’s easy to use a literal representation with keys and values separated by =>, called a “hashrocket”:

user = { "first_name" => "foo", "last_name" => "bar" } # hash from hash rocket

Symbols

While strings are fine as hash keys, in Rails symbols are much more popular. Symbols look like strings but are prefixed with a colon. For example :name is a symbol. Think of symbols as strings without all the baggage (faster all at once comparison).

user = { :name => "foo", :email => "bar" } # hash from symbol & hash rocket

Since symbols are so popular, Ruby no supports a new syntax for this special case:

user = { name: "foo", email: "bar" } # hash made from symbols

Note it can get confusing:

{ :name => "foo" }
{ name: "bar" }

:name is a valid symbol but name: has no meaning by itself (only has meaning inside a hash).

Rails generators cheat sheet

Leave a comment

Cheat sheet for seeing what happens when you use rails generators.

> rails g scaffold Foo foo_string:string foo_text:text foo_integer:integer foo_float:float foo_decimal:decimal foo_timestamp:timestamp foo_time:time foo_date:date foo_binary:binary foo_boolean:boolean

> rake db:migrate

new-generator

filled-generator

sqlite-output

http://guides.rubyonrails.org/command_line.html#rails-generate

http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/TableDefinition.html#method-i-column

rvm management workflow

Leave a comment

Here are some notes to remind me how to setup and flip between various ruby configurations.

Ruby setup

> rvm list (current versions of ruby installed locally)
> rvm list known (all known versions)

Install whichever version you like

> rvm install ruby-2.1.1
> rvm --default use 2.1.1

Rails setup
Rails is setup on a per ruby install basis. So just because you install rails once, doesn’t mean it is available for all rubies.

To see what gems you currently have installed type

> gem list

It should be a pretty short list. To setup a specific combo of rails and ruby you need to install rails with this instance of ruby.

> rvm 2.1.1 (to switch to this version of ruby)
> gem install rails -v 4.1.6 (to get this version of rails)

Now when you type gemlist, you should see much more.

rails (4.1.6)

To create a named gemset for this combination of ruby & rails go:

> rvm gemset create rails416
> rvm gemset list

gemsets for ruby-2.1.1 (found in /Users/jrasmusson/.rvm/gems/ruby-2.1.1)
=> (default)
global
rails416

Now we are going to link ruby with rails versions by going:

> rvm 2.1.1@rails416

gemsets for ruby-2.1.1 (found in /Users/jrasmusson/.rvm/gems/ruby-2.1.1)
(default)
global
=> rails416

And now we need to install rails again for this combo.

> gem install rails -v 4.1.0

Now to flip between environments we go:

$ rvm 2.1.1@rails410 ; rails --version
Rails 4.1.0
$ rvm 2.1.1@rails320 ; rails --version
Rails 3.2.0

Linkst that help

http://rvm.io/workflow/examples

http://rvm.io/rubies/default

http://rvm.io/gemsets/basics

Agile In A Nutshell #5 – Agile at Spotify

2 Comments

spotify-logo-primary-vertical-light-background-rgb

Just published my latest newsletter on some initial impressions after being at Spotify for two months.

Read the newsletter here.

You can subscribe if you like here.

How to handle multiple asynchronous calls and react nicely ios xcode

2 Comments

For my Spotify hackweek project I’ve been prototyping something with the Spotify iOS SDK. One of the things I want to do is get a list of track data for a series of albumns.

It’s cool, except that I when I currently loop through all my albumns, and incrementally get the track information, I don’t have an elegant way of knowing when my last asynchronous call completes in my for loop.

iKenndac showed me a really cool recursive pattern for handling this.

Basically instead of doing this:

for (each album)
   make an asynchronous call

! And then try to detect when the last one completes.

Do this instead

[self fillAlbumsRecursively:albums withSession:session finished:^{
    [self startGame];
}];


-(void)fillAlbumsRecursively:(NSArray *)albums withSession:(SPTSession *)session finished:(dispatch_block_t)finalCallback {
    
    if (albums.count == 0) {
        finalCallback();
        return;
    }
    
    NSMutableArray *mutableAlbums = [albums mutableCopy];
    SPTPartialAlbum *album = [mutableAlbums firstObject];
    [mutableAlbums removeObjectAtIndex:0];
    
    [SPTRequest requestItemFromPartialObject:album withSession:session callback:^(NSError *error, id object) {
        // Probably handle an error?
        [self.fullAlbums addObject:object];
        [self fillAlbumsRecursively:mutableAlbums withSession:session finished:finalCallback];
    }];

}

The pattern is to instead of loop, create a method that creates a copy of the collection you are looping over (albumns in this case), and then recursively call that say method, removing the album collection item you are making your distributed call on each time.

So it’s like I have 10 albums, I am going to do my async call requestItemFromPartialObject that I need to wait to complete, but when it does I am going to collect the result

        [self.fullAlbums addObject:object];

And then call it again with my mutated collection (which will be one less than it was before).

I keep doing this recursively until I am done. And that point I can be assured that my collection has been emptied, I have all my data, and I am free to do whatever I wanted to do once all my network calls have completed.

Very cool hack. Saved me some messy code. Thanks again iKenndac for sharing.

How to extend a readonly property class objectivec

Leave a comment

Say you have a readonly property class testing).

@interface SPTAlbum
@property (nonatomic, readonly) NSArray *artists;

you want to make it’s properties readwrite (say for unit testing).

Here’s how you do it.

Create the new MockClass extending the readonly class.
Add a readwrite property that you want to overwrite.
Then synthesize it (because it is readonly in the base, it’s doesn’t know how to set so we help it by offering synthesizing it).

MockSPTAlbum.h

#import <Spotify/Spotify.h>

@interface MockSPTAlbum : SPTAlbum
@property (nonatomic, readwrite) NSArray *artists;
@end

MockSPTAlbum.m

#import "MockSPTAlbum.h"

@implementation MockSPTAlbum
@synthesize artists;
@end

Now you should be able to instantiate and set just like any other class. Happy testing!

http://stackoverflow.com/questions/14550266/how-to-turn-a-readonly-property-into-readwrite-property-in-objective-c

Older Entries

Follow

Get every new post delivered to your Inbox.

Join 295 other followers

%d bloggers like this: