Hacker News new | ask | show | jobs
by cygned 1735 days ago
The aspects mentioned (Spring, DI containers, ...) are tool on top, though. If we just look at the language, I'd argue Java is boring - which is a good thing for certain types of applications. In languages like JavaScript, you have a number of ways to do things with all kinds of different syntaxes. In Java, there are fewer, but well understood options, that sometimes require more and sometimes require less actual code to achieve the same thing. This is highly subjective, if course.
2 comments

Ok, I understand your meaning, and I agree that gratuitous syntax sugar is a bummer; however, I've never found it to be particularly problematic. On the other hand, I have found a culture of magic/cleverness and a magical ecosystem to be problematic--this is one of my bigger grievances with Python after a decade and a half of experience.
I am leading a transition from TypeScript to Java + Spring Boot and comparing those side-by-side, Java is significantly easier to follow. In TypeScript, we have a (from my point of view) too complex type system and features like destructuring and spreading, that sound smart but actually make it difficult to understand if you are not the author of the piece in question.

What do you find magical in terms of Python in particular?

I can't speak to TS. I'm not sure what "spreading" even refers to, although I've never had a problem with destructuring even though my daily driver languages don't support it.

> What do you find magical in terms of Python in particular?

Lots of libraries are magical. SQLAlchemy, most of the data science libraries, even the standard library returns different types based on the values of inputs (e.g., open() returns a binary file or a text file depending on the string you pass into it). Additionally, people often go crazy with various dynamic typing features (rather than refactoring into a common interface, people will do a bunch of `if isinstance(...)`es all over the place. Similarly people tend to go crazy with metaclasses and so on. I could go on and on.

> I'm not sure what "spreading" even refers to

We have code like (stupid example)

    something.map( {a, b, ...rest} => ({ ...rest, ...a, ...[b, c, d]}))
I know what it does and how it works, but I argue that's hard to understand if you haven't written it and know the context.

My Python experience is limited to only a handful of projects, but I looked into meta classes at the beginning of learning Python and that was some crazy stuff.

I honestly don't see how destructuring and spreading is harder to understand than things like DI and annotations in Spring. I do agree about the TypeScript type system being too complex, I wish simpler types like Rescript won outside of the "typing legacy JS" use case.
> sometimes require less actual code to achieve the same thing

What are some things thing you can do in Java with less code than in Javascript?