This repository has been archived by the owner on Jul 10, 2018. It is now read-only.
forked from rubinius/rubinius
/
index.html
679 lines (561 loc) · 37.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
<!DOCTYPE html>
<html>
<head>
<title>Why Use Rubinius - Rubinius</title>
<meta content='text/html;charset=utf-8' http-equiv='content-type'>
<meta content='en' http-equiv='content-language'>
<meta content='Rubinius is an implementation of the Ruby programming language. The Rubinius bytecode virtual machine is written in C++. The bytecode compiler is written in pure Ruby. The vast majority of the core library is also written in Ruby, with some supporting primitives that interact with the VM directly.' name='description'>
<meta content='Less Than Three. <3. http://less.thanthree.com' name='author'>
<link href='/' rel='home'>
<link href='/' rel='start'>
<link href='/feed/atom.xml' rel='alternate' type='application/atom+xml' title='Rubinius Blog' />
<!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script><![endif]-->
<script src="/javascripts/jquery-1.3.2.js" type="text/javascript"></script>
<script src="/javascripts/paging_keys.js" type="text/javascript"></script>
<script src="/javascripts/application.js" type="text/javascript"></script>
<style>article, aside, dialog, figure, footer, header, hgroup, menu, nav, section { display: block; }</style>
<link href="/stylesheets/blueprint/screen.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/application.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/blueprint/print.css" media="print" rel="stylesheet" type="text/css" />
<!--[if IE]><link href="/stylesheets/blueprint/ie.css" media="screen" rel="stylesheet" type="text/css" /><![endif]-->
<!--[if IE]><link href="/stylesheets/ie.css" media="screen" rel="stylesheet" type="text/css" /><![endif]-->
<link href="/stylesheets/pygments.css" media="screen" rel="stylesheet" type="text/css" />
</head>
<body>
<div class='container'>
<div class='span-21 blog_menu'>
<header>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a id="blog" href="/blog/">Blog</a></li>
<li><a id="documentation" href="/doc/en/">Documentation</a></li>
<li><a href="/projects/">Projects</a></li>
<li><a href="/roadmap/">Roadmap</a></li>
<li><a href="/releases/">Releases</a></li>
</ul>
</nav>
</header>
</div>
<div class='span-3 last'>
<div id='version'>
<a href="/releases/1.2.3">1.2.3</a>
</div>
</div>
</div>
<div class="container posts_nav">
<nav>
<a href="/blog/posts_index/">Index of Posts</a>
<a id="feed_icon" href="/feed/atom.xml"><img alt="subscribe" src="/images/feed-icon16x16.png" /></a>
</nav>
</div>
<div class="container blog_posts">
<h2 class="post_title">Why Use Rubinius</h2>
<div class="by_line">
<p><span class="author">Brian Ford</span>
<span class="date">25 February 2011</span>
</p>
</div>
<p><em>Why should I use Rubinius?</em> We have been asked that question many, many times
over the past four years. It is a great question. It is an important question.
It’s a <em>hard</em> question. I’m not holding out on you. I want to give you an
answer that sates your curiosity, helps you make informed decisions, and
empowers you to speak eloquently when <em>you</em> are inevitably asked, “Why do you
use Rubinius?”</p>
<p>The trouble is, there are many different situations in which people use Ruby
and there is simply no answer, however comprehensive, that really speaks to
everyone’s concerns. So rather that boring you at length, I thought a <em>Choose
your own adventure</em> style would be a better approach.</p>
<p>From the list below, select the persona that best describes you. Don’t worry,
if the one you select doesn’t sound right, you can easily backtrack here. Read
as many as interest you. After all, none of us fit easily into any one box.
When you are done exploring all the fascinating reasons to use Rubinius, let’s
meet up at the <a href="#wur-conclusion">Conclusion</a> for some parting
words.</p>
<p><em>Enjoy!</em></p>
<h3><a class="anchor_title" name="wur-personas">Choose Your Persona</a></h3>
<ul>
<li><a href="#wur-newby">Rails or Ruby Newby</a></li>
<li><a href="#wur-creative">The Creative</a></li>
<li><a href="#wur-experienced">Experienced Programmer</a></li>
<li><a href="#wur-seasoned">Seasoned Programmer</a></li>
<li><a href="#wur-academic">Academic Researcher</a></li>
<li><a href="#wur-uber">Über Programmer</a></li>
<li><a href="#wur-philosophical">Philosophy Student Seeking the Meaning of Ruby</a></li>
<li><a href="#wur-manager">Manager</a></li>
<li><a href="#wur-knowledge">Knowledge Seeker</a></li>
<li><a href="#wur-enthusiast">Language Enthusiast</a></li>
</ul>
<h4><a class="anchor_title" name="wur-newby">Rails or Ruby Newby</a></h4>
<p>You are pretty new to programming and after hearing about Ruby on Rails you
watched a screencast and made a website. You are curious and enthusiastic.</p>
<p>You are the empty teacup of the Zen proverb. You are a fresh-faced flower
glistening with the morning dew. The sun smiles on you and you smile back.
You seem to like this Ruby language that makes programmers happy and you’ve
come to lend your cheery spirit…</p>
<p>Welcome!</p>
<p>So, you have heard of this thing called Rubinius or rbx or whatever and some
folks you respect or admire seem to like it and naturally you want to know
what the big deal is and you’re like, “Yo, why would I use Rubinius?”.</p>
<p>Cool.</p>
<p>Well, you should use Rubinius because I said so. Try your code on it. Tell us
what worked for you. Tell us if something didn’t work by opening an
<a href="https://github.com/evanphx/rubinius/issues/">issue</a>.
Set your imagination loose and tell us what tool you would use if you could.</p>
<p>Spend some time reading the Rubinius source code. Start at the <code>kernel/</code>
directory. It’s full of Ruby code! As you read through how Ruby is
implemented, how it actually works, it will give you a level of understanding
of your code that many programmers don’t have in <em>any</em> language.</p>
<p>Most of all, hang on to your curiosity and enthusiasm. Those were vital to the
creation of the Rubinius project in the beginning and have sustained us
through many challenges. We <em>can</em> make our Ruby experience better, freeing us
from the shackles of other languages and foreign libraries. We <em>can</em> have fast
and reliable web servers, games, editors, websites and applications written in
Ruby. We <em>can</em> have first class tools written for and with Ruby. The world
<em>can</em> be rosy red without our glasses.</p>
<p><a href="#wur-personas"><strong>Back to personas</strong></a></p>
<h4><a class="anchor_title" name="wur-creative">The Creative</a></h4>
<p>Ruby is groovy. No, not that Groovy, eww, no. I mean:</p>
<blockquote>
<p>groovy |ˈgroōvē| adj.</p>
<ul>
<li>fashionable and exciting : <em>sporting a groovy new haircut</em></li>
<li>enjoyable and excellent : <em>he played all the remarkably groovy guitar parts
himself</em></li>
</ul>
<p>(Apple's dashboard dictionary widget.)</p>
</blockquote>
<p>Ruby respects creativity. It has an <em>aesthetic</em>. You don’t just write Ruby
code, you write <em>beautiful</em> Ruby code. It would be unthinkable to do
otherwise. Sure, there is more than one way to do many things. This is not
some sterile laboratory. We are not automatons; we are people. Of course,
being utilitarian is not bad. But other languages have that angle pretty
well covered. There is probably only one right way to implement Python.</p>
<p>Rubinius has an aesthetic, too: excellence, utility, simplicity, beauty, joy.
Mostly in that order. Useful code that isn’t of very good quality is a drag.
It slows you down. It gives you a headache. It drives you away. We strive to
keep it out of Rubinius. On the other hand, we are not just writing sonnets
here. This is Serious Business™. We have some hard-core problems to solve. So
we strive for excellent, useful, beautiful code that is a joy to work with.</p>
<p>Of course, this is an ongoing process. It is a journey, not a destination.
There are areas of Rubinius that could use a thorough cleaning or a new
perspective on making the implementation of this beautiful object-oriented
language more beautiful and object-oriented.</p>
<p>We welcome your artistic perspective. Help us improve the dialog between
Rubinius and the person using it. The command line doesn’t have to be a
desolate place of obscure, condescending error messages. Web interfaces to the
diagnostic tools deserve a good dose of user-experience and interaction
design. You know that feeling you get when looking at an Enterprise web
application? That weird plastic-masquerading-as-quality-material feeling?
The too much 1996-Enterprise-faux-rounded-corner-wanabe-2006-hip gloss?
Gives me the willies whenever I have to use an app like that. Yeah, we don’t
want that.</p>
<p>We want to create tools that are powerful, graceful, easy to use, and
beautiful to look at. Beautiful tools are easier to use. (Yehuda Katz provided
a couple links related to this: <a href="https://www.westga.edu/~distance/ojdla/winter134/david_glore134.html">The Impact of Design and Aesthetics on
Usability, Credibility, and Learning in an Online Environment
</a> and
<a href="http://www.alistapart.com/articles/indefenseofeyecandy">In Defense of Eye
Candy</a>. If you know of
other research, leave us a comment.) So if you have a creative bent but enjoy
writing code also, try out Rubinius and let us know where it could use some
polish.</p>
<p><a href="#wur-personas"><strong>Back to personas</strong></a></p>
<h4><a class="anchor_title" name="wur-experienced">Experienced programmer</a></h4>
<p>That saying, <em>Time is Money</em>, you live by it. You have applications to deliver
and you choose the best tool for the job. You are professional, conscientious,
duly cautious, and not inclined to episodes of emotional exuberance about the
latest fad. You accept compromises. There are always trade-offs. The correct
approach is cost-benefit analysis. The numbers tell the story and level-headed
decision making follows the numbers.</p>
<p>You have heard about Rubinius and you are curious whether it may be
appropriate for your current project. As usual, rather than speculating or
paying too much heed to the buzz, you look into it yourself. After some
investigation, you discover that:</p>
<ol>
<li>Much of Rubinius is implemented in Ruby itself. This may be a big help when
tracking down troublesome bugs.</li>
<li>Rubinius has a very fast bytecode virtual machine, as well as a modern
generational garbage collector so memory profiles should be more
predictable and consistent in deployed applications.</li>
<li>It has a profile-driven JIT compiler that uses type-feedback to
aggressively inline methods resulting in significant performance
improvements.</li>
<li>It has a built-in debugger and precise method profiler, both of which are
fast due to being well integrated.</li>
<li>It has a built-in API for monitoring a VM out-of-process, even on a remote
machine. We are building a variety of diagnostic tools atop this API.</li>
</ol>
<p>Of course, even if the technology in Rubinius sounds terrific in theory, how
suitable is Rubinius for your application? How does it perform under your
specific constraints? Again, you do some investigating. You have a solid test
suite for your application, so you start by running that. If you hit any
problems, please open an <a href="https://github.com/evanphx/rubinius/issues/">issue</a>
to let us know.</p>
<p>If everything goes well with the tests, you start running some of the
benchmarks that you have accumulated while doing performance tuning. Of
course, no sensible person asks for benchmark results from <em>other</em> people’s
code. That defies logic. It’s like asking if your program will run because
your Aunt Mabeline likes decaf coffee. It’s contrary to the very point of
benchmarking, where you are trying to correlate two values that are connected.</p>
<p>Again, if you note an significant issues, please let us know. Sometimes
Rubinius exposes issues in existing code. Performance characteristics of real
applications are vital to making Rubinius faster. Also, if you have
suggestions for tools you would like to use, tell us. If you just want to
chat about the technology, that’s fine, too. We’re hanging out in the
#rubinius channel on freenode.net.</p>
<p><a href="#wur-personas"><strong>Back to personas</strong></a></p>
<h4><a class="anchor_title" name="wur-seasoned">Seasoned programmer</a></h4>
<p>Well, I am being kind by saying <em>seasoned</em>. You know when you look in the
mirror that <em>jaded</em> and <em>cynical</em> are much more apt. You’ve seen it all and it
has worn you down. You’ve been fighting the good fight, carefully guarding
that last flicker of optimism that burns in the secret place deep in your
heart. You’ve programmed Java/.NET/C++ professionally. You’ve even sucked it
up and written some PHP and Python when asked; you are a professional, they
ask and you deliver. You’ve seen attacked servers on fire off the shoulder of
Rackspace…</p>
<p>Rubinius has a lot to offer you. Remember that little flicker of optimism? It
is only the idealists that get ground down by the complete indifference to
pursuit of an ideal in so much of the world. Deep down, you are an idealist
and you will find plenty to refresh you here.</p>
<p>Rubinius aims to be the best possible implementation of Ruby by putting Ruby
itself front and center. We are using modern technology and always improving.
We change when there is a better way to do things. We judiciously rewrite and
are not too attached to any code or algorithm. The legacy Enterprise isn’t on
the steering committee. Our work will be done when you can use Ruby, just
Ruby, to solve your thorny problems.</p>
<p>Sure, that sounds idealistic. But never mind the pessimists that tell you that
you have to compromise. If you are not idealistic, you will not be unsatisfied
with things that are not as good as they could be; you will not try to change
the world. So give Rubinius a try, you may be surprised. And if you are, put
all that hard-earned wisdom you have gained to use for the betterment of Ruby.</p>
<p><a href="#wur-personas"><strong>Back to personas</strong></a></p>
<h4><a class="anchor_title" name="wur-academic">Academic Researcher</a></h4>
<p>Forgive me for staring, I know it is impolite. I’m just… intrigued. Of
course, you know Ruby is a late bound language, every message sent could
conceivably fail to find a target, potentially resulting in an uncaught
exception and program termination. There’s shared state, wild orgies of
mutation that disallow any reasonable attempt at automated parallelization.
Program proof is as oxymoronic a concept as military intelligence. It’s a very
messy affair of programming and meta-programming and meta-meta-programming,
which, for the love of Lisp, could be done so simply with macros. There’s all
this eager evaluation and complete disregard for purity. Despite vast odds,
somehow programs are written that actually run. You have noted all this with
great objectivity but you are nonetheless interested.</p>
<p>Excellent, we are pleased. We have much to learn and welcome the opportunity
for lively discussions about bringing formal methods to bear on the problems
of making Ruby as fast as possible.</p>
<p>Java benefited tremendously from the amount of attention it received by
academic researchers. Ruby can benefit from some of this research as well, not
to mention the research into Smalltalk and Self that preceded it. But Ruby has
its own set of problems to solve and deserves specific attention. The problems
are hard but not insurmountable. Rubinius is already demonstrating that. The
suggestion that we need to add more keywords, restrict Ruby dynamism, or write
<code>public static final int</code> all over are simply nonsense.</p>
<p>Rubinius already leverages research for fast virtual machines, garbage
collection (e.g. the generational approach and the Immix <em>mark-region</em>
algorithm), and JIT compilers (based on pioneering research done in Self and
used in the JVM Hotspot VM). Rubinius uses the exceptional
<a href="http://llvm.org">LLVM</a> project for optimization and code generation in the
JIT compiler. We are also working on better infrastructure for the JIT to
address Ruby complexities head-on.</p>
<p>Rubinius would be excellent to use in teaching. A compiler construction class
could study the architecture of the bytecode compiler written in Ruby and
experiment with exploratory changes to the compiler using IRB without having
to recompile anything! A 30-minute introduction to Rubinius could proceed
immediately to simple AST generation and have students experimenting with
their own syntax immediately. While it is easy to get started, there is plenty
of depth for exploring complex topics in virtual-machine construction and
garbage collection.</p>
<p>Whether you are interested in language research or language pedagogy, Rubinius
is an great project to consider. We look forward to hearing from you.</p>
<p><a href="#wur-personas"><strong>Back to personas</strong></a></p>
<h4><a class="anchor_title" name="wur-uber">Über programmer</a></h4>
<p>You learned the untyped lambda calculus sitting on your mother’s knee while
she worked on her doctorate in computer science. You were substituting terms
before you even uttered the word, “dada”. You wrote three different Lisp
implementations in Commodore Basic before you were seven. You can write
multi-threaded web servers in one pass with no tests and never hit a deadlock
or critical data race. You write parsers and compilers for odd languages on a
Friday night for the heck of it while waiting for the pizza to arrive before a
night out at the karaoke bar where you give an inspiring performance of Laga
Gaga’s <em>Poker Face</em>.</p>
<p>(<em>Loooong pause</em>. You’re not reading this. You’ve already written one or a few
languages on Rubinius and posted them to our
<a href="http://rubini.us/projects/">Projects</a> page. But anyway, I’ll continue…)</p>
<p>You are the Luke Skywalker of Ruby; Yoda has nothing more to teach you. Only
your fate confronts you now. Use the Source Luke and save the Federation of
Ruby loyalists from the Evil Oracle and its Java the Hurt.</p>
<p>There are a number of domains in which Ruby could benefit tremendously from
excellent libraries:</p>
<ol>
<li><strong>Servers and web servers</strong>: the web is here to stay but the argument that all
applications are going to be in Javascript on the client is not valid. A variety
of hybrid client-server architectures will continue to be the norm. We need
software that enables application authors to build a suitable solution to
their particular problems rather than trying to stuff their apps into
someone else’s solution with layers of wrapping.</li>
<li><strong>Concurrency</strong>: multi-core is here to stay but it is not only functional
programming that is suitable for high-concurrency applications.</li>
<li><strong>Graphical user interface</strong>: the web browser is also here to stay but it is
not the last word in applications. There are many cases where GUI apps are
the best option and Ruby needs a mature library or set of libraries to
build these apps on any major platform. I know some of these libraries
exist, but they seem to be collecting dust lately.</li>
<li><strong>Big data and data analysis libraries</strong>: our industry repeatedly witnesses
the same pattern: domain X starts with huge applications running on huge
horsepower servers for huge businesses and then it starts appearing in small
applications on small computers for small businesses. Accounting and
geographic information systems (GIS) are two examples. Data analysis is
coming to a laptop near you.</li>
</ol>
<p>These are general areas in which Ruby can be an excellent solution. So how
does Rubinius fit in? Rubinius is dedicatedly pushing more and more into Ruby
itself. Each of these domain is typically handled in Ruby right now by going
to find a library in a foreign language to wrap in a fuzzy Ruby embrace.
Rubinius is calling on the über-programmers of the world to implement
solutions in Ruby to help us identify performance challenges and address them.</p>
<p>Rubinius is also being used in some fascinating language experiments. Two of
these are Atomo (<a href="http://atomo-lang.org">http://atomo-lang.org</a> which is
implemented in Haskell, with a Rubinius implementation code-named
<a href="https://github.com/vito/quanto/">quanto</a>) and Fancy
(<a href="http://fancy-lang.org">http://fancy-lang.org</a>). So, if language design is
your cup of tea, Rubinius offers an excellent platform for experimentation.</p>
<p><a href="#wur-personas"><strong>Back to personas</strong></a></p>
<h4><a class="anchor_title" name="wur-philosophical">Philosophy Student Seeking the Meaning of Ruby</a></h4>
<p>Like your persona description, you tend to be long winded. You find most
descriptions too brief, almost dismissive. There are words and words should be
used to delve into the minutiae of minutiae. You, more than anyone, want to
know “Why?” with every fiber of your being. You will continue asking long
after the supply of hallucinogens has been exhausted and everyone else is
drooling in their sleep.</p>
<p>For you, Rubinius is an existential dilemma crying out for justification. If
we already have MRI, why build Rubinius?</p>
<p>It would be accurate to say that Rubinius has a philosophy. That philosophy is
simply this: <em>Ruby should be a first class language</em>. What does that mean?
Simply that it should be possible to solve problems writing Ruby code.</p>
<p>Let’s consider libraries: Being first class means not having to wrap a Java
library or build a C extension. If wrapping the library were the end of the
story, it wouldn’t be so bad. But that is <em>never</em> the case. Libraries have
bugs, weird APIs, incompatibility with other libraries, threading issues, and
disappearing maintainers. They may even be incompatible with newer versions of
the language in which they are written.</p>
<p>This list goes on. To address any one of these issues requires delving into a
different language with weird and incompatible semantics. If the library is
your core competency, that’s not such a big deal. But I will wager that it is
not, which is why you are using the library in the first place. Also, the
language in which you are wrapping the library (Ruby here) is not likely the
core competency of the library author, or you probably wouldn’t need to be
wrapping it. So Ruby wrapping one of these libraries will always be a
second-class citizen. Decisions will be made about the library’s API that do
not give one thought to the Ruby programs using it. Furthermore, the code
written in that foreign language does nothing to support the ecosystem of
Ruby. The knowledge gained in writing the library and the improved skills of
the library author do not benefit Ruby. Ruby deserves better.</p>
<p>Ruby has gotten a big boost recently with the production release of MRI 1.9.2.
There are significant speed improvements and welcomed additions to the core
libraries, like powerful handling of String encodings. At the same time, the
Complex and Rational libraries were added to the core library and rewritten
from Ruby to C code. This is disappointing. We should be able to solve these
problems more effectively in Ruby itself.</p>
<p>The philosophy of Rubinius is to make Ruby a first-class citizen. Ruby plays
second fiddle to no one. There is no other language whose history, semantics,
or vested interests compete with Ruby’s. It is true that there are difficult
problems to solve in making Ruby fast. But much of the technology already
exists and we will build what does not. Evan often quips that if we can get
Rubinius caught up to the dynamic language technology of ten years ago, Ruby
will be light-years ahead. That may be overstating how far behind Ruby is,
but it illustrates the focus of Rubinius.</p>
<p>There’s the saying, <em>In theory, there is no difference between theory and
practice. In practice, there is</em>. In Rubinius, theory and practice are
merging. We are motivated by the desire for Ruby to be a first-class language.
But we are also showing real progress in making that a reality. The Rubinius
VM executes Ruby code blazingly fast. The JIT compiler, while still being
quite young, is showing great promise. Compatibility with MRI is quite good
and speed is constantly improving.</p>
<p>Is the Rubinius philosophy valid? We think the proof is in the pudding.</p>
<p><a href="#wur-personas"><strong>Back to personas</strong></a></p>
<h4><a class="anchor_title" name="wur-manager">Manager</a></h4>
<p>No, it did not cross my mind to describe this persona as Pointy-haired Boss.
Not only would that be unfair to Dilbert, but that persona would be reading an
article on Web Scale. No, you are someone who has fought hard battles in the
trenches and learned valuable lessons: it’s about execution and execution
depends on good technology.</p>
<p>Rubinius is building solid technology. We started the RubySpec project and
have contributed tens of thousands of lines of code to it. With the support of
Rubyspec, in just over four years as a public project, we have basically
caught up with MRI 1.8.7 in compatibility and performance. For some code, our
performance is much better, for other code, it is not as good. However,
Rubinius is built on solid, modern technology and the project’s trajectory and
velocity are outstanding.</p>
<p>Rubinius is a completely new implementation of core Ruby. Rubinius did not
start as a port of existing code. Furthermore, Rubinius implements its own
virtual machine and garbage collector in C++. The bytecode compiler that
targets the virtual machine is pure Ruby. The core Ruby library is mostly Ruby
with some primitive operations in C++. The JIT compiler uses the
<a href="http://llvm.org">LLVM</a> project. Given the amount of work being done in the
project, Rubinius is pacing extremely well relative to other implementations.</p>
<p>Currently, we are working on support for Ruby 1.9 features, Windows support,
and full concurrency with no global interpreter lock (GIL).</p>
<p>If you are looking at Ruby to implement your next project, rest assured that
Ruby will have the support of excellent technology. If you are already using
Ruby, consider investigating how your application runs on Rubinius. We welcome
the feedback and look forward to solving challenging engineering problems.</p>
<p><a href="#wur-personas"><strong>Back to personas</strong></a></p>
<h4><a class="anchor_title" name="wur-knowledge">Knowledge Seeker</a></h4>
<p>You thirst for Knowledge. You follow it wherever it leads you. You’ll happily
walk Haskell’s hallowed halls of pure laziness or sit at the feet of the
meta-program gazing raptly at class transmorgrification. You don’t judge. You
have more than enough knowledge to be dangerous, enough to know that the
universe is amoral and knowledge is the only Truth there is. Nor does any mere
mortal language bind you. All languages are finite. You’ll be here today and
gone tomorrow; there is no permanence for the knowledge seeker.</p>
<p>Rubinius is merely a step along the path you journey. Take what you want, it
is all free. As a Ruby implementation, it has much to offer your quest for
knowledge. The Ruby code in the core library is accessible and easy to follow.
The interface between Ruby and the C++ primitives is consistent. The C++ code
itself is restrained. You won’t need a PhD in Turing-complete template
languages to understand it.</p>
<p>Rubinius offers extensive opportunities to learn about programming languages
in general and Ruby in particular. When I first started working with Rubinius,
I knew a little bit about garbage collection and virtual machines. I would
call what I knew, toy knowledge. As I struggled to learn more, it seemed
helpful to consider layers of understanding:</p>
<ol>
<li><strong>General programming language semantics</strong>: the procedure abstraction,
looping and iteration, recursion, references and values, etc.</li>
<li><strong>Ruby semantics</strong>: modules and classes, access restrictions, blocks and
lambdas, etc. Even with fundamental programming knowledge, a particular
language can be confusing. When I was learning C, a friend was also
studying it. One day he walked over and threw <em>The C Programming Language</em>
book down on my desk and said, “This <code>for</code> loop makes no sense!” He was
quite upset. “Look,” he said, “in this example <code>for (i=0; i < n; i++)</code> how
can <code>i < n</code> get executed <em>after</em> the code in the body?!” It’s easy to laugh
at that confusion, but coming from BASIC, that really threw him. Deepening
our understanding to this second level requires confronting some
“counter-intuitive” notions.</li>
<li><strong>Hypothetical implementation</strong>: knowing how Ruby works, how might one
implement it. I think this is an important layer of understanding and it is
easy to miss or gloss over it. By pausing at this layer and thinking how
you might implement something, you test whether or not you are really
understanding it.</li>
<li><strong>The MRI implementation</strong>: Reading the MRI source code is an excellent way
to investigate Ruby. For one thing, it will inform you how Ruby <em>actually</em>
works, and you may be surprised.</li>
<li><strong>The Rubinius implementation</strong>: here you are exposed to the philosophy of
Rubinius and the challenges to implementing Ruby. We are attempting to
bring the beauty of Ruby as an object-oriented language deep into the core
of Ruby itself.</li>
</ol>
<p>While the Rubinius code itself offers many opportunities for learning, don’t
hesitate to drop by the #rubinius channel on freenode.net and ask us
questions. Perhaps you already know a lot about another language and are
interested in how Rubinius implements some feature. Or you may be relatively
new to programming languages and have some basic questions. We enjoy talking
about these concepts. If you are quite new to Rubinius, you may find these
posts informative:</p>
<ul>
<li><a href="http://www.engineyard.com/blog/2010/making-ruby-fast-the-rubinius-jit/">Making Ruby Fast: The Rubinius JIT</a></li>
<li><a href="http://www.engineyard.com/blog/2009/improving-the-rubinius-bytecode-compiler/">Improving the Rubinius Bytecode Compiler</a></li>
<li><a href="http://www.engineyard.com/blog/2009/the-anatomy-of-a-ruby-jit-compile/">Compiling Ruby: From Text to Bytecode</a></li>
</ul>
<p>Finally, consider helping other knowledge seekers by writing blog posts on
what you learn about Rubinius. Or, help us <a href="http://rubini.us/doc/en/how-to/write-documentation/">write documentation</a>!</p>
<p><a href="#wur-personas"><strong>Back to personas</strong></a></p>
<h4><a class="anchor_title" name="wur-enthusiast">Language Enthusiast</a></h4>
<p>You like languages for their intrinsic value. Of course the world comes in
many shapes and sizes. You wouldn’t have it any other way. That’s the fun and
spice, joie de vivre, raison d’etre, supermarché… Sometimes you get carried
away writing a program in another language just because you like how the
letters arrange down the screen. Ruby is definitely one of the impressive
languages and sometimes you almost notice a tiny bit of favoritism in your
normally egalitarian attitude.</p>
<p>As with any enthusiast, you like to experiment. Your interest is not mere
curiosity or sterile investigation. You want to get your feet wet and your
hands dirty. Rubinius is an excellent opportunity to delve into a number of
fascinating subjects. We can merely suggest a path; your experiences along the
way will tell you whether or not Rubinius has value to you.</p>
<p>If you are most interested in languages themselves, the syntax and arrangement
of features, Rubinius offers you immediate gratification. Look for Evan’s
upcoming post on his Language Toolkit or check out the code to
<a href="https://github.com/evanphx/prattle">prattle</a>, a Smalltalk dialect used to
illustrate the ease of building a language on Rubinius. Also look at some of
the existing languages <a href="http://rubini.us/projects/">projects</a> targeting
Rubinius.</p>
<p>If it is the machinery under the covers that is more interesting, start
reading some code. The bytecode compiler lives in <code>lib/compiler/</code>. The virtual
machine is in <code>vm/</code>, and the garbage collector is in <code>vm/gc</code>. As you are
reading through, consider helping us write better documentation. There are
already sections for the <a href="http://rubini.us/doc/en/virtual-machine/">virtual
machine</a>,
<a href="http://rubini.us/doc/en/garbage-collector/">garbage-collector</a>, <a href="http://rubini.us/doc/en/jit/">JIT
compiler</a> and <a href="http://rubini.us/doc/en/bytecode-compiler/">bytecode
compiler</a> in the documentation, so
adding content is easy.</p>
<p>You may also be interested in these previous posts about Rubinius:</p>
<ul>
<li><a href="http://www.engineyard.com/blog/2010/rubinius-wants-to-help-you-make-ruby-better/">Rubinius wants to help YOU make Ruby better</a></li>
<li><a href="http://www.engineyard.com/blog/2009/5-things-youll-love-about-rubinius/">5 Things You’ll Love About Rubinius</a></li>
<li><a href="http://www.engineyard.com/blog/2009/rubinius-the-book-tour/">Rubinius: The Book Tour</a></li>
</ul>
<p>Most of all, experiment. Rubinius is easy to hack on. Are you curious about a
particular feature needed in your language? Try adding it to Rubinius. Think
Lua is all the rage because it uses a register VM? You could probably write a
register-based bytecode interpreter for Rubinius in an afternoon. That’s just
an example, of course. The point is to play around with your ideas and have
fun doing it. I think you’ll find Rubinius to be an adventuresome companion.</p>
<p>Be sure to let us know what you’re working on. We like to be inspired, too!
Consider writing a blog post about things that you find interesing, like this
<a href="http://yehudakatz.com/2011/02/18/getting-comfortable-with-rubinius-pure-ruby-internals/">recent post</a> by Yehuda Katz.</p>
<p><a href="#wur-personas"><strong>Back to personas</strong></a></p>
<h3><a class="anchor_title" name="wur-conclusion">Conclusion</a></h3>
<p>So there you have it. Just like there are many different viewpoints, there are
many different reasons to use Rubinius. Not all those reasons make sense to
everyone. We believe, however, that Rubinius has something to offer to just
about everyone interested in Ruby. Most importantly, try it!</p>
<p>If we didn’t answer your question here, leave us a comment. If you have a
reason for using Rubinius that we didn’t mention, let us know. As always, we
appreciate your feedback. Chat with us in the #rubinius channel on
freenode.net, <a href="https://github.com/evanphx/rubinius">watch our Github project</a>,
and <a href="http://twitter.com/rubinius">follow us on Twitter</a>.</p>
<p>P.S. Thanks to David Waite for suggesting the Academic Researcher and Language
Enthusiast personas, I always forget those!</p>
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = 'rubinius';
var disqus_identifier = '/2011/02/25/why-use-rubinius/';
var disqus_url = 'http://rubini.us/2011/02/25/why-use-rubinius/';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
<footer>
<div class='container'>
<nav>
<ul>
<li><a href="http://twitter.com/rubinius">Follow Rubinius on Twitter</a></li>
<li><a href="http://github.com/evanphx/rubinius">Fork Rubinius on github</a></li>
<li><a href="http://engineyard.com">An Engine Yard project</a></li>
<li id='credit'>
Site design by
<a href="http://less.thanthree.com">Less Than Three</a>
</li>
</ul>
</nav>
</div>
</footer>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-12328521-1");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>