$30 off During Our Annual Pro Sale. View Details »

Ruby on Rails & Development Workflow

Ruby on Rails & Development Workflow

Presentation given on November 27, 2014 at the BSS Developer Forum. Demo of code done at the presentation are available here: https://github.com/codedry/dev_forum

Marcel Morgan

November 27, 2014
Tweet

More Decks by Marcel Morgan

Other Decks in Education

Transcript

  1. – rubyonrails.org “Ruby on Rails® is an open-source web framework

    that’s optimized for programmer happiness and sustainable productivity. It lets you write beautiful code by favoring convention over configuration.”
  2. WHAT IS RAILS? Model View Controller (MVC) Rails is opinionated

    software, pick the best of tools to work with
  3. RAILS VS J2EE Both are web development frameworks J2EE tends

    to be filled with configuration; Rails uses convention over configuration (powerful tool) Rails runs on Ruby, J2EE runs on Java Modern J2EE (+ .NET MVC, PHP, etc) attempt to copy the framework flows from Rails Migrations as a way to manage database versions
  4. RUBY VS JAVA Everything is an Object in Ruby; Java

    has primitives Ruby is interpreted; Java is compiled Java outperforms Ruby for CPU intensive calculations Ruby has no Static Type checking
  5. MVC - THE BROWSER The browser makes a request, such

    as:
 http://localhost:3000/topics/2 The web server (mongrel, WEBrick, etc.) receives the request. It uses routes to find out which controller to use: the default route pattern is "/controller/action/id" as defined in config/routes.rb. In our case, it’s the "topics" controller, method “show”, id “2”. The web server then uses the dispatcher to create a new controller, call the action and pass the parameters.
  6. MVC - CONTROLLER Controllers do the work of parsing user

    requests, cookies, sessions. In our case, the show method in the topics controller knows it needs to lookup a topic. It asks the model to get topic 2, and will eventually display it to the user.
  7. MVC - MODELS ActiveRecord pattern - An object that wraps

    a row in a database table or view, encapsulates the database access, and adds domain logic on that data Models are Ruby classes. They talk to the database, store and validate data, perform the business logic and otherwise do the heavy lifting. In this case, the model retrieves topic 2 from the database.
  8. MVC - VIEWS Views are what the user sees: HTML,

    CSS, XML, Javascript, JSON. Views are merely read what the controller gives them. In our example, the controller gives topic 2 to the “show” view. The show view generates the HTML: divs, tables, text, descriptions, footers, etc. The controller returns the response body (HTML, XML, etc.) & metadata (caching headers, redirects) to the server. The server combines the raw data into a proper HTTP response and sends it to the user.
  9. MIGRATIONS Migrations are a convenient way to alter your database

    schema over time in a consistent and easy way. They use a Ruby DSL so that you don't have to write SQL by hand, allowing your schema and changes to be database independent. You can think of each migration as being a new 'version' of the database. A schema starts off with nothing in it, and each migration modifies it to add or remove tables, columns, or entries. Active Record knows how to update your schema along this timeline, bringing it from whatever point it is in the history to the latest version. Active Record will also update your db/schema.rb file to match the up-to- date structure of your database.
  10. SUPPORT Community Support vs Commercial Support J2EE tools generally built

    by non-web developers primarily who do not feel the pains Rails build by actual developers who work on real world projects
  11. POTENTIAL CHALLENGES OF ADOPTION People generally resist change Support for

    non-open source databases may be lacking - Oracle, Informix, DB2, etc It is free and open
  12. LEARNING CURVE It takes on average about 6 months for

    an experienced developer to catch up to Rails The simplified development process means that from the beginning you already are close to full productivity by just learning
  13. COMPATIBILITY WITH CURRENT INFRASTRUCTURE STACK Linux as a base for

    deployment Rails on Windows is possible - Linux or Mac OS X recommended
  14. SUITABILITY FOR ENTERPRISE APPLICATIONS Ruby on Rails framework has been

    around for over 10 years and has been tested and proven There are ways to scale which applies to almost all technology stacks If going without a coach, it's best to pick smaller projects for a trial run
  15. SYSTEM ADMINISTRATION Chef and Puppet can be used to provision

    servers for a Rails application Capistrano used for deployments - cap production deploy Heroku style deployments - git push
  16. SECURITY Rails security guide - http:// guides.rubyonrails.org/security.html Using Rails does

    not make your application secure by default - Developer responsibility Constant security releases
  17. FAVORED DEVELOPMENT METHODOLOGY 1 Use Git for Revision Control Github

    for collaboration on Code (Enterprise) Test Driven Development TDD, using Cucumber, RSpec or Test Unit - throw out manual test scripts Code Reviews Continuous Integration (CI) Server Use Postgres/MySQL for Database Agile over Waterfall Continuous Deployment
  18. PROJECT MANAGEMENT TOOL Tickets/Tasks become Searchable, linkable Workflow management (Ready

    to Develop, In Progress, Deployed, etc) Email is not the place to manage this - things get lost too easily Get notifications via email or other channels of changes to tickets Collaborate with Stake holders on Requirements and User story writing Better documentation (back then we used word document) Track Project Progress