62

betterplace.org: Crashing and uncrashing a social startup

Embed Size (px)

DESCRIPTION

Abstract: Many of you will have dealed with a Rails application that has become unbearingly slow and error-prone to develop. While pursuing our vision to improve the world, we must have lost track of the details and found ourselves in just that situation. In this talk I will explain how we managed to move forward out of deep technical debt, and present our learnings in form of a general approach you can reuse. I will also mention issues commonly encountered when upgrading Rails to the current version.

Citation preview

Page 1: betterplace.org: Crashing and uncrashing a social startup
Page 2: betterplace.org: Crashing and uncrashing a social startup

a social startupCrashing and uncrashing

RailsWayCon BerlinJune 1st, 2010

Till Behnke, co-founder, CEOPhillip Oertel, CTO

Page 3: betterplace.org: Crashing and uncrashing a social startup

Audience survey!

Page 4: betterplace.org: Crashing and uncrashing a social startup

Audience survey!1. Whatʻs your Rails version?

Page 5: betterplace.org: Crashing and uncrashing a social startup

Audience survey!1. Whatʻs your Rails version?

2. Do you look into the Rails source?

Page 6: betterplace.org: Crashing and uncrashing a social startup

Audience survey!1. Whatʻs your Rails version?

2. Do you look into the Rails source?

3. Whatʻs your team size?

Page 7: betterplace.org: Crashing and uncrashing a social startup

Audience survey!1. Whatʻs your Rails version?

2. Do you look into the Rails source?

3. Whatʻs your team size?

4. Why do you attend the talk?

Page 8: betterplace.org: Crashing and uncrashing a social startup

Take-Aways1. An approach to do Rails updates, and

project recoveries in general

2. Typical issues during Rails updates

3. How to prevent history from repeating itself

Page 9: betterplace.org: Crashing and uncrashing a social startup

What we doIntroducing betterplace.org

Page 10: betterplace.org: Crashing and uncrashing a social startup
Page 11: betterplace.org: Crashing and uncrashing a social startup
Page 12: betterplace.org: Crashing and uncrashing a social startup
Page 13: betterplace.org: Crashing and uncrashing a social startup
Page 14: betterplace.org: Crashing and uncrashing a social startup
Page 15: betterplace.org: Crashing and uncrashing a social startup
Page 16: betterplace.org: Crashing and uncrashing a social startup
Page 17: betterplace.org: Crashing and uncrashing a social startup
Page 18: betterplace.org: Crashing and uncrashing a social startup
Page 19: betterplace.org: Crashing and uncrashing a social startup
Page 20: betterplace.org: Crashing and uncrashing a social startup
Page 21: betterplace.org: Crashing and uncrashing a social startup

How we got there.

Page 22: betterplace.org: Crashing and uncrashing a social startup

The beginning: Business & IT

Page 23: betterplace.org: Crashing and uncrashing a social startup

A growing organisation......without funding.

Page 24: betterplace.org: Crashing and uncrashing a social startup

A growing organisation......without funding.

Page 25: betterplace.org: Crashing and uncrashing a social startup

Fluctuation of staff.

>20 thousand linesof code...

Page 26: betterplace.org: Crashing and uncrashing a social startup

First time funding...

Rewrite?

...and a team.

Page 27: betterplace.org: Crashing and uncrashing a social startup

Original developers were long gone 15.000 LOC, 16.000 LOT, 72 controllers, 160 models Running Rails 2.0.2, released December 2007 Running mongrels, beanstalk 0.7, hyperestraier Code sometimes over-engineered, hard to understand,

or hackish Lots of leftover code from one-time campaigns and features that

never went live

~3 developers, 3 months time

Starting point:betterplace in January

Page 28: betterplace.org: Crashing and uncrashing a social startup

Before you startSome precautions

Page 29: betterplace.org: Crashing and uncrashing a social startup

thereʻs no point in arguing if your organisation doesnʻt feel the pain itself

donʻt just complain; developers complain all the time instead, show how the technical improvements will help your

organisation to reach its goals

Convince

Page 30: betterplace.org: Crashing and uncrashing a social startup

Manage expectations:

Your own Your teamʻs Your organisationʻs

You certainly wonʻt fix everything.

Page 31: betterplace.org: Crashing and uncrashing a social startup

For the team:

8

make a list of tech debt

Page 32: betterplace.org: Crashing and uncrashing a social startup

Watch team morale

Page 34: betterplace.org: Crashing and uncrashing a social startup

Work in pairs, extensively Remove the uncertainty of what you will need to do Show progress and remaining time on big visible charts Do retrospectives

Watch team morale

