Back then I was a teenager and doing most of my stuff in PHP, because in 2006/2007 most of the resources about PHP and MySQL I could find were all about that, and I was still at the level of just injecting some PHP into my HTML to make it dynamic (back then Javascript/DHTML was something you copied and pasted and there was only rarely a reason to seriously use it). This was the era of PHP, Cold Fusion, classic ASP, CGI and so on. Not to mention that shared hosting providers (the cheapest option for web hosting) only really gave you PHP under Apache to work with (or the LAMP stack as it were).
So this Ruby on Rails looked cool but I couldn't get my head around it at first, I was still super green. Skip forward from 2007 to 2009, right before my first professional gig, and the seed had gestated. Suddenly I was running a minimal Rack/Sinatra server around a Redis app purely because I needed a leaderboard and I learned about things like ZRANK and ZADD before I understood what sorted sets were. I did try to advocate for Ruby at my first job but they were of the mindset that literally anything and everything could be built through Drupal. I will leave that thought to your imagination, although I owe my team mate a lot for properly mentoring me when it came to javascript, closures (back in the day where articles about closures in JS were the same as more recent articles about monads.) He didn't just show me jquery, he gave me the low-down on JS itself.
I'm made redundant and after that, I go deeper into Ruby. I get a job in London of all places and thus began my career as a full stack engineer specialising mainly in Rails, and Ruby. My interested in the language grew ever stronger and it remains strong to this day, a good 10 years later. I dabble in a lot of other things these days too, because that's what I enjoy, but I'll always find myself back with Ruby when I need to be pragmatic. It's a beautiful language with a strong community that values developer experience, and my only real wish is that I learn enough to be able to contribute back to the language in a meaningful way,
Ruby is truly a gift.
I have such good memories of the four or five years when Ruby was my main driver. Great job by Matz and core team with the 3.0 release.
I have gone back to my 1980s roots and now once gain use Common Lisp as my main driver, except for deep learning where I need to use Python (tried Julia and Swift).
I think Matz has it exactly right. As programmers it is important to be happy using a language. Life should be fun most of the time, and there is nothing wrong with trying to optimize life for maximum joy we bring to ourselves and other people.
BTW, happy holidays!
EDIT: I just did a web search. Very sad. Long before I met him at the Merb conference, I appreciated some nginx plugin he did for uploading files with a progress meter - that was a long time ago.
So I was so glad when I heard the announcement, particularly as they treated it as "We sat down and considered each other's technology, from a tech perspective, and we're going to bring the best parts of each to make Rails 3." Not everyone loved the results (sorry, sarcasm), but we avoided an irritating fan-war.
I got to thank Yehuda when I met him at EmberConf, and he seemed pleased that it was appreciated.
A year ago I was dropped in as the lead on a large Ruby project. Suddenly everything clicked. Now all the reading I’ve done on domain driven design and TDD actually has meaning and I’ve written more solid code in a year than the rest of my career combined.
And on top of that, while every corner of tech has its toxic personalities, the Ruby community is overwhelmingly friendly, welcoming and mature.
Many of the language communities I’ve been involved with have been dominated by behaviours such as:
- gatekeeping - elitism - subtle sexism - credentialism - (most frustratingly) a general sense that “our” community is somehow superior to others (people often hurl this nonsense toward PHP and JavaScript developers in particular).
I remember going to a Go talk where one of the founders of the language was speaking to a small group. An audience member who was an avid Go user asked a simple, innocent question about some shortcoming of the language. He copped a sarcastic and dismissive response from Pike, which of course then acted as the signal for everyone else to treat him the same way during the casual drinks and pizza after the session. I’ve seen this sort of thing time and time again both professionally and in the meetup / conference space.
On the contrary, the Ruby development community across three different Australian cities is dominated by people who have a solid baseline of emotional intelligence and worldly perspective. This filters through the community and creates an environment that I personally find to be far more welcoming and intellectually stimulating.
We are all noobs, at something. It's better to be kind and feel good about helping and sharing knowledge.
Luckily, Q&A sites like Stackoverflow, force the question to be answered.
It's on a different day in Canadia
But I have looked at the syntax of Ruby and find it to be more elegant. Does anyone knowledgeable about it have any useful information?
Ruby's design is a lot more consistent/predictable/ergonomic than python. the ruby standard library is honestly amazing (see: https://ruby-doc.org/core-2.7.2/Enumerable.html)
Everything is an object, methods take blocks where that makes sense. stuff just feels well thought out and generally when I learn something new about ruby I think 'wow that makes sense' and not 'why would you do it like that'.
There also seems to be much much less churn from a tooling perspective. Learn how gems/bundler works and you're set.
Also, ruby can be a (in my experience) superior replacement for awk.
Brief example, -n is loop over current line as $_, -l is clean up line endings
cat .zsh_history | ruby -nle 'BEGIN{$x=[]}; $x << $_.encode("UTF-8", invalid: :replace, replace: ""); END{$x.sort_by{ _1.count("|") }}'
I was trying to find some longer pipelines from my command history. encode is stripping out a bunch of invalid utf-8, otherwise it would have just been $x<<$_or, pick a random line from stdin:
ls | ruby -e 'puts ARGF.to_a.sample'But do not be fooled by Rails, Ruby is quite something else, of which Rails is a very small, opinionated part.
Tips: look at MiniTest source code, Sinatra and Rack source code are quite interesting too.
Shameless plug, a couple of idiomatic Ruby repos of mine:
For a web programming I would switch to Kotlin. However Ktor is still lacking compared to Rails in most important areas for me. In Rails common operations like upload a picture, serve is later in a different resolution, migrate a db, quickly create CRUD forms, etc. are just a few lines of code. In Kolin web frameworks you would have to invest much more time to glue together different libraries to do the same job. Many won't agree with that opinion but for me Rails ActiveRecord is the best part of Rails. There is no a such complete thing for a Java ecosystem. It is a beautiful compromise between ideological (only pure plain Java objects are allowed) ORMs like Hibernate and plain SQL approach like jOOQ.
One example is, I've written a script that I can pass a domain name and an email address to. It will then set up basic nginx blocks, install certbo and add a cron job if needed, run certbot, get an https certificate and reconfigure the nginx blocks to reverse proxy incoming requests and force https.
I have no idea what language would have let me write this faster than Ruby did. Maybe Perl if I knew it well. Definitely not Go or Rust.
In other words if someone has a good enough tool in their tool-belt for a certain area, then learning another slightly better tool in that area is not a must.
In my opinion it is better to be proficient in a one language than mediocre in two similar languages. If someone is bored and has time to learn both Python and Ruby then why not.
Ruby is a fine application development language, but an incredible scripting language. Can't recommend it enough for that niche. Nothing else is even close.
I'd go for Elixir's Phoenix or, if you really need some heavy duty API gateway -- Rust's Actix-web 3.x.
I think if you care a lot about the philosophy behind Python (have one obvious way to do things, explicit over implicit) and the syntax, then you might have some difficulties picking up Ruby right away.
With that said, I think it's a very enjoyable language; Rails is still a very enjoyable ecosystem; and it works well for scripting especially if you're trying to write organized shell scripts.
The bottom line is that (A) the more languages you are proficient in the better and (B) as long as whatever problem you need to be solved is solved then the language doesn't really matter.
The syntax in Python also leaves much desired (e.g. use of underscores) and most of Ruby's quirks are Perlisms such as $1.
That's the crux of it here. People really differ about this and OP should check it out for himself. Yes Python has more usage, I hardly think it really affects one's work in any meaningful way. Javascript has tons of developers using it, many times this is a con actually. An explosion of libraries and conflicting views and philosophies.
Ruby doesn't have functions, but you can obtain a first class value for any method by calling the method `method` on any object.
So I would personally recommend learning something new that is quite different. For high level coding you could give Elixir a go. I've seen it used at a very high level to orchestrate machine learning jobs running in either Python or Java. Ruby/Python are probably still better for little scripts though. For data manipulation maybe give Julia a go? For lower level programming maybe try Go or Rust?
Whenever I need to reach for async in Python I ponder rewriting the program with Go or Elixir. Python feels like a very high and expressive language with tedious, low level async primitives bolted in...
It also isn't hip anymore, and many of the brains from years past have moved onto Go and Rust based on my casual observation.
PS: (And yes, the website itself is built with jekyll and ruby, see https://github.com/planetruby/gems ).
i dont know for data manipulation but i guess also ruby has it. maybe this https://github.com/thbar/kiba
He is a nice guy and enjoys giving the world a good Christmas present.
Looking into it, this other benchmark [2] of 3.0.0-preview1 vs Ruby 2.7 actually concludes there's no real performance improvement there. So I guess an additional question is, is there actually a 3x speed increase in realistic benchmarks?
[1] https://benchmarksgame-team.pages.debian.net/benchmarksgame/... [2] https://www.fastruby.io/blog/rails/performance/ruby/hows-the...
In my experience Ruby has been faster than Python for a long time - ever since its performance improved significantly going from 1.8 to 1.9, and Python’s got worse going from 2.x to 3.x.
I'll try to run these benchmarks on TruffleRuby (and maybe JRuby) too, would be an interesting comparison.
BTW, is there any reason you used 2.1.0 and not 2.0.0? Maybe some issue with 2.0.0?
The Are-we-fast-yet suite is optimized for inter-language comparisons and sets the focus on ideomatic language use and representative algorithms. There is a peer-reviewed scientific publication; here is a preprint: https://stefan-marr.de/papers/dls-marr-et-al-cross-language-...
> is there any reason you used 2.1.0 and not 2.0.0?
The 2.0 version produced errors like "uninitialized constant Process::CLOCK_MONOTONIC (NameError)"; from that I concluded that it is not compatible. I still had to apply a fix (https://bugs.ruby-lang.org/issues/9578) to make Ruby 2.1.0 compile on my test machine. Here is a report version where I compare with Ruby 2.7 instead of 2.1: http://software.rochus-keller.ch/are-we-fast-yet_crystal_rub...
Though things like Python 3 going from 18.45 seconds to 2.67 seconds on the regex-redux test [1][2] tends to make me question the validity/usefulness of these benchmarks. (inasmuch - how much of it is testing language performance vs bypassing it?)
[0] https://web.archive.org/web/20200301005643/https://benchmark... [1] https://web.archive.org/web/20191225153009/https://benchmark... [2] https://web.archive.org/web/20200604134902/https://benchmark...
Actual quotation —
'You will probably come across people saying that the programs are not idiomatic ("enough"). So read the description and write your own idiomatic program, without programming tricks.'
https://salsa.debian.org/benchmarksgame-team/benchmarksgame/...
Here are 37 Ruby programs — https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
Presumbly you can show us 2 lists: which of them are your idea of "idiomatic" and which are not ?
Merry Christmas.
Significant portion of the Python test case is FFI code to directly link PCRE bypassing even normal Python extension support.
I guess I should augment some of the SBCL benchmarks with custom assembly then...
How could that possibly effect the performance of the Ruby regex-redux? :-)
"Wanted — Ruby PCRE2 regex-redux program"
https://salsa.debian.org/benchmarksgame-team/benchmarksgame/...
You do realize those are different programs, don't you?
You do realize that both those Python programs are shown in the current measurements, don't you?
https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
But if you really want to show us the old Q6600 measurements so many people have complained about, the latest version is here:
https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
Several multi-core Ruby programs failed when run with 3.0.0-preview1 --jit
Which is why you see Python3 programs using 4 cores for spectral-norm and binary-trees and fannkuch-redux — when the corresponding Ruby program is only using one core.
https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
It’s multi-core age today. Concurrency is very important. With Ractor, along with Async Fiber, Ruby will be a real concurrent language. — Matz
We need new Ruby programs for the benchmarks game, to show that new concurrent language.
1. on the optcarrot benchmark 2. between Ruby 2.0.0 and Ruby 3.0.0
The speed difference between 2.7 and 3.0 is completely moot.
I feel the same way towards OCaml and its multicore saga as well. I figured I'll just wait for 5.0 which is due at the end of 2021 (at least) and then will start afresh there without having to do 100+ legacy code and compatibility dances, and have multicore from the get go. (Sort of like starting with Python 3 and never touching 2, I suppose.)
Back to Ruby, I always felt it was too slow as well, at least when paired with Rails anyway -- JS and Erlang/Elixir are much faster and are still dynamic.
But with 3.0 I might make a return to it. Shame that IO#select isn't supported but with async and actors that's likely not a big problem.
Here's to exciting times ahead.
So far nothing has shown JIT will make Rails any faster. TruffleRuby is gaining ground inside Shopify though.
I wish I didn't have that idea of Ruby being dead for as long as I had, because it really seems beautiful. Maybe I'll have to make Ruby my next language project.
Ruby really shines into areas: general purpose scripting (it was originally designed to be a bash replacement), and web development (because the ecosystem is very large).
As the primary language for GitHub, Stripe, Shopify, AirBNB and many others, Ruby will likely always have a vibrant niche in web world, even if it never expands far beyond that circle. And for general purpose scripting, I mean, any language you enjoy using is a good choice for writing your scripts in.
I was at the edge of giving up on programming some long time ago and Ruby drove back a lot of my passion for creating things.
Ruby 3 is yet another great release (Ractor for parallelism for example). Can't wait to see what 3.1 will bring.
ruby-install uses that by default on my Mac and is failing.
This works in the interim: ruby-install -u https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.0.tar.gz ruby 3.0.0
So what's left to work on? I guess the things they're doing now: better performance, better tooling etc.
Nobody is requesting new language features for ages now. They are very rarely needed. The runtime is what needs a lot of work.
Care to explain this one? Btw Actors are basically pushing everything to an event loop, right?
It helps the developer to be more confident about its code.
> Welcome home. Things are going to be fine. Don't worry about nonsense. Just `:chill`
A beloved safety blanket that makes it easy and fun to do boring everyday tasks.
I presume a lot of the dread is really about Rails. And the rest partly hearsay of the slow performance of Ruby.
Rails is, to me, a blessing, but also a terrible framework. It helps to rapidly ship products. Just cobble some gems together in a controller or two, mix a gem or three into your models and you have a demo. A rapid Proof of Concept. But also a product that is practically unmaintainable. I've been doing Rails from its very beginning, solving this (trying to) has been my primary job for over seven years now.
And performance? Yes Ruby is slow. But the speed of the language is unmeasurable in, I daresay, the vast majority of the projects of people who tell you it is too slow.
That legacy mysql setup, this poorly evolved domain model, or that badly integrated external API is almost always the thing making it slow. The ms of Ruby handling that JSON to CSV conversion then is practically unmeasurable.
Rust is not going to speed up those 3000ms spend in that ugly SQL query. Go's multithreading is not going to solve the slow API which you call thrice per minute. And Java is not magically making the tangle of classes, jobs, callbacks, listeners and whatnot dissapear.
Make it disappear, no, but it can make it much easier to create, using Spring's ClassJobCallbackListenerTangleFactory.
Now, imagine that in the hands of someone with poor taste, or, even, just rather different taste than yours.
You shouldn't sacrifice the ergonomics of your API just for the same for performance IMHO, but there should probably be nice gains here and there.
Best of all would be if ruby code becomes good enough that you no longer need to FFI into C code, who knows, maybe ruby 3 will be the start of the `ruby only nokogiri` age :).
That said, I do think that Ruby is one of the most expressive general purpose languages, for reasons like being able to chain function calls without needing to add parentheses or some other call notation. There are surely DSLs or more obscure languages that are more expressive, but I would argue that few general/widely used languages are as expressive as Ruby, and so to answer your question if allowed to equate beauty with expressiveness, I think Ruby ranks very highly.
I never knew what objects a function could return without reading the code or trying to call it first and inspecting the response.
Then I switched to Go and Python and found those best-suited for all my needs.
Matz 2003
Swapping out ruby for golang won’t fix any of those.
I’ve worked on multiple Rails apps over the past decade, responsible for hundreds of thousands of customers and hundreds of millions in revenue, that easily rendered every page in 150-300ms. This isn’t time-to-first-byte—this is fully rendered, images and all.
Violation of irrational dogma? Certainly is.
> simply because people don't optimize at every step of the process
Sure they do.
Processor efficiency isn't always the target of optimization, often for very good reasons.
> In game engines they do, to some extent, because they have to,
Yes, because optimizing market value to production cost in that market requires optimizing use of hardware.
In lots of other markets it doesn't, and optimizing use of hardware would be an taking on a cost that isn't warranted by delivered value.
Sure, there is bloat in a great many web frame works and I too question why some blogs need JS enabled just to render static text. But if we are being honest, by far the worst offenders for web bloat is the trackers and ad partners.
Apps need to fulfill our needs. Nothing more and nothing less. Just like you buy a Nissan Leaf to fulfill your need all while knowing that Bugatti Veyron is one of the fastest cars in the world pushing above 400 km/h. Just like I use ArchiveBox written in Python and SQLite while knowing that there is Rust and RocksDB out there that can outperform Python/SQLite.
Side note: I do agree that in some cases product owners take over both user needs and developers' good judgement and turn a good product into a horrid mess but I would argue you can do that in any programming language.
Go make yourself some drip coffee on this Christmas day and take it slow! Happy holidays everyone!
On top of it, projects are often lead by managers that are mostly interested in grabbing the low hanging fruits, pack the product with poorly tested features, set unrealistic deadlines and monetize as fast as possible, and they often don't provide developers time to breathe, take a step back and do any refactoring or optimization - those are too often labelled as purely technical tasks with no business impact and pushed down the priority line.
Some of the code written two or three decades ago was much more efficient (especially given the hardware available at the time) than today's projects both because developers were aware of building software for machines with a limited amount of resources, and because the software delivery timelines were much more realistic - aggressive marketing, sales and product departments hadn't yet completely taken over the engineering departments, and while agile methodologies were supposed to mitigate these issues they've actually only shrunk even more the delivery windows and made software development more hectic and shortsighted.
30 years ago a program that would choke on a 386 would be refactored until each single but was optimized for the available resources. Today's approach is simply "just throw more RAM/CPU power" - and that's what I frankly find unacceptable.
We often (justifiably) argue that deep learning, as it's done today, is something unsustainable for the environment. I wonder if anyone has ever measured the impact of running tons of non-functional scripts on the web pages rendered every second by billions of devices around the world.
We can run full fledged games at 240 FPS and yet,
websites and apps lag
This problem is real, but addressing it in the context of Ruby is misguided.Slow websites?
It's the overall system design of the web. Running a bunch of untrusted sandboxed code, retrieved asynchronously from potentially dozens of sources?
Yeah, that's gonna be slow.
Replace all the Rails sites with assembly code running on bare metal if you like, it's not going to change anything.
Ruby on Rails is plenty fast. You can serve up static pages in a few milliseconds. If they take longer than that, it's because you're doing a bunch of work at the database layer or some other work outside of Ruby.
They certainly seem to come in waves though. It seems like the equivalent of bulking and cutting.
the other side of that is in the web, the tech stack was not at all designed for what we are trying to make it do...
add those two things together, add a dash of network latency for all the loaded resources, and you easily get what we have today...
IMO a chunk of the programming world is entering a mature stage where much more work is put in the runtime of a language on not on the language itself. End of the day, you are going to have a call from an executive asking why the hosting bills are ballooning. I've saved some of my customers literal [tens of] thousands of $$$ a month by migrating a critical chunk of their services from Ruby on Rails to Elixir's Phoenix and, on one occasion, Rust's Rocket.
Programmer ergonomy and happiness are important, don't get me wrong. But IMO we are fixating way too much on them in some languages / frameworks. Some pragmatism should be put back into the picture.
"No matter how fast or slow your language might be, there will always be some applications for which your language is fast enough and some for which it's not."
-- Mark Twain
> Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
And I like Ruby. And I hate Ruby.
We expect civil engineers to account for people, but they think about materials, planning, math, etc. Stay close to your craft or you might see it and/or your position in it evaporate.
This release looks interesting. Let's see how type annotations work out in real life and if people use them.
It wouldn't be needed if unit tests were enough as it used to be sold.
def sum(a: int, b: int) -> int: ...
Unlike Ruby and JavaScript, Python is strongly typed. You can't add a string to a number, for example. Because it's strongly typed, it's much easier to add a type system. When I first started using the type system, it felt like it was always a part of the language, they just added a syntax and a checker. It doesn't restrain me from what I would otherwise normally do in the language like TypeScript or Flow does. It's a perfect fit.