Why Naming Is the Top Programming Challenge According to a Developer Survey
A developer survey of 4,500 programmers reveals that naming variables, classes, and functions is perceived as the biggest programming challenge, highlighting its impact on code readability, design quality, and maintenance, and underscoring the art and difficulty of choosing concise, meaningful identifiers.
Many programmers consider naming one of the biggest and most important challenges in programming.
Last week I launched a poll titled “Biggest Problems for Programmers,” based on recent Quora discussions; according to the responses and voting results, one item far outpaced the others and stayed first. For software developers, the biggest difficulty is naming (variables, classes, functions, procedures, etc.).
I was a bit surprised by this result because, as a veteran developer, I would not have voted for this (I would have voted for “modifying or maintaining other people's code”). What surprised me even more is that naming, which seems not that important, ranked first, far from the expected outcome. Below is the distribution chart.
The result comes from Quora and earlier Ubuntu forum posts, with 4,500 developers voting. The votes for naming are almost the sum of the other eight items combined, wow!
Indeed, these self‑selected group results are not scientific, but I think they still have meaning; in other words, naming is indeed a tricky problem many non‑programmers may not realize.
A few years ago there was a StackExchange thread on this topic; to emphasize this I quote some content about programmers' pain and dilemma with naming.
“I really spend a lot of time thinking about naming when I code.”
“I have to agree that naming is an art.”
“If you want to improve code readability, naming is indeed important.”
I think the last quote captures part of the core, explaining why naming is so hard—it is so important. Accurate naming improves readability, makes code easier to understand, facilitates debugging, and helps future maintainers. Once you start doing it, you quickly find that coming up with a concise yet accurate name is not easy. As Jeff Atwood wrote:
“Coming up with good names is hard, but there is a reason: good names need only one or two words to convey your core meaning.”
Moreover, many people think correct naming helps you write good code. If you cannot think of a clear, concise name for a variable or function, maybe your code has problems. Then you have to consider refactoring.
“Usually, if you can't think of a suitable name, it means your design may have issues. Does your method do too many things? Is your class's encapsulation or cohesion insufficient?”
“My experience is that if you can't name your class properly, most of the time the class is unnecessary or redundant.”
“Naming difficulty is not necessarily bad; it forces you to think seriously about what your class is supposed to achieve.”
In short: if you want to learn programming, you must have a good dictionary.
Author: Phil Johnson
Translation: 伯乐在线 - JingerJoe
Link: http://blog.jobbole.com/50708/
Long press to recognize QR code, open in browser
Download the Big Lecture online course app instantly
Supports Android and iOS
Qunar's latest and hottest online video courses are all here!
Qunar Tech Salon
Qunar Tech Salon is a learning and exchange platform for Qunar engineers and industry peers. We share cutting-edge technology trends and topics, providing a free platform for mid-to-senior technical professionals to exchange and learn.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.