Blog Post #1 (winter 2023)

Prompt: What is one thing from the articles that you would like to start doing (more often), and why? What is one thing you want to avoid doing and why?

The article I read on clean code is: I really liked this article. It explained that clean code is easy to understand and maintain, and is especially important for humans to be able to understand. The article presented a funny quote from Martin Fowler, “”Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”

Some examples of clean code that is easy to understand includes code with straightforward and meaningful names. “A name should tell you why it exists, what it does, and how it is used. If a name requires a comment, then the name does not reveal its intent.” It gave examples of how using a single letter versus a clear name for a variable is very important. For example, if I were to have an int x; declared, how would I know what this is without a comment. Instead, I should have int elapsedSeconds; or something like that.

Another example the article gave was that names should be pronounceable. Even if the name has a clear purpose, if it’s not pronounceable, it’s not clean. For example:

const yyyymmdstr = moment().format(“YYYY/MM/DD”);


const currentDate = moment().format(“YYYY/MM/DD”);

The second one is much easier to deal with, understand, and maintain (for humans!!!).

The code even brought up a point I’d never thought of: searchable names. For example, in an if statement, instead of using a “magic number”, a searchable named constant is much easier to maintain.


if (student.classes.length < 7) {
// Do something


if (student.classes.length < MAX_CLASSES_PER_STUDENT) {
// Do something

This is something I am guilty of doing, even recently. I’m really glad I read this article to keep me in check. Therefore, using searchable names is something that I would like to start doing more often. This is because, even if not at my current level it’s not relevant, it can make searching through longer code much easier. It can even make my code easier to understand for other people (without them having to rely on a billion comments).

The article I read on code smells is:

One thing this article mentioned about code smells is that long, obscure comments is a pretty prevalent code smell. It stated, “Are the comments necessary? Do they explain ‘why’ and not ‘what’? Can you refactor the code so the comments aren’t required?” I think I’m VERY guilty of leaving too many cluttered, obscure comments. Moving forward, I would like to be better about this in order to my code to be more presentable. Plus, if I’m leaving less comments, it means my code is more self explanatory… double whammy!

Thanks so much for reading!

Brandi Cook


Print Friendly, PDF & Email

Leave a Reply

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