Language and Cognition
Philosophers and linguists have long asked the question, Does the language we speak shape the way we think?
We now have academic research to help answer this fascinating question. The data seems to indicate that language does indeed affect the way we think. It can even impact our ability to perform.
Lera Boroditsky, Ph.D has a wonderful TED talk that introduces linguistic and cognitive studies to the masses.
She demonstrates that language influences a tremendous amount of the way we perceive and interact with the world. Everything from our sense of direction to our understanding of time and distance. It touches our ability to count or quantify, our awareness of colors, our perception of intent, credit and blame, even our concepts of gender.
Our language changes what we pay attention to and notice. What we place emphasis on. What our biases are. It impacts our capacity and speed at which we can accomplish various tasks. It can even change the physical characteristics of our brain.
Language acts as a stepping stone into entirely new cognitive realms and can lead to big differences in creative and intellectual ability.
The Ruby Language
Yukihiro Matsumoto (Matz) has indicated that Ruby was inspired and influenced by several other programming languages. Lisp, Smalltalk, Perl, Eiffel, Ada, Basic, and others. More recently, Rust, Go, and Elixir.
I knew many languages before I created Ruby, but I was never fully satisfied with them. They were uglier, tougher, more complex, or more simple than I expected.
Throughout the development of the Ruby language, Iโve focused my energies on making programming faster and easier.
Ruby is designed to make programmers happy.
-Matz
Why I still love Ruby
Ruby has a long history of assimilating the best ideas, patterns, and practices from other programming languages. In many ways, it is the convergence of the most exceptional features from other languages.
Admittedly this can feel messy or chaotic at times, but it delivers the widest range of options to the programmer. Ruby's culture of embracing and including the best from other languages dramatically increases the solution space and directly impacts our capacity to think and perform as developers.
Does this mean we should ignore other languages and trust the MRI team will always get it right? Of course not. Learning another language will improve your ability to work with Ruby... or any language for that matter.
To have a second language is to have a second soul.
-Charlemagne
Having said that, Ruby is the most malleable and flexible language I've ever worked with. It frees my mind to explore solutions that I may not have considered or even been aware of in another language.
A short note on Rails
I should point out that Rails wouldn't exist without Ruby. DHH appropriated Ruby's culture of inclusivity and created a framework that is a delightful melting pot of tools, patterns, and techniques. All made possible by Ruby. Language choice may also help explain why no other web framework has materialized that shares the same eminence and stamina.
This is why I still love Ruby, even after 10 years of working with it.
Top comments (49)
I think this is also happening in reverse a lot these days. I definitely think I spot Rubyisms in new ideas these days. Hard to trace idea origins though.
I, too, am still very much enjoying developing in Ruby.
I agree that programming languages borrow good ideas from each other all the time, but Ruby's focus on developer happiness seems to make this a first class goal of the language.
Totally agreed. I can't think of a single other language that has developer happiness as one of its stated goals. Although I don't have many opportunities to use Ruby these days, I still think that I was at my most productive when I did. Ruby (and Rails) taught me, among other things, that
๐, I used to have questions like which language is better ? After discussing with my friends and listening to people online, I realized that Its better to stop asking these questions. Instead start asking which tool is better for current Job and Trend.
Choose the right tool for the Job.
C#
orJava
for building enterprise and large applications.JSF
you can think of usingAnuglar or
Reactor
Vueetc. for Front End
.Python
for Machine Learning.Go
for Micro Services based performant applications.In future maybe today's Languages and Framework may be outdated, so to survive you will be forced to learn new language of that time.
Conclusion:
Developer Happiness, stick to the language which make your life easier, like easy to read syntax, maintainable, has Good IDE. I like C# for current work, and its up-to you to decide what you like.
Its always good to be Open to learn any language as required and Choose the right tool for the Job.
Hope this helps.
Yup. Like Rust! Obviously Crystal, which is a statically typed Ruby mock-up I believe.
I think this is a key takeaway. I always hear people talking about how they are trying to create Rails for their given language, like JavaScript, but no one has quite hit the mark. It's called Ruby on Rails for a reason!
Like Ben, I am also still really enjoying developing in Ruby.
Laravel comes pretty close doesn't it? Although it seems that Laravel adopted a bit more of the "architecture" and "patterns" mindset of Java, and it's a bit more verbose (I admit you could say more clunky) than Ruby/Rails. But, when working with Laravel the feeling I get is pretty close to the feel of working with Rails.
Is
Ruby
more readable and maintainable thanC#
andJava
, What are its advantages compared toC#
andJava
?Ignoring frameworks and libraries I would say this:
One thing I'd like to add for those who are put off by dynamically typed languages (scripting languages, usually). There's a project called crystal, which is a statically typed Ruby-based compilable language. So if you wanna learn Ruby but use it in a compiled language, consider crystal. It's still in pretty heavy development, it seems, but I've done some small projects with it. It's a little different, but I like it because of its Ruby syntax. I love Ruby.
Actually Ruby does not have functions at all. There are all methods.
They are all objects! :D
Procs are functions.
From the Ruby doc: "Proc objects are blocks of code that have been bound to a set of local variables. Once bound, the code may be called in different contexts and still access those variables."
I can also recommend a book patshaughnessy.net/ruby-under-a-mi... that goes greatly to the implementation as well.
Thanks, What about performance ? does the performance is well when compared to
C#, Java, Python and Go
? I also like to know which server side language is better for making web apps.I don't know what the comparison is in 2020, but for most business logic and webapp use cases Ruby and Rails is more than fast enough. Usually the biggest speed problem in web apps results from excessive database calls and that is going to be a problem in every language.
I found a nice benchmark a while ago, comparing:
Ruby 2.7 vs. Python 3.8 => in most benchmarks, Ruby is faster
Ruby 2.7 vs. PHP 7.4 => in most benchmarks, PHP is faster
source: benchmarksgame-team.pages.debian.n...
I guess almost all compiled languages will have an edge over scripting languages.
blog.iron.io/how-we-went-from-30-s...
I don't think performance is as good as other languages, I consider ruby and python to be slow, developers write code faster though
@lud , what do you mean by "in most benchmarks, Ruby is faster"?? From the same link, I counted 3 (ruby) against 7 (python). Python kinds of win that competition.
And "in most benchmarks, PHP is faster"?? I counted 0 (ruby) against 10 (php). That looks like in all benchmarks
Hi! I am not @lud but @lud :) (this is strange though)
edit: Oh. Looks like it is not possible to tag someone with a capital letter in its name. There is definitely a bug or a dev.to design problem here.
@mcfriend99 "some" in terms of formal logic can include "all". During statistics and formal logic lectures I got that drill, to never say "100%" or "all", but always "most"/"some"/"more than 99%" etc (I am a mathematician, plus English is not my first language, I learned all that logic stuff in German). For a discrete number of objects, that terminology might not necessary, but I just got used to it.
Also, if you scroll to the bottom of the page, you'll notice that this website uses the most recent version of each language, so possibly Ruby was faster in "at least 1" of the specs at the time that I've checked it (it now uses PHP 8, which was not yet released when I wrote my comment).
But honestly, I don't care about if one language wins in 3 out of 5 or 2 out of 7 of whatever. They are all just some isolated benchmarks, which might not reflect reality perfectly. You can write horribly slow code in any language :D
@lud :D @swiknaba should tag me, which is my username. Set up an issue ;) github.com/forem/forem
But I am pretty envious, that you got a/"my" three letter username :P
So it seems that even your username is shown in lowercase in my comment, it tagged you (and not me) successfuly.
About ruby benchmark, ruby 3 shows to be 3 times faster compared to 2.7.*. My scripts for Linux administration in ruby 3 are way better. Ruby solved performance issues very well, and I am pretty sure it will keep going better. I know few languages, but I am only happy when writing ruby code :)
There are people that will argue both sides of whether or not Ruby is more readable or maintainable than other languages. I think Ruby and Rails are both best suited for disciplined, sometimes smaller, teams. I think this actually enhances the "designed for happiness" aspect of the language. Here are some of the reasons I find Ruby so enjoyable.
I agree. Most people I've talked to who don't like Ruby stated they didn't like it because it wasn't easy to read. In my opinion, that's likely because Ruby is not in the C-family of languages and most people are not prepared for that. It took me a little while to break out of that C-lang syntax mode and I'm so glad I stuck with it.
Ruby is consistently OOP from the kernel up. Its ability to do some awesome stuff succinctly and reliably is fun. I just really love Ruby, but it doesn't fit everyone's mold. I suggest that if people find it strange at first but invest the little time it takes to get used to it, they will fall in love with it.
Compared to the mantra of python. "There should be one-- and preferably only one --obvious way to do it". I wonder if that has constrained python developers :)
Matz (the creator of ruby) used to talk about the "Principle of least surprise" being this idea that if the way some language feature works doesn't surprise you, then you're happier for it.
Because of this idea Ruby has many MANY different obvious ways to do anything. This makes many different kinds of devs happy, because they can always write in the way that makes the most sense to them.
This is an amazing boon as a solo dev or a small team, but in larger settings this can be kind of a pain since a code base could become inconsistent pretty quickly unless the org enforces a kind of style.
Python takes the opposite approach.
That's probably why in the early 2010s there was a lot of (mostly comedic) volatility between the ruby and python communities
I agree. There are some Python things that just drive me insane due to the inconsistencies of implementation namely between procedural and object oriented development. Python is an OK language, but given the choice, personally, I'll take Ruby over Python any day.
"Principle of least surprise" maps pretty well onto there should ideally only be one way to do something. If there isn't several ways of doing something it's not surprising :).
I was reading some ruby a while ago, and stumbled upon.
array << element
. It took some serious googling to figure that one out, and I'm sure there are several ways you can write that too.I think the approach that ruby took is one of individuality. Imaging that the "one preferred way" of adding elements to arrays was
array << element
.You'd be surprised that something like
array.push
wasn't working, and even more surprised thatarray << element
even existed.Even though, in our hypothetical language, that's the only preferred way to push to arrays, it's still surprising.
If any of that made sense
It's fascinating to see how something like "principle of least surprise" can be interpreted and addressed so differently. The Ruby and Python solutions for this could not be more different.
Itโs especially interesting because both languages (python 2.7 at least) are pretty similar from a high level technical point of view.
Both OOP style languages
Both interpreted (usually)
Both very high level
Both dynamic
Both are even heavily used in web development
Except for the Python dependency management ;)
This is an interesting question. The two distinct philosophies is certainly the primary difference between these amazing languages IMO.
I still find it easiest to think in Ruby. Maybe that's because I have been writing it for so long, maybe it's because the standard lib handles many details I don't need to think about, and maybe it's just because it truly does live up to Matz's mantra of developer happiness.
All I know is that I still love writing Ruby too.
If you love Ruby in 2020, go join Crystal lang community, Ruby and Crystal should tinker with more cross-project collaborations.
The way people talk about Ruby makes me want to learn this language so much
It's a pretty approachable, tons of resources I'd highly recommend you give it a go.
Benefits of Ruby's development happiness can be translated into it one key business metric: Development lead time. That is a important metric for businesses to stay a step ahead of the competitors especially for startups. I think that is why a lot of the new companies are still on RoR, even though people keep shxtting on it :)
I agree on some stuff, disagree on others.
Most points you make about ruby resonate with me, I love the expressivity, the malleability - gives me options.
In theory it does allow me to explore a lot an solve problems in many different ways.
But does "ruby culture" really exist? Or all we have is "rails culture"?
Rails probably represents 95%+ of all ruby projects out there, with them often you get that aggressive rails culture of "the right way to do things is X" and suddenly fantastic language features are thrown out the window...
I'd like to be as optimistic as you are, I really do, but I'm almost out of faith here..
Agree that Rails monoculture isn't always great and can be dogmatic at times; however, the non-Rails (or Rails adjacent) ecosystem seems pretty vibrant to me right now. Hanami, Roda, Phlex, etc... lots of activity and cool stuff going on out there.
Although I never coded in Ruby (Python dev) it would still be my second choice - I love Django and in many ways, Django is great because of RoR
Iโve heard Taylor Otwell say he pulled a lot of inspiration from for Laravel from Rails as well.