• Solutions
    • I Can Help
      • Define
      • Educate
      • Integrate
      • Advise
    • Consultation
      • Assessments
      • Design Reviews
      • Code Inspections
      • Ongoing Support
    • Training Classes
      • Training Schedule
      • On-Site Classes
      • Online Training
      • Customized Coaching and Mob Facilitation
    • Learning Roadmap
      • Developer Essentials Training
        • Agile Analysis and Design Patterns
        • Hands-On: Extreme Programming Practices
      • Scrum Framework Developer Essentials
      • Design Pattern Developer Essentials
      • Object-Oriented Analysis and Design Patterns
      • Scrum Software Developer Essentials
      • Agile Software Developer Essentials
      • Agile Software Developer Intensives
    • Speaking
      • Beyond the Legacy Code Crisis
      • Five Developer Practices for Agile Software
      • Writing High Quality, CLEAN Code
      • Essential Scrum Developer Practices
      • Improving Your Scrum Process
      • The Agile Development Advantage
    • Testimonials
    • Clients
  • Resources
    • Blog
    • My Book: Beyond Legacy Code
    • Bibliography
    • Referral Program
    • Associates
  • Contact
    • Contact Me
    • Schedule A Call
    • About
  • Schedule A Call

Name Things Well

  1. Home
  2. Blog
  3. Name Things Well
Register Now
Or schedule a private class
Course Descriptions
  • Developer Essentials Training
    • Agile Analysis and Design Patterns
    • Hands-On: Extreme Programming Practices
  • Object-Oriented Analysis and Design Patterns
  • Scrum Software Developer Essentials
  • Agile Software Developer Essentials
  • Agile Software Developer Intensives
Follow me on Twitter:

Follow @ToBeAgile

Blog Post Categories
  • Announcements {19}
  • Articles {2}
  • Bits and Pieces {74}
  • Blogosphere {1}
  • Bonuses {2}
  • Build in Small Batches {27}
  • Collaborate {38}
  • Create CLEAN Code {34}
  • Implement the Design Last {11}
  • Integrate Continuously {30}
  • Off-Topic but Interesting {3}
  • Rants {82}
  • Refactor Legacy Code {24}
  • Say What, Why, and for Whom Before How {22}
  • Seven Strategies {38}
  • Specify Behaviors with Tests {17}
  • Write the Test First {27}
