Live data from Hacker News

From Rails to Clojure, Then to Java, Then Back to Rails

engineering-management.space

101–110 of 157 posts

Re: From Rails to Clojure, Then to Java, Then Back to Rails

#101
post #33

Earlier quoted context omitted.

Ruby also suffers from top quality JITs vs what JS has. The only good option being JRuby, as far as I understand. I am not at all into Ruby. Regarding being polyglot and seniority, a possible solution is to work for consulting companies that focus on multiple stacks.

MRI has just added a JIT, I know nothing about it other than that it exists.

MJIT works by taking MRI Ruby bytecode, replacing the instructions with the original C code, and compiling an entire method using GCC/LLVM.

Because MRI Ruby is a threaded VM, it's easy to replace jumping to an instruction which dispatches to the next instruction, with jumping to some native code which dispatches to the next instruction.

Right now, AFAIK, only very basic optimizations are enabled but just removing the overhead of VM dispatch between each instruction is a huge performance improvement.

Re: From Rails to Clojure, Then to Java, Then Back to Rails

#102
post #88
post #78

Earlier quoted context omitted.

Ruby's composabilty really puts Python to shame. I can't imagine how Ruby lost out to Python.

While I much prefer writing Ruby to Python, Python is just dead simple to get real work done with. It's not elegant, but it's still so much less nasty than C++ or Java. Ruby's #1 problem, for me at least, is that your small project someday runs into a performance wall. I don't know the latest benchmarks, but last I recall Python was about 8x faster than Ruby when both are being interpreted. Yes, there's JRuby, but th…

MRI Ruby has been slightly faster than Python for about a decade and the next release of Ruby will contain a basic JIT compiler giving MRI Ruby a significant advantage over CPython.

Re: From Rails to Clojure, Then to Java, Then Back to Rails

#103
post #96
post #88

Earlier quoted context omitted.

While I much prefer writing Ruby to Python, Python is just dead simple to get real work done with. It's not elegant, but it's still so much less nasty than C++ or Java. Ruby's #1 problem, for me at least, is that your small project someday runs into a performance wall. I don't know the latest benchmarks, but last I recall Python was about 8x faster than Ruby when both are being interpreted. Yes, there's JRuby, but th…

Say what? Ruby has been faster than Python for interpreted code for years now. Granted, Python is faster for tasks like those Numpy solves, but in arbitrary execution performance, python is just slower. 8x has NEVER been true. That must have been you doing some really bad stuff in one of them but not both.

I think there was a short period about 11 years ago before the release of Ruby 1.9 where the Python VM was basically re-written to be as fast as YARV, but YARV wasn't released yet.

Re: From Rails to Clojure, Then to Java, Then Back to Rails

#104
post #71
post #65

Earlier quoted context omitted.

Really interesting comment. I've started working on a Rails project. I don't have any professional experience with Rails in particular. Can you recommend any code bases I can read that meet these criteria?

My personal favorite codebase is GitLab (thanks syste and team!) — they do a very fine job of pumping out Ruby while hanging out in the Rails ecosystem. https://gitlab.com/gitlab-org/gitlab-ce — points of interest are in lib, as well as how they organize and call service objects from app/services.

As well as services, a couple of other folders you might want in app are for decorators and form objects.

Form objects aren’t very common, but I’ve found it to be a really great patten for simplifying code. Strong params and ActiveRecord methods are fine for simple updates, but as soon as you get to something more complicated (e.g. what if you want validations to apply only for certain users?) it just becomes a mess - and you need to decide whether to have fat controllers or models.

The idea is you put all the logic for parsing params and updating records into a form object. It keeps controllers and models skinny, and can easily be tested without having to go through a controller. The reform gem provides a few helpers that make them easy:

https://github.com/trailblazer/reform/blob/master/README.md

Re: From Rails to Clojure, Then to Java, Then Back to Rails

#105
post #68
post #40

Earlier quoted context omitted.

Back in my late 20s, I got stuck on maintaining a legacy software system written in Ada95 (I was unemployed in 2008 and it was the only work I could find). When that job went away, I thought I could get a job using something more modern. However, the only job I was able to land was a new development project in Ada2005 (actually it was a port from SPARC to x64 and a partial rewrite of the same legacy application I had…

And even then, experience tells me one needs to have some luck that the HR people are even willing to listen about those side projects. Good that it worked out for you.

Yes, this is especially true at larger companies. In my case, a small company picked me up.

Re: From Rails to Clojure, Then to Java, Then Back to Rails

#106
post #93
post #89

Earlier quoted context omitted.

> Community feels like the good old Ruby days, but better I really miss that old Ruby community. It was full of that hacker spirit, everyone trying stuff, no one to crush your creativity. Then the startup hipsters took over and came up with good practices, style guides, gems you absolutely had to know to get hired, etc. It drove me away from Ruby, actually. It just wasn't fun anymore. I hope it doesn't happen with Ru…

This definitely feels my own golden age now being able to write Rust and seeing all these great people doing interesting projects and hacking things...

The ecosystem and the community is fantastic. But I have to say, Rust is a harsh mistress. Guess I need more practise.

Re: From Rails to Clojure, Then to Java, Then Back to Rails

#107

Another thing I’m getting is that the new kids won’t like rails, and it’s being harder to hire. I'm surprised by this, to me the language used would be a long way down the list when evaluating an employer.

The language an employer uses is high on my list when evaluating a potential employer. It tells me if the company has put thought into what they want to accomplish and what technologies would best serve them in accomplishing their goals vs. choosing their technology stack based on popularity, brand loyalty, or some other subjective criteria. I typically haven't found joy in working on projects where I'm using tools that don't easily support the company's goals and vision.

Re: From Rails to Clojure, Then to Java, Then Back to Rails

#108

I may sounds weird but Ruby is what make me look more into functional programming. I get done a lot with Ruby due to all method it has on Array/Object/Enumerable. The beauty of `&` is awesome and I discover that Elixir/Clojure has that and bring it to next level. I think Ruby has inspired many other language to take that path too. One of the thing about Ruby is that it optimize for happiness, which sound weird. But I…

  *> 10.seconds.from_now*
I don't understand this kind of weird "urban sprawl OOP" where classes are extended with anything.

Why is 'seconds' a method on numbers? Is there also a 'pixels' method so that I could draw a line like this:

  10.pixels.from.top_left_corner.to.southeast.using.red.stroke
If this doesn't seem like a sensible way of programming graphics, why does the 10.seconds thing get a pass?
Post reply on HN