• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Why ruby sucks
 

Why ruby sucks

on

  • 2,017 views

Matz's keynote presentation from RubyConf 2003, from http://www.ruby-doc.org/whyruby

Matz's keynote presentation from RubyConf 2003, from http://www.ruby-doc.org/whyruby

Statistics

Views

Total Views
2,017
Views on SlideShare
2,016
Embed Views
1

Actions

Likes
2
Downloads
4
Comments
0

1 Embed 1

http://www.hanrss.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • A free scripting (or dynamic) language invented by Yukihiro Matsumoto. Similar to Perl, Python, TLC, Lisp, Lua, and more.
  • Ruby 0.95 was posted to the newsgroups in December of 1995. Now 10 years old. Early forms of C where around in the mid-1960s. Almost 50 years old now.
  • Chris Pine’s Learn to Program tutorial is great for beginners. Why’s (Poignant) Guide to Ruby by Why the Lucky Stiff is just a fun romp through Ruby. Facet’s first book is out: Agile Web Development with Rails. The Best of Ruby Quiz is coming soon.
  • Abbreviations: Hewlett-Packard, National Aeronautics and Space Administration, National Oceanic and Atmospheric Administration. Hurricane Katrina image analysis is being done with Ruby. Basecamp is a project and task management web application. Blinksale is a web application for sending and tracking invoices.
  • We will see examples of the attribute methods a little later. (slide 15)
  • We will see examples of variable scope a little later. (slide 15)
  • Inspired by Smalltalk, not Python or Perl.
  • This makes sense: Java’s main is procedural code in disguise.
  • Comparable isn’t actually needed here, since String already implements it.
  • each do ... end is really and iterator, and we’ll talk about that shortly. begin ... end while/until is a syntax trick that isn’t quite equivalent to do { ... } while/until in most languages.
  • Loops work fine for simple arrays, which is their primary use, but what about when we want to start doing custom iteration.
  • This is powerful in prototyping. You can mock-out solutions with basic Ruby objects like String and Array, then gradually replace then with custom objects and specialize behavior. This gets your code running fast, but allows for later customization as development progresses.
  • REXML transformations are easier than XSLT. YAML literally handles persistence with two lines of code: Load and save. Ruby can open web pages and read, just like it opens a file. DRb is similar to CORBA or Java’s RMI, and standard Ruby. WEBrick is Ruby’s Tomcat. Ships with Ruby. SOAP is also included, on top of XML-RPC. ERb makes templating simple and flexible. Similar to JSP style templates, but for any format. RDoc is similar to JavaDoc and can build web documentation, or command-line documentation. Test::Unit uses reflection to make testing trivial.
  • Seriously, most languages are equivalent. They can all be used to do our work. You just need to find what speaks to you. Ruby speaks to me.

Why ruby sucks Why ruby sucks Presentation Transcript

  • The Top 10 ReasonsThe Ruby Programming Language Sucks!
  • 10. Too young
  • No Libraries• A collection of good libraries, especially in something like Perl’s CPAN, means less work to achieve better results, faster• Ruby libraries: • 96 standard libraries • Ruby Application Archive (RAA) catalogs over 1,200 applications and libraries • RubyForge is hosting over 800 open source projects RubyGems has served over 900,000 gems
  • No support• Documentation • Core 100% documented • Standard library documentation in progress • Tutorials available for various skill levels • Facets of Ruby book series• Community • Mailing lists in multiple languages • Usenet groups (with ML gateway) Web forums
  • No one using it• Companies using Ruby • HP, Intel, NASA, and NOAA• Uses for Ruby • Simulation, data munging, code generation, image processing, prototyping, and more• “Killer app” • Ruby on Rails Already being used in profitable web applications like Basecamp and Blinksale
  • im e! ts t f i 10. Too young o ea dAh
  • 9. Useless in obfuscation contests
  • Optional Syntax• No ;s needed• Drop the “n” characters Optional ()s
  • Objectified Syntax• obj.attribute = methods dangerous! and query? methods
  • Simple, flexible syntax• Simple declarations: • local_var = ... • @instance_var = ... • $global_var = ...• do...end or {...}• Real exception handling, like Java String interpolation: any Ruby code inside #{...}
  • Compare with other languages• Ruby: puts “Hello world!”• Java: threeVeryLongLines.weHopeWork...• Perl: #$<!&; Lisp: ((a(((b)))(c)))
  • x ! n ta sy9. Useless in obfuscation n a contests le C
  • 8. Object Oriented
  • Ruby is object oriented• Everything is an object • Numbers, code blocks, everything• Baked-in, not bolted-on No need to use “self” everywhere, like Python
  • Ruby has many object orientation shortcuts• Automatic constructor generation, unlike Perl• Easy accessors Define methods to interact with Core Ruby
  • Procedural code allowed• You can ignore the class system as needed You can even mix and match objects with procedural code
  • ible!8. f ex ObjectlOriented T oo
  • 7. Uses “Mix-ins”
  • You can’t win with multiple inheritance• Multiple inheritance allows a class to inherit from more than one parent • The good: Makes modeling complex object trees easier • The bad: The diamond inheritance problem You can’t please both sides
  • Ruby uses single inheritance...
  • ...and “Mix-ins”• Similar to Java’s interfaces, plus implementation• No limit to how many you use The benefits of multiple inheritance, without the minuses
  • se! s en h u c m 7. Uses “Mix-ins” o e s to a kM
  • 6. No loops
  • The well-known loopsMost languages Ruby while { ... } while ... end until { ... } until ... end do { ... } while begin ... end while do { ... } until begin ... end until foreach { ... } each do ... endfor(...;...;...) { ... }
  • Aren’t loops proven to work by now?• “N + 1” errors• foreach { ... } is conceptually backwards Objects should manage their own traversal
  • Iterators• Objects manage their own traversal• No more “N + 1” errors Code blocks still allow customizing behavior
  • u s ! lio6. No lloops e R eb
  • 5. Code blocks everywhere
  • What is a code block?• Any method can accept a block• Blocks can be called immediately or stored for later use Blocks are closures
  • What are they for?• Blocks can allow your code to react in according to user code• Blocks are a great way to pass around behavior Blocks are ideal for transactions
  • fu l! o wer5. Code blocks p everywhere oo T
  • 4. Wide open, even at runtime
  • Dynamic tools• Strong reflection• eval() • instance_eval() • class_eval() and module_eval() Hooks for runtime events
  • Classes are open• Add methods to a class at any time • Even a core class• Customize individual objects• Overload operators Hook into Ruby’s math and conversion operations
  • 4. le s s! at Wide open, even a w runtime L
  • 3. Ruby gurus areobsessed with ducks
  • “If it walks like a duck and talks like a duck, it’s a duck!”
  • The “Duck Typing” philosophy• We define an object by what it can do, not its type Most of the time, you shouldn’t even check for methods
  • n e! gare a 3. Ruby gurus tr ducksobsessedswith T o o
  • 2. Includes too many great toys
  • 96 standard librariesRead/Write CSV XML YAML Talk to Email FTP Web Serve Code Servlets XML-RPCWork with Math Templates Threads Tools for Debugging Docs Testing
  • g! c tin str a2. Includes too many di great toys To o
  • 1. “Its entirely too funand productive for mostpeople.” — Mike Clark