Live data from Hacker News

Don't write Rust like it's Java (2023)

jgayfer.com

41–45 of 45 posts

Re: Don't write Rust like it's Java (2023)

#42
post #16

Earlier quoted context omitted.

Hasn't the use of behaviourless value objects (essentially structs) been commonplace in both the JVM and the related .NET-world for the better part of a decade now, maybe more?

From my experience, "anemic DDD inspired architecture" is fairly common in enterprise .NET codebases. These do heavily use all kinds of value object, DTO and DTO-like objects with the logic that processes them being defined separately. Unfortunately, most of them still suffer from premature and very unnecessary abstraction bloat. Luckily, the trend for terseness and minimalism is gaining more and more momentum each y…

I'm not familiar with the .NET ecosystem at all, but in general I think the problem with the "just write everything in the framework's layer" for most companies is your whole application becomes tightly coupled to that framework, and more specifically that version of the framework. That's likely a much bigger problem for monoliths which I would imagine is still the majority of apps, even in 2024.

Most developers likely don't stick around long enough to see the pains of doing major upgrades on large codebases.

I've been using a layered architecture with great success for a large fintech application. We've even migrated from one web framework to a completely dissimilar web framework trivially as the majority of our code in the business layer needed no changes.

Re: Don't write Rust like it's Java (2023)

#44
post #21

Earlier quoted context omitted.

Even in Java, the interfaces everywhere style was never great. Somehow Java got picked up by Architecture Astronauts that love writing enterprise pattern layer cake. Nothing in the language makes this style necessary, it's perfectly possible to write short and sweet code, and yet the Java culture got infected with this overcomplicate everything culture.

I kinda prefer the interface everywhere to the inheritance everywhere crowd. But I've mostly used/debugged groovy code so maybe I'm partial.

[deleted]

Re: Don't write Rust like it's Java (2023)

#45

I feel like this axiom is true in general. Don't write [insert lang here] like it's Java. I've seen this in Ruby code bases, TS code bases, even Erlang code bases (using gen servers like an OO primative.)

That's funny. Writing Ruby with Sorbet works fairly well if you just pretend it's Java most of the time. Have to keep in mind that the static typechecking is broken, so can't go refactoring wildly and get it on the first go. Limiting use of metaprogramming to what amounts to being annotations is also friendly to coworkers. Of course what's being picked upon is a specific kind of Java code . It's better to be specific…

I feel like when people write Ruby like its Java as opposed to say, smalltalk, a lot of what makes ruby wonderful is lost.
Post reply on HN