Slide 1

Slide 1 text

Five Gems

Slide 2

Slide 2 text

Hello There! I’m @patricksroberts. I work at @iorahealth. I co-organize @bostonrb.

Slide 3

Slide 3 text

Ruby’s Greatest Strength

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

Ruby’s Greatest Weakness

Slide 6

Slide 6 text

THE ECOSYSTEM There are too many solutions to every problem Libraries move in and out of vogue so easily

Slide 7

Slide 7 text

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.

Slide 8

Slide 8 text

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?

Slide 9

Slide 9 text

RSPEC Automated unit tests as documentation http://rubygems.org/gems/rspec

Slide 10

Slide 10 text

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.

Slide 11

Slide 11 text

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.

Slide 12

Slide 12 text

BOURNE RSpec’s test doubles are not for sane people http://rubygems.org/gems/bourne

Slide 13

Slide 13 text

THE OLDEST TESTING PATTERN:

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

How Rubyists Fuck it up: Why can’t we have nice things?

Slide 16

Slide 16 text

expectation before exercising the system The important bit is that the expect statement comes before exercising the system (zipcode.valid?)

Slide 17

Slide 17 text

THANK YOU ANGRY CAT!

Slide 18

Slide 18 text

How it should be:

Slide 19

Slide 19 text

expectation after exercising the system The expect statement goes where it should; keeping the four phase unit test.

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

HAML Let machines do boring things such as close HTML tags

Slide 22

Slide 22 text

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.

Slide 23

Slide 23 text

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.

Slide 24

Slide 24 text

OmniAuth OAuth is the future; get on board now.

Slide 25

Slide 25 text

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.

Slide 26

Slide 26 text

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.

Slide 27

Slide 27 text

You can get entire application performance at a glance.

Slide 28

Slide 28 text

You can also drill down into each web request when things are going wrong.

Slide 29

Slide 29 text

BERRRRRRRRT

Slide 30

Slide 30 text

Thanks!