REPL-DRIVEN DEVELOPMENT
WITH PRY
ABOUT ME
Work as a contractor for Level 7 Custom Application
Development with a client called Groupize
stephenmarian0 on twitter (I’ll post the slides there)
GOALS
Why REPLs are so useful in general
Why Pry takes that to the next level
When and how to use REPL Driven Development over TDD
in some situations
WHY REPL?
You’re using a dynamic language. Exploit that fact and
shorten the feedback loop as much as you can.
Short feedback loops mean better and faster learning and
learning is what we’re doing all the time, whether we’re
debugging, going through documentation or developing
something new
WHY PRY?
Loads of additional functionality for debugging, source diving
and more
Rich Plugin ecosystem (examples later)
REPL-DRIVEN DEVELOPMENT
Use this fast feedback loop to help write code.
Discover, explore and understand
Where TDD is top-down REPL-Driven development is
bottom up
Useful for writing “draft” code when developing in a new
domain, using a new libraries, or anywhere else where the
solution design is not obvious.
EXAMPLE: PLAY AROUND
WITH A PUBLIC API
REVIEW: LESSON
binding.pry is your best friend when debugging
Source dive! All from the console
Gradually build up procedural code and “discover” an ideal
design
REVIEW: PRY SUPERPOWERS
cd and ls to navigate classes and methods
show-source and show-doc aliased to $ and ? respectively
_ and __ to get the last and penultimate returns respectively
. to execute shell commands from within pry
binding.pry to set a breakpoint
next and step to move through debugger using bye-bug
edit ClassName to enter your editor to edit that class
PLUGIN ECOSYSTEM
Examples:
Awesome Print for stylish pretty print.
Hirb for tabular collection output.
Pry Doc to browse Ruby source, including C, directly from the console.
Pry Remote to connect remotely to a Pry console.
Pry Coolline for syntax highlighting as you type.
All of the above available conveniently bundled together as part of the
jazz_fingers gem
ADDITIONAL RESOURCES
pryrepl.org
pry-rails
jazz_fingers
vim + tmux with slimux to send commands to pry in the
console
SOME TALKS
Avdi Grimm’s RubyTapas episode on REPL driven
development
Ruby Conf 2013: REPL Driven development with pry
Rails Conf 2013: Pry — the good parts
Rails Conf 2014 Debugger Driven Development with Pry

REPL-driven development with pry

  • 1.
  • 2.
    ABOUT ME Work asa contractor for Level 7 Custom Application Development with a client called Groupize stephenmarian0 on twitter (I’ll post the slides there)
  • 3.
    GOALS Why REPLs areso useful in general Why Pry takes that to the next level When and how to use REPL Driven Development over TDD in some situations
  • 4.
    WHY REPL? You’re usinga dynamic language. Exploit that fact and shorten the feedback loop as much as you can. Short feedback loops mean better and faster learning and learning is what we’re doing all the time, whether we’re debugging, going through documentation or developing something new
  • 5.
    WHY PRY? Loads ofadditional functionality for debugging, source diving and more Rich Plugin ecosystem (examples later)
  • 6.
    REPL-DRIVEN DEVELOPMENT Use thisfast feedback loop to help write code. Discover, explore and understand Where TDD is top-down REPL-Driven development is bottom up Useful for writing “draft” code when developing in a new domain, using a new libraries, or anywhere else where the solution design is not obvious.
  • 7.
  • 8.
    REVIEW: LESSON binding.pry isyour best friend when debugging Source dive! All from the console Gradually build up procedural code and “discover” an ideal design
  • 9.
    REVIEW: PRY SUPERPOWERS cdand ls to navigate classes and methods show-source and show-doc aliased to $ and ? respectively _ and __ to get the last and penultimate returns respectively . to execute shell commands from within pry binding.pry to set a breakpoint next and step to move through debugger using bye-bug edit ClassName to enter your editor to edit that class
  • 10.
    PLUGIN ECOSYSTEM Examples: Awesome Printfor stylish pretty print. Hirb for tabular collection output. Pry Doc to browse Ruby source, including C, directly from the console. Pry Remote to connect remotely to a Pry console. Pry Coolline for syntax highlighting as you type. All of the above available conveniently bundled together as part of the jazz_fingers gem
  • 11.
    ADDITIONAL RESOURCES pryrepl.org pry-rails jazz_fingers vim +tmux with slimux to send commands to pry in the console
  • 12.
    SOME TALKS Avdi Grimm’sRubyTapas episode on REPL driven development Ruby Conf 2013: REPL Driven development with pry Rails Conf 2013: Pry — the good parts Rails Conf 2014 Debugger Driven Development with Pry