Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Refactoring using feature spec and service objects

aag1091
October 26, 2013

Refactoring using feature spec and service objects

Talk given by me mumbai rb yesterday

aag1091

October 26, 2013
Tweet

More Decks by aag1091

Other Decks in Programming

Transcript

  1. Avinash Gosavi An engineer by education. Rubyist by profession. Currently

    working for Freewave. You can catch with me later on twitter @aag1091
  2. When do we need to refactor? • A working code

    is always precious so there is no point in refactoring what is already working. • We need refactoring only for the code which is not working as it should (slow, flawed, buggy, etc). • Which brings me too legacy code
  3. Legacy Code source code inherited from someone else and source

    code inherited from an older version of the software. A y code that was writte a couple of o ths ago is a legacy code. – by me code is legacy code as soon as it's written. – from stackoverflow
  4. The best definition for Legacy code Michael Feathers i troduced

    a definition of legacy code as code without tests.’
  5. How to tackle legacy code • Make sure you know

    the requirements of the code you are going to work on before you start browsing the code. • Checkout the test cases that have been already added if any. • Assess which are the important parts, so that you can cover them first.
  6. gems required for testing. # test gems group :test do

    gem 'database_cleaner' gem 'shoulda-matchers' gem 'capybara' gem 'capybara-webkit' gem 'guard-rspec' gem 'spork-rails' gem 'launchy' gem 'faker' gem 'selenium-webdriver' gem 'simplecov', :require =< false End # For checking syntax and logical errors group :development do gem 'rails_best_practices' gem 'rubocop' end