Hacker News new | ask | show | jobs
by chipdart 636 days ago
> Given the strongly typed flavour of data oriented programming, I wonder if you have any thoughts on the "proliferation of types" problem.

Not a problem.

You're just making your life needlessly hard and blaming Java for the problems you're creating for yourself.

This represents, coincidentally, the bulk of the problems pinned on Java.

Everywhere else the problem you described is a variant of an anti-pattern and code smell widely known as telescoping constructor pattern.

The problems caused by telescoping constructors have a bunch of known cures:

- builder pattern (Lombok supports this, by the way),

- the parameter object pattern (builder pattern's poor cousin)

- semantically-appropriate factory methods.

The whole reason behind domain models taking the center stage when developing a software project is that you build your whole project around a small set of types with the necessary and sufficient expressiveness to represent your problem domain.

Also, "explosion of aggregate types" can only become a problem if for some reason you don't introduce support for type conversion when introducing specialized types.