"Just use maps" in Java?

With all due respect, The habit of “We just use maps!" is too easily abused, e.g. people try to keep using “maps of vectors of maps” to a extend where it doesn’t make sense anymore, e.g. places where it is better to use a graph structure like datascript, asami, etc.

I would agree that it’s best to keep the maps shallow, but I think that the depth of them is not really what’s being discussed, but rather the uniformity of accessing/operating on them, vs the specificity of Java classes for every domain object.

In some situations, deeply nested maps do map well to the domain, and though they’re a bit more painful to use, they can work quite well (with judicious use of Specter, Meander, or similar)

1 Like

I am inviting you guys to continue this exciting discussion on another thread It is possible to “Just use maps” in Java!

1 Like

This article summarises my understanding about how to apply Data-Oriented programming in Java.

1 Like

For interested readers, this is a draft on the possible syntax for with: amber-docs/eg-drafts/reconstruction-records-and-classes.md at master · openjdk/amber-docs · GitHub

2 Likes

It’s interesting to see how many complex additions to the language we need to benefit from something as simple as assoc in a language where data is represented with generic immutable maps!

Can you do that in Clojure, where the code is data?

I wouldn’t say that in Clojure “code is data”.
I would day “code is represented with data structures”

I think that’s what I thought when I first encountered Lisp. Everything is a list and it could be a list of either code or data but what about when code changes code? Has the code being changed flipped to be data? Only if it is no longer executable.

Programming is data processing, so a program must define the (initial state) process. The code/process is a special kind of data about how to do something: imperative rather than declarative data. It can clearly move between two states but it’s “made of the same stuff”, like ice or liquid water.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.