News for hackers. Stuff that matters.
Re:Cruz: I Never Put Java in My Resume No Matter How Much Ex... by PaulHoule on Wednesday October 05, 2022 @01:38PM (#33098702)
Bogus blog.

Might have been true back in the JDK 6 or JDK 7 age but from JDK 8 to JDK 19 it has become a better functional programming language than most functional programming languages.

If the author likes he can keep coding in C++ where strcpy is Turing complete.

Re:Cruz: I Never Put Java in My Resume No Matter How Much Ex... by dunefox on Wednesday October 05, 2022 @03:20PM (#33100110)
> it has become a better functional programming language than most functional programming languages.

Bogus comment. This is very far from the truth. Lambdas and streams don't make a functional language.

Re:Cruz: I Never Put Java in My Resume No Matter How Much Ex... by hbrn on Wednesday October 05, 2022 @03:16PM (#33100046)
Now we just need to wait a couple more decades till functional Java is adopted.

So far I'm still seeing complex class hierarchies with deep inheritance, dependency injection and unit tests produced by ex-Java developers for something that can be solved with a couple of simple methods in Python.

I noticed that complexity makes Java folks proud. Conversely, simplicity makes Python folks proud.

Seeing Java on a resume is not yet a reason not to hire for me. But it's a signal that indicates greater risks.

Re:Cruz: I Never Put Java in My Resume No Matter How Much Ex... by icedchai on Wednesday October 05, 2022 @04:02PM (#33100595)
Odd. I typically see more unit tests on Python projects due to the lack of static typing. I'd take a large Java project over a large Python project any day.
Re:Cruz: I Never Put Java in My Resume No Matter How Much Ex... by Zardoz84 on Wednesday October 05, 2022 @04:08PM (#33100665)
Funny... I have a discussion with a teammate, where he thinks that our internal API should not return streams. I stead we must return Lists, Sets or Maps
Re:Cruz: I Never Put Java in My Resume No Matter How Much Ex... by PaulHoule on Wednesday October 05, 2022 @04:17PM (#33100790)
I think lambdas and everything around them except the streams API is pretty good, but the streams API is pants. It adds a lot of overhead but doesn’t take advantage of the global view of the processing pipeline it has.

I wrote my own competitor at

http://gihub.com/paulhoule/pidove/

which looks lispy because it uses static imports for everything. I started on a fluent syntax version but wound up working on another project. The odd thing is that I wound up studying the streams API in enough detail that I got over many of the complaints I had about it. If I was going to put more work into pidove it would be developing it to make the most of the Collections API so if you, say, map a list, it returns a list that lets you get(7) to only map that item.

Re:Cruz: I Never Put Java in My Resume No Matter How Much Ex... by PaulHoule on Wednesday October 05, 2022 @03:38PM (#33100325)
So you think unit tests are a bad idea?
Re:Cruz: I Never Put Java in My Resume No Matter How Much Ex... by hbrn on Wednesday October 05, 2022 @03:57PM (#33100530)
As a matter of fact I do think unit tests generally cause more harm than good.

They are great for libraries with well defined and slowly evolving interfaces. But unless you're doing open-source, you will rarely work on those.

Write tests. Not too many. Mostly integration.

https://kentcdodds.com/blog/write-tests

Re:Cruz: I Never Put Java in My Resume No Matter How Much Ex... by quantified on Wednesday October 05, 2022 @04:12PM (#33100707)
Any internal library used by multiple other teams has friction on its evolution and refactoring, and don't change interfaces all that much.

Perhaps this turns into another round of clarifying what the discussion participants deem "unit" vs "integration".

Re:Cruz: I Never Put Java in My Resume No Matter How Much Ex... by hbrn on Wednesday October 05, 2022 @04:20PM (#33100822)
Every company is different, but my preference is to break into teams by domain/network boundary. In this case sharing libraries is extremely rare. Teams could easily be on different tech stacks.

Edit: my experience is mostly between seed - series B startups. If you're Google, then of course you're going to have a ton of internal libraries. But I'd put it in the same category as open source.

Re:Cruz: I Never Put Java in My Resume No Matter How Much Ex... by PaulHoule on Wednesday October 05, 2022 @04:21PM (#33100828)
One role of tests is documentation. If you have a large number of examples of how to use an API you know they keep working. Any code snippet used for documentation should have a corresponding test because otherwise the docs will probably break someday. It’s the best case for ‘literate programming’ that there is.
Re:Cruz: I Never Put Java in My Resume No Matter How Much Ex... by whateveracct on Wednesday October 05, 2022 @03:33PM (#33100264)
What functional languages is it better than? I'll give you a list of all the FP languages off the top of my head that people use to build stuff:

- Haskell

- Scala

- Kotlin (not FP but better than Java at it)

- Clojure

- Scheme

- Common Lisp

- Erlang

- Elixer

- PureScript

- Elm

- TypeScript (not even FP but moreso than Java lol)

I really doubt you can say it's clearly better than even one.

Re:Cruz: I Never Put Java in My Resume No Matter How Much Ex... by PaulHoule on Wednesday October 05, 2022 @03:48PM (#33100430)
I think Scala is crap.

I have frequently seen Scala programs that allegedly use monads for error handling that actually blast right past errors with no handling. That use some kind of snake oil concurrency that never gets the same answer twice (race conditions) but also uses just 2.5 cores on a 8 core machine.

(In general few people appreciate the wide range of of concurrency primitives that Java offers. People want to believe that you can write correct and performant concurrent code with a small set of primitives but it just isn’t true.)

Books on Scala try to seduce you with examples that look concise but they are all structurally unstable and get an order of magnitude more complex when you change anything. (I’d contrast that to Cold Fusion, PHP, and other poorly regarded languages where I’ve sometimes met a correct program.)

I am also unimpressed w/ Kotlin. It beats the pants off JDK 7 but not JDK 19 particularly if you use an IDE that does static analysis.

Re:Cruz: I Never Put Java in My Resume No Matter How Much Ex... by dunefox on Thursday October 06, 2022 @03:09PM (#33112624)
F# as well.
Re:Cruz: I Never Put Java in My Resume No Matter How Much Ex... by programmer_dude on Wednesday October 05, 2022 @03:25PM (#33100170)
> it has become a better functional programming language than most functional programming languages.

LOL

Re:Cruz: I Never Put Java in My Resume No Matter How Much Ex... by leetcrew on Wednesday October 05, 2022 @03:53PM (#33100486)
> Might have been true back in the JDK 6 or JDK 7 age but from JDK 8 to JDK 19 it has become a better functional programming language than most functional programming languages.

uhh, let me know when they add the ability to define a standalone function that exists outside of a class.

> If the author likes he can keep coding in C++ where strcpy is Turing complete.

c++ certainly has its warts. but having worked with both professionally, I find java to be by far the more frustrating of the two.

some random gripes off the top of my head:

I can't invoke a no-args constructor like this: `MyType var;`

I can't do something like `public MyType() = delete` to make my class nonconstructable (which would at least partially help with the "no standalone functions" issue).

there is no notion of tuple in the standard library. I have to define a new class (or abuse Map.Entry) every time I want to return more than one value from a method.

I can't construct a collection (or POD) type like this: `MyCollection c = { a, b, c };`. Yes, I can do stuff like `List<T> list = Arrays.asList(a, b, c)`, but then I have an immutable array enclosed by a mutable list, where any attempt to modify it is a runtime error?!

in my experience, java somehow manages to be more verbose and less ergonomic than c++, which is really saying something.

disclaimer: I have not worked much with JDK versions >11, so maybe they've addressed some of above.

Re:Cruz: I Never Put Java in My Resume No Matter How Much Ex... by PaulHoule on Wednesday October 05, 2022 @04:11PM (#33100699)
Frankly I don’t have problem with classes that have nothing but static methods, you can write a private constructor if you are so concerned somebody is going to construct an instance of the class. (Somehow that’s a problem that really concerns C++ programmers. They keep saying RAII over and over again as if it was a magic talisman that made their code reliable)

People who write functional libraries in Java frequently write Pair<A,B> and sometimes Triple<A,B,C> but they independently discover there is no point in declaring a Tuple27. Recovering LISP programmers point out the ‘nameless tuple’ problem is one of the many reasons the idea of LISP is better than the reality. In modern Java you can write a record if you need to bundle together a few results.