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

Speed-dating Your Rails Application

Dana Jones
September 03, 2015

Speed-dating Your Rails Application

Presented at Nash.rb

Dana Jones

September 03, 2015
Tweet

More Decks by Dana Jones

Other Decks in Technology

Transcript

  1. 1. New job 2. Change project at job 3. New

    client 4. Review a gem for possible use
  2. 1. New job 2. Change project at job 3. New

    client 4. Review a gem for possible use 5. Open source contributor
  3. Post Author Comment Tag 1 1 1 ∞ ∞ ∞

    Relationship Graph: 
 Simple Blog
  4. Computer-Generated Relationship Graphs github.com/voormedia/rails-erd gem "rails-erd" $ brew install graphviz

    $ bundle install $ bundle exec rake erd rails-erd github.com/preston/railroady gem "railroady" $ brew install graphviz $ bundle install $ bundle exec rake diagram:all railroady
  5. Customizing Diagrams rails-erd railroady Diagram title Output file name/type Diagram

    orientation Show/hide inheritance Show/hide timestamp fields Include orphaned models Transitive associations Generate controller diagrams Include plugin/engine models Diagram info label Limit models by name (only/exclude)
  6. Sources of Documentation • README - general overview of the

    application, 
 install instructions, caveats, dependencies,
 historical data
  7. Sources of Documentation • README - general overview of the

    application, 
 install instructions, caveats, dependencies,
 historical data
 • /doc - RubyDoc documentation (native to Rails),
 as well as anything that you or other gems may
 add to this dir (eg. railroady schemas, rdoc, yardoc)
  8. Sources of Documentation • README - general overview of the

    application, 
 install instructions, caveats, dependencies,
 historical data
 • /doc - RubyDoc documentation (native to Rails),
 as well as anything that you or other gems may
 add to this dir (eg. railroady schemas, rdoc, yardoc)
 • Tests - especially feature tests. Well-named, well-
 structured tests are excellent documentation.
  9. # By placing all of Spree's shared dependencies in this

    file and then loading # it for each component's Gemfile, we can be sure that we're only testing just # the one component of Spree. source 'https://rubygems.org' gem 'coffee-rails', '~> 4.0.0' gem 'sass-rails', '~> 5.0.0' gem 'sqlite3', platforms: [:ruby, :mingw, :mswin, :x64_mingw] gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw] platforms :jruby do gem 'jruby-openssl' gem 'activerecord-jdbcsqlite3-adapter' end platforms :ruby do gem 'mysql2' gem 'pg' end group :test do gem 'capybara', '~> 2.4' gem 'database_cleaner', '~> 1.3' gem 'email_spec' gem 'factory_girl_rails', '~> 4.5.0' gem 'launchy' gem 'rspec-activemodel-mocks' gem 'rspec-collection_matchers' gem 'rspec-its' gem 'rspec-rails', '~> 3.1.0' gem 'simplecov' gem 'webmock', '1.8.11' gem 'poltergeist', '1.6.0' gem 'timecop' gem 'with_model' end group :test, :development do gem 'rubocop', require: false gem 'pry-byebug' end
  10. source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github:

    'rails/rails' gem 'rails', '4.1.6' # Use sqlite3 as the database for Active Record gem 'sqlite3' # Use SCSS for stylesheets gem 'sass-rails', '~> 4.0.3' gem 'bootstrap-sass', '~> 3.3.1' gem 'autoprefixer-rails' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # Use CoffeeScript for .js.coffee assets and views gem 'coffee-rails', '~> 4.0.0' # See https://github.com/sstephenson/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby # Use jquery as the JavaScript library gem 'jquery-rails' # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks gem 'turbolinks' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.0' # bundle exec rake doc:rails generates the API under doc/api. gem 'sdoc', '~> 0.4.0', group: :doc # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring', group: :development # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' # Use unicorn as the app server # gem 'unicorn' # Use Capistrano for deployment # gem 'capistrano-rails', group: :development # Use debugger # gem 'debugger', group: [:development, :test]
  11. 1. Number of tables 2. Redundancy 3. Unused tables 4.

    Missing indices Data Storage - Red Flags
  12. 1. Number of tables 2. Redundancy 3. Unused tables 4.

    Missing indices 5. Cleverness smells Data Storage - Red Flags
  13. 1. Number of tables 2. Redundancy 3. Unused tables 4.

    Missing indices 5. Cleverness smells 6. Meaningless attribute names Data Storage - Red Flags
  14. 1. Number of tables 2. Redundancy 3. Unused tables 4.

    Missing indices 5. Cleverness smells 6. Meaningless attribute names • data • type • key, value • a, b, c • first_option, second_option Data Storage - Red Flags
  15. 1. Logic allocation 2. Code redundancy 3. Simplicity 4. Hackishness

    (count the TODOs) 5. Javascript library usage Second Date
  16. 1. Logic allocation 2. Code redundancy 3. Simplicity 4. Hackishness

    (count the TODOs) 5. Javascript library usage 6. Responsiveness (design) Second Date
  17. 1. Logic allocation 2. Code redundancy 3. Simplicity 4. Hackishness

    (count the TODOs) 5. Javascript library usage 6. Responsiveness (design) 7. Responsiveness (speed) Second Date
  18. 1. Logic allocation 2. Code redundancy 3. Simplicity 4. Hackishness

    (count the TODOs) 5. Javascript library usage 6. Responsiveness (design) 7. Responsiveness (speed) 8. Authentication/authorization Second Date
  19. 1. Logic allocation 2. Code redundancy 3. Simplicity 4. Hackishness

    (count the TODOs) 5. Javascript library usage 6. Responsiveness (design) 7. Responsiveness (speed) 8. Authentication/authorization 9. Markup language/views Second Date
  20. 1. Logic allocation 2. Code redundancy 3. Simplicity 4. Hackishness

    (count the TODOs) 5. Javascript library usage 6. Responsiveness (design) 7. Responsiveness (speed) 8. Authentication/authorization 9. Markup language/views 10.Feedback (metrics and human) Second Date
  21. Ruby on Rails Speed-dating Checklist Do I know what each

    class represents? Do the tests pass? Do the associations between classes make sense? Am I familiar/comfortable with the testing stack? Are there redundant or unnecessary classes or tables? Are there signs of organization or disorganization? Do the classes’ attributes make sense? How much monkey-patching is evident? Is the same data being stored in multiple places, without cause? Are there obvious lapses in security? Are my primary and foreign keys sensical? Does it follow common Rails and Ruby conventions? Will the application be difficult to install or configure? Are the data types used sensical, performant, and efficient? What versions of Ruby and Rails does it rely on? Does indexing appear to be used sanely? Are there dependencies I have struggled with in the past? Am I familiar with the database this project uses? Are there gems I’ve never used or heard of before? Does the database used match the requirements of this project, and/or my use of it? Is the project in active development? What external APIs does this project depend on? Do I know how to contact the maintainer? Does this project offer a robust community for support and/or guidance? How thoroughly-tested is the project? Is this a project I am welcomed to contribute to? How much do I trust the tests? Is this a project I feel inclined to contribute to?