Elektrine lite

← Feed

@NicolasRinaudo@functional.cafe

2026-09-07 07:23 UTC

I never know quite where I stand on verbose type names that duplicate namespace information. For example, configuration types. Say I have one for databases, in the `db` namespace, and one for network, in the `net` namespace. Should I call them both `Config`, or `DbConfig` and `NetworkConfig`? The convention seems to be the latter, but then `db.DbConfig` is redundant, and while in the `db` namespace, I need to prefix everything with `Db` for no particular reason. And I can just locally alias them if I somehow need to use both in the same compilation unit. So I personally prefer `Config` for both, but that's going against the general convention of just about every codebase I've ever worked on, and consistency is often better than good taste...

Replies (1)

  • @trenner@mastodon.social 2026-09-07 07:59

    @NicolasRinaudo@functional.cafe it's a tooling problem I think. Many IDEs will auto-import if you use 'Config', and if you have multiple options across namespaces it's easy to get the wrong one. Redundant naming solves this, but is ugly.

    Open ##4638741