Archives
  • 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • 2022
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • 2021
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • 2020
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • 2019
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • July 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • February 2019
  • January 2019
  • 2018
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • June 2018
  • May 2018
  • April 2018
  • March 2018
  • February 2018
  • January 2018
  • 2017
  • December 2017
  • November 2017
  • October 2017
  • September 2017
  • August 2017
  • July 2017
  • June 2017
  • May 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • 2016
  • December 2016
  • November 2016
  • October 2016
  • September 2016
  • August 2016
  • July 2016
  • June 2016
  • May 2016
  • April 2016
  • March 2016
  • February 2016
  • January 2016
  • 2015
  • December 2015
  • November 2015
  • October 2015
  • September 2015
  • August 2015
  • July 2015
  • June 2015
  • May 2015
  • April 2015
  • March 2015
  • February 2015
  • January 2015
  • 2014
  • December 2014
  • November 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • May 2014
  • April 2014
  • March 2014
  • February 2014
  • January 2014
  • 2013
  • December 2013
  • November 2013
  • October 2013
  • September 2013
  • August 2013
  • July 2013
  • June 2013
  • May 2013
  • April 2013
  • March 2013
  • February 2013
  • January 2013
  • 2012
  • December 2012
  • Privacy Policy

    (c) 2025 To Be Agile

    • September 27, 2017 ( 1 comments )
    • Create CLEAN Code

    I’ve said that the five code qualities we’ve been discussing are quantifiable. That is, we can create more of them if we want. Let’s discuss how to do this.

    The one code quality I’d like to focus on is cohesion. To me, it makes the most sense and I can easily see when my code is cohesive and when it isn’t. The number one way I do this is to ask myself if I can come up with a good name for it. If I can come up with a good name for something then I’ve scoped it correctly. I’ve defined its place in the world. I’ve said what it does so its intention is clear.

    To non-software developers, the act of naming something may seem mundane or even trivial, but to professional software developers we know that the greater part of developing software is all about coming up with really good names. After all, everything gets named in code: data and behavior.

    Naming is how we imbue the system with knowledge. It’s how we communicate what we’re doing in our code to other developers. Names should be active and say plainly what the code does. I like using long names for things so I can clearly articulate what it is. In every IDE I’ve worked in in the last ten years, you just have to type the name in once and the next time you need to refer to the name it will autocomplete after a few key strokes. Today, with most compilers, names can be up to 256 characters and I like to use as many as I feel I need to so I can express the intention behind what it represents.

    Invariably I find that if I’m having trouble naming something that one or more of the code qualities are missing, especially cohesion, and that tells me to break things down into simpler entities.

    I try to include domain terms in the names I use, and I try to exclude software jargon as much as possible. I know it’s a lofty goal that I can’t fully achieve but I like to keep my code as readable as possible to non-developers.

    My wife is not a developer. She’s a filmmaker. If she can read through some code I’ve written and get a general sense of what’s going on and what it’s all about then I’m pretty satisfied it’s clear. But if she’s completely confused, I’ll take the time to rewrite the code so it’s more understandable rather than pepper it with comments.

    In fact, every time I see a what comment that describes what the code is doing, I find I can usually replace it with a method call and give that method a meaningful name. This is far more valuable than a comment. It makes the code itself expressive.

    I have been chastised before for telling programmers to “write uncommented code.” But many lines of comments in code are either a nuisance or are downright misleading, and everyone would be better off if it didn’t exist. If you want to write a lot of comments then do it with your check-ins in version control where it could be more useful to say what you did.

    One thing I find that’s interesting as a design pattern developer is that I often end up with rather generic names for things. For example, the polymorphic method in a strategy pattern might be called process and the class name may represent how the strategy is processed. Since I use design patterns a lot, I often end up with generic method names, but I’m fine with that.

    I like my methods to create observable behaviors in the system and I like to name my methods to reveal what observable behavior will happen when the method is invoked.

    I also like naming things for how I use them. I find I do this a lot when I write automated tests. Doing test first development, I think about how I’m going to call a behavior before I think about how I’m going to implement that behavior. That’s a really important, fundamental approach of good software development because it allows me to define what I want to do before I start focusing on how to do it.

    I talked a lot about encapsulation in the past and one of the ways I define encapsulation is by hiding implementation details and only revealing what a service does. This involves more than just defining method parameters and return values. The method’s name is also important. Names imply behavior and we want to imply the right behaviors with as few presuppositions on implementation details as possible. In other words, we want to name things for what they do, not how they do it.

    {1 Comments }

    • Marc says:
      October 15, 2017 at 9:22 pm

      I totally agree with you on writing little to no comments. The number of times I’ve read comments that are wrong or not understandable greatly surpasses the number of times a comment has been useful.

      Reply

    Previous Post: « Pairing and Collective Code Ownership

    Next Post: Podcast on Legacy Code Rocks »

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

    Solutions

    I Can Help
    • Define
    • Educate
    • Integrate
    • Advise

    Consultation
    • Assessments
    • Design Reviews
    • Code Inspections
    • Ongoing Support

    Testimonials Clients

    Resources

    • Blog
    • My Book: Beyond Legacy Code
    • Referral Program
    • Associates


    Read my book!
    Schedule a Call

    Training

    • Training Schedule
    • Learning Roadmap
    • On-Site Classes
    • Online Training
    • Customized Coaching and Mob Facilitation

    Course Descriptions
    • Developer Essentials Training
      • Agile Analysis and Design Patterns
      • Hands-On: Extreme Programming Practices
    • Object-Oriented Analysis and Design Patterns
    • Scrum Software Developer Essentials
    • Agile Software Developer Essentials
    • Agile Software Developer Intensives

    Copyright 2026 © To Be Agile. All rights reserved. Privacy Policy.

    This website uses cookies to improve your experience. I'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
    Privacy & Cookies Policy

    Privacy Overview

    This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
    Necessary
    Always Enabled
    Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
    SAVE & ACCEPT