Live data from Hacker News

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

engineering-management.space

81–90 of 157 posts

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

#81
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.

This codebase is a pleasure to read. Thank you for the recommendation :)

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

#82
post #57

This might be a stupid question and a tangent, but what does he mean by: "don’t use raw strings as constants"

Probably saying something like

  public String getDescription() {
    return “some constant”;
  }
Versus

  public String getDescription() {
    return FOO_DESCRIPTION;
  }
it’s a fairly weak example but you get the idea.

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

#83
post #57

This might be a stupid question and a tangent, but what does he mean by: "don’t use raw strings as constants"

I really can't tell, but if I were to guess it would be the difference between something like `User.where(thing: 'foo')` and something like `Foo = 'foo'; User.where(thing: Foo)`

So you can refactor/find things that use Foo easier than 'foo'. You would probably get editor support for the constant "Foo" and not for the string "foo".

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

#84
post #3

In the "things learned from Ruby" section: Focus on strong object oriented programming What I've learned from Ruby is to favor functional programming concepts - minimize side effects, isolate state mutation, etc. Ruby is definitely OO, but when my Ruby code is more functional it's less buggy, easier to understand and move around, and generally less convoluted.

Like Gary Bernhardt's notion of a "Functional Core, Imperative Shell" — https://www.destroyallsoftware.com/screencasts/catalog/funct...

I watched that video in my earlier 20s and it changed how I wrote code.

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

#85

Earlier quoted context omitted.

I'm agree with you as well except the Rails point. I have used and deploy Go/Elixir/Clojure to some certain success. One thing I feel is that no code is as beautiful as Ruby code to my own eye. What make Rails bad in your opinion? Is its performance? I think Rails is just a framework with many utility/helper to help you out.

I think there's a valid case to be made that Spring and the rails auto-loader are pretty annoying/stupid in larger projects (or anytime you're going against the grain). Every framework has its downsides. Personally I think rails is nice (I am very productive with it).

This is a fair point.

Yes, I come into lots of issue with Spring autoloader to the point I have a zsh alias call `kill_rails` to make sure it kills all the rails and spring instances :(.

That's being said, Spring is an external tool to help solve the slowness of booting up Rails app. I have work in Java/Python and they are slow to bootup too just depend on how big the project is.

Tool like: https://github.com/Shopify/bootsnap help to speed up this as well.

Other option to look at: https://github.com/danielpclark/faster_path

These solves the issue of scanning path, address slowness in a different way compare to preload mechanism of Spring.

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

#86
post #39

Earlier quoted context omitted.

It seems that some people really really love syntacticfull languages rather than uniform symbolic/functional notation.

Considering all the mainstream languages, some would argue that most people prefer them.

That would be like saying most people prefer VHS to Beta.

Systems don't always/often win because they're the best or most liked.

As with political views, most people prefer the ones they first learned. Only later in life, perhaps after becoming dissatisfied with what they know, they may risk trying something very different.

My CS education was the typical Pascal/C/C++, so it wasn't decades later until I actually learned a Lispy language. But I had read enough to know that a lot of very intelligent people had loved Lisp; surely there was something to that.

Likewise, the people who grew up on Lisp probably only grudgingly moved _down_ the ladder to use some of the more popular languages ;).

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

#87

As a hiring manager, I now look for at least two languages, and they don't need to be the tech stack we're currently using. If you're a good developer, and you know more than one language, you understand that picking up another is not an insurmountable barrier. You'll pick up our stack soon enough. What I need to know is if you can think critically, not if you already know what we plan to teach.

What else do you look for ? I recently spoke to a hiring manager and he told me that my resume made me look very “green”. It’s only after talking to me that he noticed my resume paints a bad picture.

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

#88
post #78
post #45

Earlier quoted context omitted.

Lazy enumerators don't make each individual step of the iteration any more efficient. They just let you stop the iteration partway through without traversing the entire original enumerable. Given this contrived example: a = (1..1000).lazy.select(&:even?).map{|i| i*2 }.map{|i| i + 1 }.map(&:to_s).map(&:reverse) There is no benefit from lazy if you do `a.join(",")`, since that iterates over the entire sequence. But if…

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 that's not something you can drop into a new system and do useful things with immediately (without more setup).

And with Clojure, you get all the elegance and lovely collection manipulation tools you can possibly want, much faster performance, and a huge stable pile of Java libraries (compared to Ruby).

So with Python and Clojure as one's main tools, life is quite nice.

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

#89
post #61

My career so far: Delphi -> Microsoft stack -> Rails/Ruby -> Scala -> Clojure -> Rust The stuff I remember well starts from Ruby. Good things: - Ah man code is like a book. - Lots of people were writing Ruby back then, so lots of libraries. Bad: - Deployments in general, this was before Docker, but I prefer having single binary/jar deployments - Slow - Lots of runtime errors - You need lots of tests Scala, good: - If…

> 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 Rust. I did not have so much fun writing code for a long time.

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

#90
post #19
post #18

Clojure does not have an alien syntax. As with Lisps in general, it has almost no syntax. (operator param param ...) Done.

Alien is relative. For someone who has only worked with, say, Algol derivatives, it can take some getting used to. Likely less than people often think, but it's still a shift. And it's hardly the point of the submission as a whole.

Aliens on the other hand isn't relative at all, it's objectively the best film in the franchise.
Post reply on HN