Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Ruby Insurgency


Published on

David Hunt Pragmatic Programmers: Andy Hunt's presentation at RubyConf 2001 presenting strategies and tactics for bringing Ruby into the workplace. From:

Published in: Technology, Education
  • Impressive presentation of ’Ruby Insurgency’. You’ve shown your credibility on presentation with this slideshow. This one deserves thumbs up. I’m John, owner of . Hope to see more quality slides from you.

    Best wishes.
    Are you sure you want to  Yes  No
    Your message goes here
  • thanq its really nice and useful to me in thinking about invention comes along with think of that.... really nice function.... tanq for this.....
    Are you sure you want to  Yes  No
    Your message goes here

Ruby Insurgency

  1. 1. The Pragmatic Programmers, LLC Andrew Hunt RUBY INSURGENCY
  2. 2. RUBY
  3. 3. RUBY
  4. 4. What is “insurgency”? <ul><li>Main Entry: in·sur·gen·cy Function: noun Date: 1803 1 : the quality or state of being insurgent; specifically : a condition of revolt against a government that is less than an organized revolution and that is not recognized as belligerency </li></ul>
  5. 5. The Battlegound <ul><li>Fortress of corporate IT </li></ul><ul><li>Guarded by trolls </li></ul><ul><li>Fiefdoms devoted to </li></ul><ul><li>tools, languages, </li></ul><ul><li>methodologies, etc. </li></ul>Corporate I.T. X
  6. 6. How did Perl get in? <ul><li>Non-threatening, non-mission-critical </li></ul><ul><ul><li>“ Playing with the web” </li></ul></ul><ul><li>Better than /bin/sh, awk, cut, sed, ... </li></ul><ul><li>Became mission critical! </li></ul><ul><li>Ubiquitous, but still messy </li></ul>
  7. 7. How can Ruby get in? <ul><li>Ruby is better than Perl </li></ul><ul><li>Better extensibility </li></ul><ul><ul><li>Evolution of Ruby programs over time </li></ul></ul><ul><ul><li>Easier addition of C code modules </li></ul></ul><ul><li>Better maintainability </li></ul><ul><ul><li>Easier to read </li></ul></ul><ul><ul><li>Easier to understand </li></ul></ul><ul><ul><li>Principle of Least Surprise </li></ul></ul>
  8. 8. Ruby offers ease and clarity of expression
  9. 9. How to leverage Ruby’s strength <ul><li>RubyLearn </li></ul><ul><li>RubyGlue </li></ul><ul><li>RubyFace </li></ul><ul><li>RubyHack </li></ul><ul><li>RubyRules </li></ul>Least threatening Most threatening
  10. 10. RubyLearn Ruby as CASE tool
  11. 11. RubyLearn <ul><li>No Ruby in development </li></ul><ul><li>No Ruby in deployment </li></ul><ul><li>Ruby as a “mental amplifier” </li></ul>
  12. 12. RubyLearn <ul><li>Central activity to programming is learning </li></ul><ul><ul><li>The problem domain </li></ul></ul><ul><ul><li>Domain language and business processes </li></ul></ul>
  13. 13. RubyLearn <ul><li>Central activity to programming is learning </li></ul><ul><ul><li>What customer/client needs and wants </li></ul></ul><ul><ul><li>Bits of technology (Java API’s, et al) </li></ul></ul>
  14. 14. RubyLearn <ul><li>Central activity to programming is learning </li></ul><ul><ul><li>System behavior, especially: </li></ul></ul><ul><ul><ul><li>under load </li></ul></ul></ul><ul><ul><ul><li>given bad data </li></ul></ul></ul>
  15. 15. RubyLearn <ul><li>Algorithm Design </li></ul><ul><ul><li>Small, specific problem </li></ul></ul><ul><ul><li>An ADT, new algorithm, or combination </li></ul></ul><ul><ul><li>Stateful considerations </li></ul></ul><ul><ul><li>Range and boundary semantics </li></ul></ul>
  16. 16. RubyLearn <ul><li>Architectural Spike </li></ul><ul><ul><li>Executable “big block diagram” </li></ul></ul><ul><ul><li>Design by Contract across major interfaces </li></ul></ul><ul><ul><li>Quickly run and validate assumptions </li></ul></ul><ul><ul><li>(Like XUML, but more realistic and flexible) </li></ul></ul>
  17. 17. RubyLearn <ul><li>Module Prototyping </li></ul><ul><ul><li>Low-friction refactoring </li></ul></ul><ul><ul><li>Tests </li></ul></ul><ul><ul><li>Mock Objects </li></ul></ul><ul><ul><li>Interfaces </li></ul></ul><ul><ul><li>Refactor rapidly as you learn key relationships and characteristics </li></ul></ul>
  18. 18. RubyLearn – Key Points <ul><li>Low-friction </li></ul><ul><ul><li>Clarity of expression, easy to map to deployment language </li></ul></ul><ul><ul><li>Quick and easy to modify/adapt as you learn </li></ul></ul><ul><ul><li>Text based format amenable to tools </li></ul></ul>
  19. 19. RubyLearn – Key Points <ul><li>Low-friction </li></ul><ul><li>Verifiable </li></ul><ul><ul><li>Unlike diagrams, can actually run it </li></ul></ul>
  20. 20. RubyLearn – Key Points <ul><li>Low-friction </li></ul><ul><li>Verifiable </li></ul><ul><li>Not much competition in this space </li></ul><ul><ul><li>Old hands use Smalltalk for this purpose (some Python) </li></ul></ul><ul><ul><li>Newbies not used to thinking first </li></ul></ul>
  21. 21. RubyGlue Ruby runs development
  22. 22. RubyGlue <ul><li>Ruby in development only– </li></ul><ul><li>No Ruby in deployment </li></ul>
  23. 23. RubyGlue <ul><li>Strong area for Perl: </li></ul><ul><li>“The Swiss-army Chainsaw” </li></ul><ul><li>Powerful, but very messy </li></ul><ul><li>Constrained to the blades available </li></ul><ul><li>Gluing disparate bits of tech is hard </li></ul><ul><ul><li>Even harder trying to decode ${${$x[2]}[3]}[5] or $$a[2][2] </li></ul></ul>
  24. 24. RubyGlue <ul><li>Ruby is not a Swiss-army chainsaw </li></ul><ul><li>More like a Star Trek™ replicator </li></ul><ul><ul><li>Say what you want, you get it </li></ul></ul><ul><ul><li>“ Tea, Earl Grey, Hot” </li></ul></ul><ul><li>Makes supporting development easy </li></ul>
  25. 25. RubyGlue <ul><li>It needs to be right </li></ul><ul><li>It needs to be right now </li></ul><ul><li>It needs to be maintainable </li></ul>
  26. 26. RubyGlue <ul><li>Project Support </li></ul><ul><ul><li>Post nightly build output to web </li></ul></ul><ul><ul><li>Annotate, hyperlink or highlight logs </li></ul></ul><ul><ul><li>Customized Wikis </li></ul></ul><ul><ul><li>Manage football pools, baby pools, etc. </li></ul></ul>
  27. 27. RubyGlue – build automation Source files Other inputs Build processor - make - ant - Aegis Executable code Passed tests Documentation Database construction make make schema make doc make test
  28. 28. RubyGlue <ul><li>The Nightly Build </li></ul><ul><li>* Current build status: </li></ul><ul><li>There were 2 errors or unexpected exceptions </li></ul><ul><li>4 Java unit tests failed: </li></ul><ul><ul><li>com.loser.library.time.test.TestBasicZone </li></ul></ul><ul><ul><li>com.loser.library.xmlapplication.test.TestXmlApplication </li></ul></ul><ul><ul><li> </li></ul></ul><ul><ul><li> </li></ul></ul><ul><li>Build FAILS as of Friday, October 12 at 10:34AM. </li></ul><ul><li>* Most Recent Log </li></ul><ul><li>* DeveloperHandbook -- How to set up and develop code for this project </li></ul><ul><li>* Project-wide Java doc </li></ul>
  29. 29. RubyGlue – annotated log
  30. 30. RubyGlue <ul><li>Build and Release procedure </li></ul><ul><ul><li>Oversee different compilation environments </li></ul></ul><ul><ul><li>Assembling release </li></ul></ul><ul><ul><li>Burn the CD-ROM or upload to ftp server </li></ul></ul>
  31. 31. RubyGlue – nightly build Developer 1 Source Source repository Automated build system C heck out source Issue build products Publish results Developer 2 Source Run automatically
  32. 32. RubyGlue <ul><li>Regression Test Automation </li></ul><ul><ul><li>Setting up database for unit tests </li></ul></ul><ul><ul><li>Run and analyze output </li></ul></ul><ul><ul><li>Notify team of build failures (e-mail, pager) </li></ul></ul>
  33. 33. RubyGlue <ul><li>Documentation and Code generation </li></ul><ul><ul><li>As a straight code generator </li></ul></ul><ul><ul><ul><li>Telephone routing application: </li></ul></ul></ul><ul><ul><ul><li>6k Ruby generating 150k of C++ code </li></ul></ul></ul>
  34. 34. RubyGlue <ul><li>Documentation and Code generation </li></ul><ul><ul><li>Tweak results from other code generators (yacc, lex, java2idl) </li></ul></ul><ul><ul><li>Create SQL load scripts for database from doc </li></ul></ul><ul><ul><li>Documentation beyond capabilities of JavaDoc </li></ul></ul>
  35. 35. RubyGlue <ul><li>All the things we would have used Perl for </li></ul><ul><ul><li>Much easier </li></ul></ul><ul><ul><li>More maintainable </li></ul></ul><ul><ul><li>Preserves intellectual property </li></ul></ul><ul><li>IT JUST WORKS. </li></ul>
  36. 36. RubyFace Ruby combines existing components
  37. 37. RubyFace <ul><li>Ruby in limited, special-purpose deployment </li></ul><ul><li>Satisfy custom need based on existing components </li></ul>
  38. 38. RubyFace <ul><li>Good products are scriptable </li></ul><ul><ul><li>Many turn to Python for this role </li></ul></ul><ul><li>Create more complex tests faster using Ruby scripts to call internals </li></ul><ul><li>Easier to add composite functionality for custom jobs </li></ul><ul><li>Leads to “Ruby on Top” architecture </li></ul>
  39. 39. RubyFace Ruby C code C++ code Other (via C)
  40. 40. “Ruby On Top” <ul><li>Ruby code defines available product </li></ul><ul><li>Functional core written in </li></ul><ul><ul><li>Java </li></ul></ul><ul><ul><li>C </li></ul></ul><ul><ul><li>C++ </li></ul></ul><ul><ul><li>Fortran </li></ul></ul><ul><ul><li>Eiffel </li></ul></ul><ul><ul><li>Anything you can bridge via C </li></ul></ul>
  41. 41. RubyFace – Example <ul><li>Telephone switch testing harness </li></ul><ul><li>Uses Ruby to test commercial phone switch </li></ul><ul><li>Drives 100,000 lines of C code </li></ul>
  42. 42. RubyFace <ul><li>Best of both worlds </li></ul><ul><ul><li>Preserves existing functionality </li></ul></ul><ul><ul><li>Leverages Ruby’s flexibility </li></ul></ul><ul><ul><li>Get used to the idea of deploying Ruby </li></ul></ul><ul><ul><li>Like Eiffel’s Component Combinator (ca 1997) </li></ul></ul>
  43. 43. RubyHack Ruby for one-time custom apps
  44. 44. RubyHack <ul><li>Pure Ruby, but small and focused </li></ul><ul><li>Not mainline development </li></ul><ul><li>Doesn’t depend on existing functionality </li></ul><ul><ul><li>Just hits the database </li></ul></ul><ul><ul><li>Calls CORBA services </li></ul></ul><ul><ul><li>Munges flat files related to the app </li></ul></ul><ul><ul><li>Hacks the Registry </li></ul></ul>
  45. 45. RubyHack <ul><li>Provide new capability without altering main product </li></ul><ul><li>Correct errors in deployed product environment </li></ul><ul><li>Provide diagnostic or debug information </li></ul>
  46. 46. RubyHack <ul><li>But how do you convince folks to deploy Ruby just for this? </li></ul>
  47. 47. RubyRules Ruby as the deployment language
  48. 48. RubyRules <ul><li>We’ve used Ruby as design tool </li></ul><ul><li>We’ve got Ruby running the development process </li></ul><ul><li>Deployed Ruby as scripting engine to existing product </li></ul><ul><li>Deployed Ruby standalone as an add-on to existing product </li></ul>
  49. 49. RubyRules <ul><li>You write the project in Ruby </li></ul><ul><li>Test it with Ruby </li></ul><ul><li>Deploy it with a Ruby installer </li></ul>
  50. 50. Ruby Rules <ul><li>You’re in. </li></ul><ul><li>Everybody wins. </li></ul>
  51. 51. The Pragmatic Programmers, LLC / dy [email_address]