Ruby 3.0
ruby-lang.org
ruby-lang.org
Ruby is truly a gift.
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,
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.
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.
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.
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?
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.
The syntax in Python also leaves much desired (e.g. use of underscores) and most of Ruby's quirks are Perlisms such as $1.
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:
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.
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
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.
tldw; Pick tools that complement each other rather than compete with each other.
Also it's interesting that some languages like C or JavaScript make a good complement to almost anything.
Any suggestions on which practical language to complement Javascript for web dev? Also, use cases for functional programming language, is it even useful?
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.
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'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.
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.
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...
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...
Benoit (eregon) is the second author of that paper.
EDIT: surprised to learn that his group is responsible for the GraalVM and even located in Zurich (https://labs.oracle.com/pls/apex/f?p=LABS:project_details:0:...) which is not far from the place I live; it's a small world ;-)
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...
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/...
(Although they wouldn't be accepted — the option of using those widely libraries is only for pi-digits and regex-redux; and not "custom assembly".)
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.
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/...
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/...
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.
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.
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.
It helps the developer to be more confident about its code.
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?
Basically, as they call it, several different schedulers, each with its own pre-warmed thread pool.
An event loop is a step in the right direction. I am just worried that Ruby 3.0 might turn out how OCaml Multicore is turning out -- an endless saga.
> 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.
On contrary: often it encourages bad practices through "defacto" standard gems, or by making "the wrong choice" easier than "the proper design pattern". A "concern" is a simple way to turn a 800-lines controller into four 300 lines modules that amount to the same ball-of-mud, for example. (Concerns have great use-cases, but most often it is not the solution to your problem). Rails offers things like `try(:foo)` to quickly solve that equivalent of the "null-pointer"- exception, without forcing the developers to dive and in and solve the reason why it is nil, or solve it with some design pattern (adapters, null-pattern etc) either: just keep sprinkling `try()` keeps it rattling along too. Somewhat.
So, yes: lack of proper design and architecture is the real problem behind those "ball-of-mud" rails projects. But Rails' lack of training-wheels and the ease at which to make the wrong choices, really doesn't help teams aim at proper design and archicture either.
I have literally never used a fast GitLab instance. Anecdotal evidence, I am aware. I'd still venture out to claim this says something about the average speed of your average GitLab installation though.
I'm rooting for them. GitHub needs competition.
I think this is only half true. Rails certainly forces very little on you - but has lots of documentation and helping hands pushing you towards tdd - and it has fairly powerful and simple tools to help with data modeling - as long as your data can fit reasonably in the ActiveRecord pattern.
More complex subsystems can be split out into rails engines or services.
All that said,it is indeed easy, without some discipline, to roll out complected controllers and views.
But I don't think it's fair to say that rails the framework via structure or its official guides, encourages that.
Quite the opposite.
As for "try" (now for a long time largely subsumed by ruby's built in &-operator) - that can be helpful where appropriate, like with handling input,and occasionally with explicitly optional relationships and nullable values. But of course NULLs should normally be avoided, and the database should be leveraged to ensure data integrity. And rails allow you to do that.
What does "user.last_login_at == nil" mean? `NoMethodError `to_human_date` for `nil` in email.erb. "Quick! lets fix that with a `try(:last_login_at, "Never")`: if nil, it means the user never logged in.
You now, without proper thought, you introduced a business meaning to a missing value. Adding tight coupling, slowly painting yourself in a corner. How does this translate to "Could you give me a CSV with all users that never logged in"?
Maybe you did mean to assign such domain-meaning to "last_login_at == nil", but then it is far better to explicitely do this. E.g. a `NeverLoggedInUser` subclass, a method on the model `never_logged_in?` an explicit flag in the database, or maybe even a special table "inactive_users" that holds these. All depending on domain-meanings, discussions, use-cases and thought. This is always a lot more work than just throwing another `try` at the bug. Rails "rewards" the bad choice, and somewhat opposes the proper solution.
Rails makes it easy to prototype and rapidly move forward: those are good features. But often you should, instead, be forced to halt for a second. To push you towards the whiteboard. Being able to throw in a quick `try` here, or a `sort(last_logged_in: :desc)` with another `where.not(last_logged_in: nil)` there, and so on, are a blessing when quickly moving forward. But they will haunt you in the future.
Balancing that is hard, regardless of framework, but Rails' features balance towards the "moving fast" a bit too often in my liking. Esp. because it rewards that team-member who "Gets stuff done" by abusing those "quickfixes", while leaving the project with ever more technical debt etc.
Fat/smart models help - but the old/standard tools in rails (helpers and partials) INMHO is poor tooling for the "view" layer - and this just gets worse with Javascript in the mix.
That is finally being addressed - I've yet to experiment with it, but I like the idea: https://github.blog/2020-12-15-encapsulating-ruby-on-rails-v...
Another option is of course to just use rails as an api server, and do the front end in react/vue etc. Although, at that point, you might be better off just using postgraphile or hasura.
The other real problem I see in some of our projects, is developers simply not trying to learn minimal best practices (just reading a few paragraphs on rails guides...). And that leads to many awkward choices, a lot of re-inventing subsystems that already exist in rails (because developers didn't have a look before coding up a quick fix) - and few tests and poor testability. But those strike me as much more cases of people "holding it wrong" than rails being the problem.
Finally, I think there's still some issues in rails 6 with asset handling - but overall rails 6 seems like a comprehensive, solid and easy to use framework.
My idea exactly.
To stretch that analogy: Rails has guides, books and neat API documentation explaining how you should "hold it properly" (and when not to etc.). But it also lacks "notches", "crossbeams" or "ridges" that help people "hold it properly" on a daily basis.
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
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.
Actually I'm doing most of my money with Elixir and Python now. Elixir is nice except for deployment, like all the compiled languages I know. Python is much like Ruby but with weird design choices. Oh well, I guess that people coming from Python could say that the weird one is Ruby.
Want Ruby with Java like performance? Pick Groovy.
TBH, having evaluated it, I don't see a great argument for using Crystal in 2020 unless the criterion is "I want to use Crystal." Which is defensible, if that's how you want to roll, but it doesn't make for a good porting argument.
There are a couple of reports about successful ports, e.g. https://forum.crystal-lang.org/t/experience-porting-a-ruby-w....
> I don't see a great argument for using Crystal in 2020
There is still the Ruby-like syntax appreciated by many developers and Crystal has also some other interesting aspects not present in Ruby or imperative OO languages in general, e.g. union types, powerful macros (see e.g. https://github.com/sam0x17/mongo_orm/blob/master/src/mongo_o...).
And I'd also say a big one is Rails, I'm not sure of many people who use Ruby outside of Rails. But that is because they're using Rails despite it being in Ruby, not necessarily because of it, because again, they're more interested in the features that Rails provides rather than being enamored with any language feature per se.
As you wrote, I started with Ruby because of Rails and I slowly migrated all my scripts from Perl to Ruby. Ruby is the language I use for my projects, plus some Node when I have to. Everything else is too hard, life is too short to waste it wrestling with those other languages. If I had to write something very parallel I'd go with Elixir. We'll see what Ruby's Ractors will bring to us.
For example, there are benchmarks of some of the Ruby implementations here: https://pragtob.wordpress.com/2020/08/24/the-great-rubykon-b...
And here's a paper from 2016 comparing some of the Python implementations: http://kth.diva-portal.org/smash/get/diva2:912464/FULLTEXT01
Of course, performance in real world scenarios and when using larger frameworks (such as Ruby on Rails or Django) may differ from synthetic benchmarks, but it's nice that at least there's work done in creating these alternative implementations. A bit like how we have Hotspot and OpenJ9 for Java as well or even how there's glibc and musl - that way you can choose which implementation is the most suited for your needs, be it for performance reasons or others...
My advice would be to change a job and stop caring. It would be healthier in the long run...
As for the subject matter: yes, Python and Ruby are somewhat slow, which is absolutely fine for a lot of projects and in a lot of contexts. Where the slowness is problematic, they simply shouldn't be used, and if they are, it's an engineering or organizational failure. Don't blame poor decision making on the language implementation!
You can say that, but it presumes they are better than alternatives in other regards when there are options with really no disadvantages but better performance. The primary reason for using these languages appears to be that they are easy to learn when getting started (either as a new developer or a new project). But when you think that you're optimising to save a couple of months coming up to speed on tech over a lifetime of maintenance and performance benefits ... it seems lazy to me.
A lot of the love for Ruby seems to center around the widespread use of generators and the clean syntax for invoking them. And some people truly love duck typing.
For the record, I like Ruby -- but no longer work with it. I feel there are languages that picked up its slack for years now. Might come back to it now with the 3.0 release (provided Rails works with it). Actually excited to see if it's better now.
So I am not mindlessly hating. But "raving" about something is not a data point.
I agree with the general argument, except this - keep in mind that typing in Ruby is optional (and will always be).
So devs who choose not to use it, they won't suffer any downside. There are also middle grounds - typing can be added gradually or locally.
Keep in mind though, that as projects grow large, handling dynamic languages becomes more and more challenging, and adding types is a good strategy to handle that.
Dynamic typing only gets you so far. Once you get beyond a certain scale of your project (number of lines, files, modules etc.) then static typing a sanity saver.
I still love Elixir to death but the lack of static typing isn't making it favours.
I am starting to love Rust but again, I don't see it as a competition to Elixir.
What was the problem? You can code in elixir in a style where you basically get ~80% static typing using structs everywhere.
I haven't gotten a runtime type error in years.
Problem is the unwillingness of the market to move. But it's happening, I am witnessing it while I am contracting.
Maybe I am getting old but I started to be skeptical about language features and power if at the end I can't make it max all CPU cores and use async I/O everywhere.
I think we all could use a bit more pragmatism. I for one don't like Rust but I am relentlessly investing in mastering it because I do need low-level statically typed and compiled language and I still have PTSD from C/C++.
F.ex. I loved Racket. It is an amazing language and extremely well-crafted and thought out. But, call me when they have Erlang/Elixir's processes (actors) and preemptive scheduling.
I'm getting there though. Rust is an acquired taste, plus I am very much sold on its premise and love the results. The journey, not so much. But I want to have that extremely powerful tool in my toolbelt so I am muscling though the learning process.
If we're talking naked OS threads, that's not efficient or impressive though.
(I am still going to review it sometime.)
Don't forget Crystal, which is a compiled Ruby-like language with static typing and type inference.
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.
Is Microsoft Teams supposed to be the fast, efficient alternative because I don’t think so...
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.
They certainly seem to come in waves though. It seems like the equivalent of bulking and cutting.
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.
If coders write their backend in rust for "the ultimate performance", and it's shipping 20MB of javascript to query a poorly designed, poorly indexed database with no caching, they're going to get far worse performance than a ruby app querying a properly designed, cached database with indexing that doesn't have to spend 5 seconds domming the user's DOM first. Performance is a holistic problem, and anecdotally, web sites felt a lot faster during the rails era than they do right now during the JS era.
It's certainly possible that the answer is that the language you're using is fundamentally too slow - I personally have almost never experienced that - almost always I can get more out of a time investment by focusing on improving DB performance, or some problem with delivery, caching or optimizing bundles.
You should look at your personal situation and use real data to decide where to focus, but you always have to focus. "Make everything 100% efficient at all times" is completely unrealistic.
I usually run Rails on two servers for redundancy. Any features that are CPU expensive I will spin off into a separate service (I’m partial to golang.) This is all on the order of $10s of dollars a month on AWS. 90% of most products’ landscapes are CRUD, and bottlenecked on IO to the database, not expensive CPU calculations.
Stripe primarily interfaces with 3rd party payment systems. Anytime a request has dependencies outside of the database, you’re “off the Rails” and should investigate additional options.
Shopify is a great example. Last I checked, Shopify is doing great still using Rails for 90% of CRUD and are optimizing just the 10% that they see ROI from.
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!
I fully agree! But not everywhere and not at all times.
> feels good > matter of beauty
Well, that's not "matters" as in "must have", rather "nice to have" or "should have". See https://www.librarything.com/ for another example where a slow(er) app with high information density is preferred to a "nice" app (eg Apple Books "shelves" that are next to useless compared to this but sure enough, they are nice and fast).
> playing Doom Eternal the other day and it was just amazing the fluidity I got.
Well, this is where speed truly matters. The whole purpose of a game is to give you experience. Nice UX and fast graphics are a must because it's key to what the game shop is selling you.
I think you and I differ here because I really don't agree with this. Speed always matters. In fact, it is superlative, the fundamental feature on which other features must rest. I certainly won't use an app that's slow, even if it does more, because I get annoyed at the slowness.
This is the excuse typical electron developer make. But I think I disagree here. Speed matters everywhere. Just see sublime and vscode.
But then again, Electron is the best example where neither users want it nor developers particularly need it: users are fine if the UI differs across platforms and developers are OK to develop multiple native apps but PMs are not fine paying 3x or more for the product development.
They are? I'm not. I was not placed on this earth for tedium.
I can see the difference between VSCode and Sublime Text. I also don't...care. I use VSCode because everything it offers is way more useful to me than a handful of milliseconds. Wider language support, better language server support, better autocomplete and intelligent suggestions, out-of-the-box formatters and linters for the languages I care about, a really genuinely great remoting solution.
And as you obliquely sniff at: it's TypeScript, and this is powerful. "Oh hey, I don't like how this works, I'm just gonna crack its brain open and write an extension for it" is powerful, and while I used Sublime Text for quite a long time its accessibility in this regard is much weaker.
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.
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...
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.
You are not furthering your argument, you are just reasserting the status quo.
They really aren't, though. No statically typed languages which started off as such, to my knowledge, have added an Any type (casting magic notwithstanding). You must be thinking of TypeScript and other "gradually typed" languages, where it's a necessity for interop with existing code.
The rest of your comment, unfortunately, does not really put forth any coherent argument, so I would tend to weakly agree with the parent comment.
There was a real need/use case for it.
Its successor, Visual Basic, had a VARIANT type. Then VBScript was derived from that, and it was fully dynamically typed.
No, it hasn't.
The fact that there is utility to static type checking that is sometimes a net win so it is better, ceteris paribus, for a language to have it available does not “settle the discussion” about the claim that dynamic typing was pure lazy design that was never in the interest of human developers.
> 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.
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
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.