Single-Dialect Code

What about a codebase that feels the same everywhere?

any 3+ years Scala codebase I’ve seen so far has been a terrible hodge-podge of dialects (one per contributor over time). (source)

I’ve seen a few code bases where I could feel who originally wrote which code, just by looking at the code. This individual style does not only consists of formatting* and naming, but also exists on an architectual level like the used idioms, function signature design, when to split concerns into individual functions, data- vs objectorientation, concept abstraction, use of library functionality and more. (*assuming it’s not enforced)

Each set of these properties could be classified as a dialect. Dialects are naturally ephemeral and fuzzy, change by coder, time of day, experience, distraction level, problem at hand, etc.

Maintaining or integrating code with different dialects probably creates some kind of mental overhead due to the impedance mismatch. I wonder how much of a real-world impact this really has, but I feel that it’s greater than zero especially with long lived codebases. I will collect instances of this problem here when I stumble upon them in the future.

Could we somehow get rid of dialects and make a codebase (or a language) that just allows for one single dialect? Some languages have this ‚one single way of doing a thing‚, but in my opinion this covers only pretty low level architectural choices.

With the advent of LLMs it may be possible and worth exploring: Have a LLM based linter that is able to explain how and why code is not idiomatic, and even suggest improvements.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert