Live data from Hacker News

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

engineering-management.space

121–130 of 157 posts

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

#121
post #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?

It's not just 'anything' that objects are extended with in Ruby, they are extended with suitable methods pertaining to the domain at hand. 'seconds' is a conversion method of one type into another. You might as well ask why do objects have a 'toString' method. Because it is convenient.

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

#122
I am shocked at how many situations I've been in where the engineering team has delivered a drastically over-complicated, usually micro-service-based, system. Ten engineers working for a year where I could easily see 1-2 Rails/Django devs delivering more in 2 months.

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

#123
post #34

I've tried a lot of different languages over the years including Ruby, Go, Scala, and Haskell. Ruby actually isn't too bad if you don't use Rails. Between Rails and stuff like Spring over in Java-land I've developed a strong hatred of huge frameworks :) Clojure, however, is the one language that just 'clicked' for me almost immediately. In fact, I'm pretty certain I'll be sticking to Lisps as much as possible from he…

Same here. It's really hard for me now at my day job when I have to write OO. Clojure and functional languages opened up my eyes to OO shortcomings I've been trying to work out for over twenty years. Since I started, I've always felt that there were many things not right about OO and developing using these giant frameworks with so many useless abstractions has gotten old and tiring. Most of my time is spent working around the shortcomings of OO nowadays rather than writing actual code for business purposes. Since I started with Clojure, I have little patience for the complex for complexity's sake song and dance of OO. I'm trying to go full time with Clojure. I'm shocked that the author couldn't find Clojure programmers. Must not have offered remote work.

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

#124
post #104

Earlier quoted context omitted.

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…

Awesome, the form pattern is a useful one. My coworker and I were just talking about how frustrating it was to have validations coupled so tightly to the models and this would have helped a lot. Thanks!

I guess the idea is that you don't need to only use what Rails provides you, and you're free to bake in your own Ruby as you see fit. Rails is just Ruby, after all, and its modular enough at its core to be extensible for all sorts of applications. You just might have to do some digging to get your Ruby code Rails-friendly, such as using POROs alongside a form builder requires you to include ActiveModel::Naming

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

#125
post #94

Earlier quoted context omitted.

to me lisp is its own problem, its value is that it gives you too much it becomes anti social. Society likes ignorance and delegation, lisps gives you the ability to have everything into one atom and mold it as you need it. But that's only useful for 1) people with that kind of mindset 2) hard problems that fall off mainstream/commercial support

Like Autolisp? Autocad (and its clones) of software used by zillions of designer, architects, ... extened by zillions of Lisp programs.

Is autolisp code lispy ? The few that I remember felt like qbasic in parens.

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

#126

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.

Yes - Ruby makes it easy. I'm run into the downside, though, that Ruby isn't optimized for immutable operations - tons of object instances created. I've needed to 'pythonize' my Ruby code in the worst cases - using mutable functions to dramatically reduce memory usage.

Can you say more about this Pythonisation process? How is Python any better at immutable operations? Ruby and Python are both OO languages which can be used in a procedural style. Hell, you can write a whole app in Ruby without creating a single class if you so choose.

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

#127
post #20

Earlier quoted context omitted.

It's because we don't like or approve of rails. It doesn't make business sense to us (us being a completely anecdotal group of young developers I'm friends with). There are other solutions that provide sufficiently more developer speed and safety, while also providing much better performance than any rails application. Edit: I guess I just hang out with like minded people, but our biases shouldn't negate the fact tha…

What other solutions are you youngsters using then? Elixir/Phoenix? Django/Python? Node? Haskell?

php.

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

#128
post #97

Earlier quoted context omitted.

Except if you're using immutable data, pure functions and explicit state there's a lot less room for OO which (as presented by ruby, java etc) involves mutable data accessed/changed via methods that conceal their state.

Nothing in the concept of OO enforces mutability. The paradigm doesn't enforce anything at all there. You want immutable objects that never changes once created? Fine, go for it.

Sure, you can simulate immutability in Ruby or Python but it's not real immutability. It's just shallow freezing. The real point, however, is that immutability is not idiomatic in OOP languages. Objects are intended to store state and have it modified. It's not what a language can be made to do that matters. It's what is idiomatic.

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

#129
post #104

Earlier quoted context omitted.

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…

Awesome, the form pattern is a useful one. My coworker and I were just talking about how frustrating it was to have validations coupled so tightly to the models and this would have helped a lot. Thanks!

Yes, this is the BIG problem I see with Rails yet you don't hear many developers complaining about it. Django and Laravel seem to treat validation separately from the model and so does Node.js. Why is Rails so rigid about this? Although I generally like Rails this the single potential show-stopper for me.

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

#130

Years of Clojure has made me a dramatically better Rails programmer. The biggest change for me is that I now treat ActiveRecord models as gloried hashes with easy-access to a namespace of related functions (ie. methods) that operate on all manner of underspecified partial data, rather than traditional OOP-style objects with sophisticated invariants. I'm also very careful to strictly separate reads from writes, and to…

Have you tried Elixir/Phoenix?
Post reply on HN