Page 35: betterplace.org: Crashing and uncrashing a social startup

The approachA lot more than coding

Page 36: betterplace.org: Crashing and uncrashing a social startup

The approach

Page 37: betterplace.org: Crashing and uncrashing a social startup

4. Do the actual update

The approach

Page 38: betterplace.org: Crashing and uncrashing a social startup

4. Do the actual update

6. Release

The approach

Page 39: betterplace.org: Crashing and uncrashing a social startup

1. Reduce app to the min

4. Do the actual update

6. Release

The approach

Page 40: betterplace.org: Crashing and uncrashing a social startup

1. Reduce app to the min

2. Bring test coverage up

4. Do the actual update

6. Release

The approach

Page 41: betterplace.org: Crashing and uncrashing a social startup

1. Reduce app to the min

2. Bring test coverage up

3. Do a spike

4. Do the actual update

6. Release

The approach

Page 42: betterplace.org: Crashing and uncrashing a social startup

1. Reduce app to the min

2. Bring test coverage up

3. Do a spike

4. Do the actual update5. Throw a test party

6. Release

The approach

Page 43: betterplace.org: Crashing and uncrashing a social startup

1. Reduce app to the min

2. Bring test coverage up

3. Do a spike

4. Do the actual update5. Throw a test party

6. Release

7. Fix missed bugs

The approach

Page 44: betterplace.org: Crashing and uncrashing a social startup

1. Reduce app to the minimum

throw out non- or hardly used features throw out commented out code get rid of unused plugins, gems, other files

Page 45: betterplace.org: Crashing and uncrashing a social startup

2. Bring test coverage upMake a list of all features

Page 46: betterplace.org: Crashing and uncrashing a social startup

Cucumber is your friend.

Page 47: betterplace.org: Crashing and uncrashing a social startup

3. Do a spike

Page 48: betterplace.org: Crashing and uncrashing a social startup

When spiking, you have thelicense to make a mess.

Page 49: betterplace.org: Crashing and uncrashing a social startup

4. Do the actual update

work off your list made during the spike run rake rails:update

Page 50: betterplace.org: Crashing and uncrashing a social startup

Rails internals

i18n CGI => Rack in 2.3:

review sessions, cookies, uploads, JSON/XML APIs review new rails defaults:

ActiveRecord::Base.include_root_in_json, ... order of observer/callback firing has changed

Page 51: betterplace.org: Crashing and uncrashing a social startup

Plugins

attachment_fu active_merchant cucumber find_by_param haml rspec typus

Page 52: betterplace.org: Crashing and uncrashing a social startup

5. Throw a party with the wholeteam, and test

Page 53: betterplace.org: Crashing and uncrashing a social startup

6. Release it!

Page 54: betterplace.org: Crashing and uncrashing a social startup

7. Fix the bugs you missed,immediately

Page 55: betterplace.org: Crashing and uncrashing a social startup

Declare victory!

http://www.flickr.com/photos/annieinbeziers/1504067303/

Page 56: betterplace.org: Crashing and uncrashing a social startup

Done. Done?

Page 57: betterplace.org: Crashing and uncrashing a social startup

class Project < ActiveRecord::Base

named_scope :completed, :conditions => 'projects.completed_at IS NOT NULL', :order => 'projects.completed_at DESC' named_scope :featured, :conditions => 'projects.featured != 0' named_scope :visible, :conditions => { :hidden => 0 } named_scope :lang, lambda { |lang| %w(en de).include?(lang) ...

...

# app/views/groups/new_groups/_section_header.haml

#amount_donors.fl %span.label=t(".amount_donors") %[email protected]

...

Start using new Rails features

Page 58: betterplace.org: Crashing and uncrashing a social startup

But if you just do this,

„Always leave the campsite cleaner than you found it“ Schedule larger improvements Build a team, distribute knowledge: „If you want to go fast, go

alone. If you want to go far, go together.“ Build trust: be transparent, measure. Bring in new people.

Establish a pull-based software development process

history will probably repeat itself.

Page 59: betterplace.org: Crashing and uncrashing a social startup

Q & A

Page 60: betterplace.org: Crashing and uncrashing a social startup

Work for us!

Here in Berlin, Kreuzberg.

[email protected]

Page 61: betterplace.org: Crashing and uncrashing a social startup

betterplace gemeinnützige Stiftungs-GmbH

Schlesische Strasse 2610997 BerlinTel +49 30 76 76 44 88-0Fax +49 30 76 76 44 [email protected]

Vielen Dank.

Till Behnke, Phillip Oertel

Page 62: betterplace.org: Crashing and uncrashing a social startup

Stub example