Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
If you have a lot of instanceof checks and casting, then you should consider having your base class (Term) define all methods that all sub classes implement, which by default do nothing and/or return sensible values (which could be an Optional or a "null object"). For example, Jackson does this for its JSON tree structure and its base class JsonNode.
Or just go full on functional. There are several JVM based Haskell languages, e.g. Eta and Frege.
Another option could be to check out Kotlin. It's a JVM language that while still object-oriented has may functional syntax features.
Or just go full on functional. There are several JVM based Haskell languages, e.g. Eta and Frege.