Hacker News new | past | comments | ask | show | jobs | submit login
BMG: A Production Ready Relational Algebra in Ruby (github.com/enspirit)
80 points by iovrthoughtthis on July 14, 2020 | hide | past | favorite | 20 comments

This is great looking! I don't use Ruby, but it's good to see libraries like this. It still surprises me how few libraries implement the relational algebra. Building on proper mathematical theory that's conducive to programming languages really removes a lot of impedance mismatch and leaky abstractions over ORM's.

The Rails ORM (ActiveRecord) is built atop of a relational algebra gem (arel, which was eventually pulled into the AR library). I'm pretty sure the arel functions are considered private API, so it's not necessarily best practice, but you have the option to call those functions directly when you find the ORM lacking and don't want to pass around raw SQL.

AFAIK Arel is not a real algreba, since it does not really allow composing relations the way we want.

More info here: http://www.try-alf.org/blog/2013-10-21-relations-as-first-cl...

Honest question: does it make sense to learn Ruby in 2020, with the hopes to actually have a job with it for the next 5 years? I want to leave JS world for something different, and I’m evaluating Elixir, Python and even PHP. What I’m looking to work on are basically SaaS sites, nothing too crazy. Would appreciate any thoughts.

Don’t bother with a small selection of random opinions that may or may not have an agenda that doesn’t align with yours. Simply go to the monthly who’s hiring posts and compare Ruby to Python etc. for the technologies you are considering. You will need to understand that Rails is actually the keyword you are looking for rather that Ruby and I don’t know enough about the Python ecosystem to help you but I think maybe Django is the major player in that space.

My personal experience is that the ruby job market is quite strong. For context, I've been a ruby developer (among other languages) for 5+ years.

Have you tried looking for some ruby work?

Depends on the industries and locales you work in. Ruby still has a strong contingent in SF, though I hear it’s somewhat uncommon out in London. This is anecdotal and from fintech circles I’ve worked in.

Still very strong in NY, but everyone's looking for senior hires to do cleanup jobs to fix poorly implemented bolt-on caching schemes in ailing Rails projects.

Ruby is still a great, powerful language, but in the last couple of years I've started to notice that it isn't getting the tooling love that it used to from the community. I'd still work in it for the right job, just like most any other language. Because tools are tools.

Language shouldn't get as much emphasis as it does.

6 yr ruby dev here. There’s still a pretty good job market for ruby depending on your location/willingness to go remote. I have noticed that more ruby shops are tending to build new services in languages like Elixir and Go, usually out of scaling necessity. It does seem like fewer new apps are being built on ruby these days, but’s that’s largely my personal observation, and the data may say otherwise.

I have explored the Node ecosystem/frameworks and Python/Django, but I still wouldn't trade Rails for anything.

Ruby's a bit of a niche, but there are a fair number of big-name companies built on it (Github, Basecamp, etc), certainly not bad to have in your arsenal.

Note: Ruby is the programming language, but in the SaaS world that's usually coupled with Rails (the MVC architecture) and ActiveRecord (the database/SQL layer).

Out of the choices that you listed, python is the best long term bet imo, especially for its overall practical use outside of SaaS products.

If you are using Java or a JVM language (e.g. Ruby, Clojure, etc.) it may be worth checking out Apache Calcite https://calcite.apache.org/.

Is there any such library for Go? I was searching one for simple algebra stuff while back and only prominent math library for Go seems to be gonum[1] which for lack of better term seemed 'too large' for my purpose.

I didn't look properly or is Go's math scene not that great?


Note that this library implements relational algebra, a specific set of set-theoretical operations on an object called a relation — not general-purpose mathematical algebra.

Neat! One obvious question: Is this intended to integrate with Rails?

(lead dev here). Not intended, as I don't use Rails myself. But I would of course support every PR making Bmg compatible/great with it.

If you use Sequel, it should work fine


Just like any gem. You can create models without inheriting from ActiveRecord.

Intended - I have no idea.

Possible - Absolutely.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact