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

Five Gems - BostonRB lightning talk

Five Gems - BostonRB lightning talk

Talk given during a project night at BostonRB about five gems I frequently use.

Patrick Robertson

February 05, 2013
Tweet

More Decks by Patrick Robertson

Other Decks in Programming

Transcript

  1. THE ECOSYSTEM The freedom to scratch your own itch and

    solve a problem in a way that is attractive to use is great. The work required to publish libraries is so low that sharing code is extremely easy
  2. THE ECOSYSTEM There are too many solutions to every problem

    Libraries move in and out of vogue so easily
  3. Standard Gem Evaluation Testing Activity Maturity I attribute TAM to

    http://www.amazon.com/Rails-AntiPatterns-Refactoring-Addison-Wesley- Professional/dp/0321604814 . This is a good book to learn more about how to evaluate third party Ruby code. When all else is equal, take the gem that is tested over the gem that isn’t. Take the gem that is either more active or has a maintainer grooming issues/pull requests Take the gem that has been around longest.
  4. Expanded Criteria Training Drop-in replacability Perceived time savings Lasting power

    As a product developer my Ruby libs / Rails apps stay in Production for a long ass time and I’ve got to manage the team that maintains the applications. How much training will be required to migrate from one gem to another? How easily can I replace the old gem? Can I essentially drop in. Is this going to be revolutionary for my team or are we spinning our wheels Is the problem space well enough defined that migrating my gem is likely to stick or are we in a transitionary period?
  5. Well Tested Under Continuous Development Ancient Well Maintained Industry Standard

    Opinionated xUnit compatible* I would say with some level of confidence that at least 6 out of 10 professional ruby shops use RSpec. It’s opinion that automated tests are a form of code documentation has improved the lives of many developers. RSpec is considered in the xUnit family of testing frameworks (http://en.wikipedia.org/wiki/ XUnit#xUnit_frameworks). It isn’t the most direct descendant of j-unit though.
  6. In order to be a professional Ruby developer you must

    write automated unit tests; the particular library is less important than than grasping BDD. Like I said earlier: The first evaluation criteria is going to be whether or not your code is tested. Learning how to write automated tests is a critical skill for Ruby development.
  7. Setup Exercise System Under Test Verify Behavior Teardown This is

    called the four-phase unit test. http://xunitpatterns.com/Four%20Phase%20Test.html You should read xUnit test patterns and sleep with it under your pillow. It is fantastic. The book is digitally available here: http://xunitpatterns.com/index.html
  8. expectation before exercising the system The important bit is that

    the expect statement comes before exercising the system (zipcode.valid?)
  9. That ain’t no way to live! This is dynamically generated

    HTML via ERB. We’re compiling down to static HTML so we might as well define a language that does really boring things like closing tags automagically.
  10. Awwww yeahhhh whitespace. Whitespace solves so many problems with closing

    tags. It is often a challenge to get your designer to agree to a HAML based world.
  11. Detachable authentication strategies Tested, Active, Mature Easy to become your

    own provider* Industry Standard Plays nicely with others* It’s easy to create your own OAuth provider gem based upon the framework provided with OmniAuth. So even if you have no intention of letting your users log in via Twitter this provides a great amount of value. Single Sign on via OAuth 2.0 is crazy powerful. It provides a spec to allow things like Rich client apps keep authentication/authorization tokens in a non-secure enviornment and also allows iOS/Android devices to log in too. Really consider OAuth as your authentication strategy. http://launchpad.37signals.com is a fantastic example of an OAuth provider done right.
  12. NewRelic RPM Your app is not in production until it

    is monitored. Having a client call you up and tell you that the sign-up form doesn’t work just isn’t going to cut it. Newrelic takes so little configuration and gives you a lot of monitoring/instrumentation. Do it.