Ask HN: Any alternative to Java (OOP) which has the same ecosystem?
I've professionally programmed in Java, Python, Haskell and JavaScript.
Of these, I've found Java to be easiest when dealing with large code bases ( > 100,000 LOC ). It is complied, has a strong type system, very good standard library, good & mature build systems, and excellent tooling with IDEs like IntelliJ.
However, I am not a fan to object oriented programming. I suppose I am looking for a C / Python / Haskell like language with the same ecosystem / popularity as Java.
I tried Go, but it looks like Go is built to programmed on internet connected devices only. With Java, dependencies can even be downloaded and put as Jars.
42 comments
[ 3.0 ms ] story [ 102 ms ] thread- Several patterns introduces a lot of boiler code.
- It's harder to visualize a OO codebase than a pure FP codebase like Haskell.
- Frameworks like Spring / Jakarta are overly complex.
But I don't mind OO, it's just that after using Haskell and Python, it just feels a little messy.
There is nothing about OO does enforce higher memory usage compared to other patterns. In fact it might be better than functional programming, which relies on a lot of closures (which all need heap allocations). The fact that Java does not support value types will require more memory for a certain set of applications than e.g. Go or C# - but that is barely related to OO.
> - It's harder to visualize a OO codebase than a pure FP codebase like Haskell.
This will be rather subjective. Be sure to have a common understanding with your team about it if you are not the only contributor to a codebase.
Many OO languages offer dynamic/virtual dispatch of methods as a primary (and sometimes only) way to do polymorphism. This comes at a non-zero memory cost, because each object needs some additional runtime type information.
> In fact it might be better than functional programming, which relies on a lot of closures (which all need heap allocations)
Closures do not need heap allocations. Rust has closures and allocates them on the stack (unless you deliberately box them). I don't know Haskell, but I believe it could do the same.
C# has objects, structs, primitives. Sugar to get rid of boiler plate. And increasingly a lot of functional features.
What is the experience of developing on .NET on Linux or Mac?
Does it even work?
For IDE use Rider or VSCode
I have heard about Rider, but in the context of APL, and not F#.
Can you tell me if I can develop for .NET on Linux and then deploy the app on the web or on Linux desktop?
CtoJ: https://tech.novosoft-us.com/product_c2j.jsp
GCC Bridge: https://github.com/bedatadriven/renjin/tree/master/tools/gcc...
Cibyl (outdated): https://github.com/SimonKagstrom/cibyl
Not sure if Groovy is what you want: https://groovy-lang.org/differences.html
You can go so far as to prohibited extending classes using static analysis tooling.
Or sealed if the usecase applies.
Scala borrows a lot from Haskell and Python too. Definitely a JVM and integrates with Java well.
I coded in Java since 2002, now in Scala since 2013, and I am learning Haskell as well.
What's wrong with "go mod vendor" ?
From golangbyexample.com:
"It will create a vendor directory inside your project directory. The vendor directory will have all the direct and indirect dependencies downloaded. You can also check in the vendor directory to your VCS (Version Control System). This becomes useful in the sense that none of the dependency needs to be downloaded at run time as it is already present in the vendor folder checked into VCS."
A less vibrant ecosystem, but far stronger on the functional and string typing, take a look at OCaml (others have suggested good alternatives like F# or Scala if you want to leverage the existing VM-based ecosystems).
You can make it strongly typed with type hints and MyPy type checking, or you can avoid it all together.
You can do imperative programming, or functional.
And best part, you can do all of that in one code base depending on what the use case is. And the debugger is great.
It's a good choice if you don't expect to pull in modern Python libraries, just do basic scripting and pull in JARs when needed instead.