←back to thread

257 points pmig | 6 comments | | HN request time: 0.204s | source | bottom
1. heluser ◴[] No.43096311[source]
I long for a deep article about the same topic. The real, core difference between Java and Go for backend is declarative vs imperative coding styles.

This one, as typical for such articles, repeats typical secondary talking points and even makes similar mistakes. For example it conflates the concept of DI with specifics of implementation in some frameworks.

Yes there are older Java frameworks that do runtime magic. But both new Java apps and well designed Go services use compile time dependency injection as a way of achieving dependency inversion.

replies(2): >>43096495 #>>43098968 #
2. jayceedenton ◴[] No.43096495[source]
Which of these languages is declarative? Aren't they both imperative?
replies(2): >>43096564 #>>43098429 #
3. CharlieDigital ◴[] No.43096564[source]
Maybe Java when using decorators?
4. heluser ◴[] No.43098429[source]
Java 8+ is basically a declarative language. They even officially started departing from Object Oriented Programming towards Data Oriented Programming ( article by their chief architect https://www.infoq.com/articles/data-oriented-programming-jav... ). Unfortunately, most of the comparison articles come from people who still code POJOs with setters, use for loops and overall rely on mutable and unsafe code.

And using Pike’s own words “go is unapologetically imperative”.

replies(1): >>43099677 #
5. golly_ned ◴[] No.43098968[source]
Write that article then. Don’t badmouth the writer’s firsthand (evidently not secondary) experience over the course of a year since they didn’t express your idiosyncratic view that Java is a Declarative Language, which is very different from a data-centric language, which itself is a term from the clojure/scala enthusiasm about functional programming around Java 8.
6. idoubtit ◴[] No.43099677{3}[source]
> Java 8+ is basically a declarative language.

That's a bold claim!

The article you link to does not contain the word "declarative". It simply states that modern Java allows more of Data-Oriented Programming, meaning a emphasis on pure data structures (records) and more expressive types (algebraic types). It doesn't say much about the code that deals with this data, which is of course procedural.

Apart from SQL which is not generic, I've toyed with two declarative languages, and I can't see much similarities with Java. https://en.wikipedia.org/wiki/List_of_programming_languages_...