Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Ruby (programming language)
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Semantics and philosophy == [[File:Yukihiro Matsumoto.JPG|thumb|[[Yukihiro Matsumoto]], the creator of Ruby]] Matsumoto has said that Ruby is designed for programmer productivity and fun, following the principles of good [[user interface]] design.<ref name="informit" /> At a Google Tech Talk in 2008 he said, "I hope to see Ruby help every programmer in the world to be productive, and to enjoy programming, and to be happy. That is the primary purpose of Ruby language."<ref name="googletechtalk" /> He stresses that systems design needs to emphasize human, rather than computer, needs:<ref name="artima" /> {{blockquote| Often people, especially computer engineers, focus on the machines. They think, "By doing this, the machine will run fast. By doing this, the machine will run more effectively. By doing this, the machine will something something something." They are focusing on machines. But in fact we need to focus on humans, on how humans care about doing programming or operating the application of the machines. We are the masters. They are the slaves. }} Matsumoto has said his primary design goal was to make a language that he himself enjoyed using, by minimizing programmer work and possible confusion. He has said that he had not applied the [[principle of least astonishment]] (POLA) to the design of Ruby;<ref name="artima" /> in a May 2005 discussion on the newsgroup comp.lang.ruby, Matsumoto attempted to distance Ruby from POLA, explaining that because any design choice will be surprising to someone, he uses a personal standard in evaluating surprise. If that personal standard remains consistent, there would be few surprises for those familiar with the standard.<ref name="rubyweeklynews" /> Matsumoto defined it this way in an interview:<ref name="artima" /> {{blockquote| Everyone has an individual background. Someone may come from Python, someone else may come from Perl, and they may be surprised by different aspects of the language. Then they come up to me and say, 'I was surprised by this feature of the language, so Ruby violates the principle of least surprise.' Wait. Wait. The principle of least surprise is not for you only. The principle of least surprise means principle of least ''my'' surprise. And it means the principle of least surprise after you learn Ruby very well. For example, I was a C++ programmer before I started designing Ruby. I programmed in C++ exclusively for two or three years. And after two years of C++ programming, it still surprises me. }} Ruby is [[Object-oriented programming|object-oriented]]: every value is an object, including classes and instances of types that many other languages designate as primitives (such as [[Integer (computer science)|integers]], Booleans, and "[[null pointer|null]]"). Because everything in Ruby is an object, everything in Ruby has certain built-in abilities called methods. Every [[function (programming)|function]] is a [[Method (computer programming)|method]] and methods are always called on an object. Methods defined at the top level scope become methods of the Object class. Since this class is an ancestor of every other class, such methods can be called on any object. They are also visible in all scopes, effectively serving as "global" procedures. Ruby supports [[inheritance (object-oriented programming)|inheritance]] with [[dynamic dispatch]], [[mixin]]s and singleton methods (belonging to, and defined for, a single [[instance (computer science)|instance]] rather than being defined on the class). Though Ruby does not support [[multiple inheritance]], classes can import [[Modular programming|modules]] as mixins. Ruby has been described as a [[multi-paradigm programming language]]: it allows procedural programming (defining functions/variables outside classes makes them part of the root, 'self' Object), with object orientation (everything is an object) or [[functional programming]] (it has [[anonymous function]]s, [[Closure (computer science)|closures]], and [[continuation]]s; statements all have values, and functions return the last evaluation). It has support for [[Introspection (computer science)|introspection]], [[reflective programming]], [[metaprogramming]], and interpreter-based [[Thread (computer science)|threads]]. Ruby features [[Type system|dynamic typing]], and supports [[parametric polymorphism]]. According to the Ruby FAQ, the syntax is similar to [[Perl]]'s and the semantics are similar to [[Smalltalk|Smalltalk's]], but the design philosophy differs greatly from [[Python (programming language)|Python]]'s.<ref name="faq-comparison" />
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Ruby (programming language)
(section)
Add topic