Skip to content

Instantly share code, notes, and snippets.

Pervasive Package Problems

An approach that is often used for organising our classes into packages is to create a package per stereotype.

With a package for all of our service classes, a package for all our repository classes, a package for our clients, a package for all our configuration classes, etc.

I think this approach makes intuitive sense, which is why we see it so often. However, I think it leads to undesirable outcomes for our codebase.

Say we have an application with two components; Foo and Bar. Here’s what a package per stereotype structure looks like:

api-endpoint: https;//wise.com/careers
country-names:
no: Norway
nz: New Zealand
kafka-topic: Interesting.Topic