Small Things Matter: Naming

Naming is hard. But we can improve and make a difference.

As developers, we write code for a living. Most of the time, we pay attention to solving problems, learning new technologies; kind of new cool stuff. We tend to ignore or look down on small things.

There are so many small things. Well, in reality, everything is small things. Big is just a sum of small things. Naming is one of them.

Dear developers, what is on your mind when you heard about “Naming”?

  1. Project name
  2. Class name
  3. Method name
  4. Interface name
  5. Property name
  6. Variable name
  7. Hardcoded value

They are all matter. Why? Because they help us__human being__can read the code. They help us understand the logic by just looking at the signatures.

In the technical jargon, we call readability.

Let’s take a look at “Hardcoded value” and “Variable name”. They are pretty much the same thing. I have seen many places that developers name a variable: b1, b2, … They have the same problem:

They give no meaning at all

Number Cannot Speak

Take a look at this code. I am sure all C# developer knows

    public class BadNaming
    {
        public void CanYouUnderstandTheLogic()
        {
            Thread.Sleep(180000);
        }
    }

The code says that: Should sleep (block and wait the current thread) for 180000 milliseconds.

What are the issues with that code?

  1. As a reader, I have to convert 180000 to a meaningful concept that my brain can process, Ex: Second, Minute, Hour. As a human, we do not usually deal with milliseconds.
  2. What is the logic behind the sleep? Usually, developers will write inline comments. (Hint: You should do a quick search and will know that inline comment is not a good approach)

The number itself cannot carry meaning. It cannot speak what it means.

Give It a Meaning

Now take a look at this code. What do you think?

public void GiveMeMeaning()
{
    var sleepThreeMinutes = TimeSpan.FromMinutes(3);
    Thread.Sleep(sleepThreeMinutes);
}

The Thread.Sleep method can take a TimeSpan. Usually, developers forget that option.

With a little change, I can assign meaning to a number. The code can self-explain its meaning.

No matter what languages you are using, there are primitive types that convey, naturally, no meaning. When you use them, think about the other person (maybe you in a year) will read that code. They have to spend time investigate the meaning.

I just pick a small corner of the problem with the hope that you get the idea and pay more attention with your code. Someone will thank you and call you a professional.

Professionalism is nothing than caring for small stuff.

Dear Leaders

At any point in time, one is leading or being led by someone. Everyone is a leader within a context. You might be led by a leader in your company. Mostly because you are the bottom of the organization. However, when you are at home, you lead your family. If you are a wife, you lead your husband (sorry guys, it is just the fact). If you are a husband, you lead your kids (how dare you lead your wife ๐Ÿ˜› ).

I just take a small context for this post: You lead a development team. Take a more common scenario that I have seen:

You lead a developer team.

A leader can be a technical leader, a scrum master, a manager, … The context is pretty much the same: You take care of a team.

There Small Things

Three things I consider the most important: Accountability, Mentor, and Cheer Leader.

Accountability

I like military principles. When a soldier is in a battle, his captain and comrades are his life. He trusts them. I know, in our IT job, most of the time it is not a Dead-Or-Alive situation. That might be a reason why leaders do not care so much about building accountability.

Mentor

Did you forget to help your member growing? Deep inside, everyone wants to grow. They want to be useful. They are expecting someone to guide them, to help them in a positive way. That is you__leader.

Should you add “Mentor” in your responsibility bell? Your call! I highly suggest you should.

By helping other, you are helping yourself. You help them grow, they will lift you up.

Cheer Leader

Well, this is not a football match. But you get the idea. Make the team closer, talk more to each other, discuss openly.

Working is not easy. There is stress. But, there should be joy most of the time.

Another Sand in the Sea

There are thousands of articles, books, seminars, classes … about “Leader and Management” topic. They are useful resources. I have read some of them. The more I read the more confuse I am.

Finally, I found out: Hey, wait a minute! There are too much! Maybe I should start with 3 small things and change my mindset.

Everyone has deserved a chance to grow. So I am!

 

Oh New Year, Again! Let’s Make Wishes

New year alway comes. I guarantee you. Welcome to another Lunar New Year. Everyone makes wishes. They wish for themselves, for their family, for their relatives. Everyone has good intention.

Yes! I do. I make wishes every new year. Actually, some years ago, I had made vows. Kind of

  1. I vowed I will quite smoking
  2. I vowed I will drink less
  3. I vowed I will save money
  4. I vowed
  5. …….

I just forgot one important vow:

I vow I will make the same vows again, next new year

I am not saying that process is good or bad. I just wonder why I did that again and again. I know some people do the same thing.

So, let’s explore some theories behind this question

Why do people make vows every new year?

No Cost

You do not have to pay anything for your wishes/vows. And if you do not say it out loud, you are safe. No one knows.

Feel Better

Oh God, It is TET (our Vietnamese name for Lunar New Year). TET is the time for parties with beer, food, hanging around with friends. I might feel better if I make some promises to myself. Kind of, Well, it is ok to relax. I will be a better person after TET.

Make up for a Bad Year

Sometimes, I screw up with the current year. And there is a feeling of “nothing can be done this year”. I just let it go and make a promise for the next.

Screw up and Wish for a better one without taking any action. That’s kind of thing!

High Emotion

People are happy when TET (except some special circumstances). Happy people make promises. They believe in a bright future.

Think about your childhood, if you want to ask parents for money, you know when to ask. Of course, when they are happy ๐Ÿ™‚

What happens after TET?

—————–>

Nothing happens! Period.

People come back to their real life. Fight for a living. Have some more parties. … And then finally they realize:

Oh Shit! TET is coming. There is no time for me in this year.

The cycle begins.

Ok. Enough talking! What should we do instead?

This year (2017), I decided to do

  1. Have a list of small things to do.
  2. Make a small plan for them
  3. Start them immediately (Write this post is a part of the actions). Take action!
  4. Have a good time in TET with beer, food, visit parents, relatives, friends, …
  5. Back to work immediately after TET.

My friends, maybe it is the time for you to reconsider what you have been doing for years. No matter what actions you take, they are yours. And you are always right with your decisions.

Everything has its cost.

The cost of a wish is the time.

Happy Lunar New Year! Beer Up.

%d bloggers like this: