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

Classic Algorithms in Ruby

Classic Algorithms in Ruby

Have you ever wondered how your choice of algorithm will impact the performance of your app? Does Big-O notation really matter outside of Computer Science class? Let's look at some of the underlying algorithms in Ruby and investigate how our implementation decisions can make-or-break our apps!

Renée Hendricksen

April 26, 2014
Tweet

Other Decks in Programming

Transcript

  1. Thanks Abril Pro Ruby! A Conference on a beach... In

    Brazil... YOU ARE AWESOME!!! Monday, May 12, 14
  2. Algo “Rhythms” in Ruby We all need more Rhythms in

    our Algorithms! Monday, May 12, 14
  3. A Degree in Computer Science What knowledge are others missing?

    What do we take for granted? Back to Nell and I.... Monday, May 12, 14
  4. Algorithm noun - a step-by-step procedure for calculations. Algorithms are

    used for calculation, data processing, and automated reasoning. IMPLEMENTATION ! Monday, May 12, 14
  5. Types, Blah, Blah, Blah Greedy deterministic / non- deterministic Brute

    force Divide and conquer Decrease and conquer Dynamic programming Transform and conquer Backtracking algorithm Monday, May 12, 14
  6. We write them everyday How we solve the problem steps,

    heuristics, use of tools and patterns Every line of code you write is part of a new algorithm you are creating to solve that problem. Monday, May 12, 14
  7. Every line of code you write is part of a

    new algorithm you are creating to solve that problem. Monday, May 12, 14
  8. Algorithms and data structures are fun!! Problem solving how to

    do it how others do it how to do it differently again, and again! Fun!! Monday, May 12, 14
  9. Answering the Wrong Question Is there still a difference between

    clean code and performant code? Monday, May 12, 14
  10. Is There? Ah finally a thesis! This is something that

    effects us all everyday How as Rubyists do we solve this? Monday, May 12, 14
  11. A Problem Tic-Tac-Toe Small well defined problem (a little larger

    than a kata) Can be very messy, and very clean :) Monday, May 12, 14
  12. A Problem Tic-Tac-Toe Small well defined problem (a little larger

    than a kata) Can be very messy, and very clean :) Monday, May 12, 14
  13. Borrowed From The Grand Masters of Ruby SOLID The Gilded

    Rose Kata The Beer Song Kata The Fizz Buzz Kata Monday, May 12, 14
  14. Null Hypothesis There is no statistical difference in the run-time

    of clean SOLID code and messy if-else-death code Monday, May 12, 14
  15. Results RBX 1.8.7 1.9.3 2.0.0 2.1.1 0 0.003 0.005 0.008

    0.01 BS IED BS OO BS OOX Monday, May 12, 14
  16. Results RBX 1.8.7 1.9.3 2.0.0 2.1.1 0 0 0 0

    0 GR IED GR OO Monday, May 12, 14
  17. Jruby RBX 2.0.0 0 10 20 30 40 FB Lamb

    Results Monday, May 12, 14
  18. Built-In choices Searching and Sorting Enumerable each while Data structures

    generic types - RBasic or just VALUE Custom objects - RObject GC ... Monday, May 12, 14
  19. What it all means Donald Knuth The Art of Computer

    Programming The Aesthetics of our Code "I'll show you can't prove that a program is 'elegant'" - How do we define aesthetics?? Time? Maintainability? Small? Simple? Readability? Gregory Chaitin Completeness? Slide 42 Monday, May 12, 14