Get the latest tech news
Go and Java: Rethinking Type Safety for the Pragmatic Age
premise I want to explore where mainstream programming languages are headed, using Java and Go as my primary subjects. java is underrated The reason I say Java is underrated is because it is oddly both easy to learn and its type system is strong enough to make many incorrect states irrepresentable.[1] It has product types and sum types, and makes managing state explicit and easy enough.[2] Java is very “simple” precisely due to its verbosity.
Some people manage to abuse inheritance, etc., to make very complex, hard-to-process Java, but I argue this is due to ideology and that it is easier to do things in a simpler, more correct way. While Java’s enums and classes aren’t pure algebraic data types in the formal sense, they provide workable approximations that serve similar purposes in practice. Modern Java features like records (pure product types) and sealed classes (constrained inheritance hierarchies) bring us closer to true ADTs, though gaps remain.
Or read this on Hacker News