//Todo: Improve Code Quality

//Todo: Improve Code Quality

Correct Hungarian Class Names

Once upon a time, Hungarian notation was everywhere:

  • strName — a string containing a name
  • iCount — an integer representing a count
  • dblTotal — a double for a total amount
  • bIsVisible — a boolean flag for visibility
  • lstItems — a list of items

Thankfully, modern IDEs and strong typing made that obsolete. Unfortunately, we’ve resurrected the same habit in a new form — Hungarian class names.


The Modern Problem

We now write things like:

  • DocumentService: works with documents
  • AddressService: works with addresses
  • DocumentModel: a model of a document
  • AddressView: a view that shows an address

These suffixes feel helpful but usually add no real value. If AddressModel is just a plain object without a shared interface or inheritance, the “Model” label doesn’t clarify anything. It’s clutter disguised as structure.


Why It Matters

AddressService tells me almost nothing. Does it validate? Fetch? Cache? Persist? Naming it AddressRepository, AddressFactory, or AddressCache instantly conveys purpose and responsibility.

“Service” and “View” are vague. Names that describe what the class does and how it does it make code more readable, discoverable, and maintainable.


Action for This Week

Pick one class named SomethingService or SomethingModel in your codebase. Rename it to reflect its true role : Factory, Repository, Handler, Validator, or whatever fits best.

Clarity in naming is clarity in design. Start small, rename one class, and make your code self-explanatory.

Absolutely. The compiler or interpreter does not care what identifier is used. But the person who inherits the codebase will. "Clean Code" by Robert C Martin has some great guidance on this.

To view or add a comment, sign in

More articles by David Strickland

  • 4 Questions ChatGpt thinks we need to answer

    Got to pontificating with Chatgpt this evening and ended up with an unexpected result. Me: The ability to accept moral…

  • //Todo: Write Code you can Live With

    "For Now" Often Means Forever: The Hidden Cost of Half-Done Transitions One of the hardest truths I’ve learned in my…

    1 Comment
  • //Todo: Improve Code Quality

    Clean Your Code: One Using at a Time Every using statement tells a story. It says, this class knows something about…

    1 Comment
  • //Todo: Improve Code Quality

    Eliminate Nulls — Shrink Your Models In database design, null values have always been a red flag — a clear sign that…

  • //Todo: Improve Code Quality

    Make Your Dependencies Obvious One of the hallmarks of maintainable code is clarity, not just in what it does, but in…

    1 Comment
  • //Todo: Improve Code Quality

    Update an Outdated Reference Today Many codebases live in quiet fear. A single dependency update feels risky.

  • //Todo: Improve Code Quality

    Adopt a Linter and Commit to Consistency Every developer has opinions about formatting, naming, and code style. Tabs or…

  • //Todo: Improve Code Quality

    Add Interfaces and then actually Use Them A key principle of clean architecture is program to an abstraction, not an…

  • //Todo: Improve Code Quality

    Isolate a Dependency with a Facade According to the Single Responsibility Principle (SRP), a class should have one…

  • //Todo: Improve Code Quality

    Set a personal max limit on class and method size. Too often I hear developers say, “I can’t clean up the tech debt…

    2 Comments

Explore content categories