Programming: better naming
By the moment you need to read a function to understand what it does or put a breakpoint to know what’s in a var you’re already done.
So, now the question is: what can you do to speed up your code reading? To know without dig?
Can we have the code hinting in the right direction so our guess is more than enough?
Personally, I use some “conventions” to stay light and quick, to facilitate the process: Understand the object, good prefix and suffix.
First the object
Tip: When thinking about the object don’t rush through.
Do a little of brainstorming: write 5 to 10 name variations to describe the object.
Do we use a name already to describe the object or do we have to come with one?
If we have one then we want to maintain the convention else we need a name.
What am I dealing with? Is a user? A customer? A batch? A group? Maybe a piece of UI, perhaps a button? Explore and try different names before to settle on something.
That name can stay there for a long long time and a change, later on, could be problematic, so take your time.
Prefixes help you contextualize your object.
Are you dealing with a flag? Or an event?
Are you doing something specific? If so, what?
This is a quick list I use to speed up writing code while having decent readability. Naming in programming is a dirty job.
You’re doing it when you’re still tinkering and learning about the problem and somehow you’re forced to spit out something.
List and conventions like this can help you mitigate the problem and don’t mess up too bad when your next deadline is coming.
If you’re interested in the subject Clean Code: A Handbook of Agile Software Craftsmanship from Uncle Bob is super recommended.