What are the benefits of prefixing function parameter names with p*?
I often see projects (in Java projects and teams using Eclipse) that prefix function parameters with p
.
Is defining a variable to name a method argument a good practice?
For the sake of readability I often find myself defining temporary variables while calling functions, such as the following code
Teaching myself, as a physicist, to become a better programmer [closed]
Closed 9 years ago.
Should a programmer take writing lessons to enhance code expressiveness?
Given that programmers are authors and write code to express abstract thoughts and concepts, and good code should be read by other programmers without difficulties and misunderstandings, should a programmer take writing lessons to write better code?
Is there any reason why I should use parentheses when calling new in PHP?
When there are no arguments, we have these two options:
How to avoid general names for abstract classes?
In general it’s good to avoid words like “handle” or “process” as part of routine names and class names, unless you are dealing with (e.g.) file handles or (e.g.) unix processes. However abstract classes often don’t really know what they’re going to do with something besides, say, process it. In my current situation I have an “EmailProcessor” that logs into a user’s inbox and processes messages from it. It’s not really clear to me how to give this a more precise name, although I’ve noticed the following style matter arises:
Method flags as arguments or as member variables?
I think the title “Method flags as arguments or as member variables?” may be suboptimal, but as I’m missing any better terminology atm., here goes:
Using prefix incremented loops in C#
Back when I started programming in college, a friend encouraged me to use the prefix incrementation operator ++i
instead of the postfix i++
, citing that there was a slight chance of better performance with no real chance of a downside. I realize this is true in C++, and it’s become a general habit that I continue to do.
conventions for friend methods in Perl
Perl doesn’t support a friend relationship between objects, nor does it support private or protected methods. What is usually done for private methods is to prefix the name with an underscore. I occasionally have methods that I think of as friend methods. Meaning that I expect them to be used by a specific object, or an object with a specific responsibility, but I’m not sure if I should make that method public (meaning foo
) or private ( _foo
) or if there’s a better convention? is there a convention for friend methods?
Simple vs Complex (but performance efficient) solution – which one to choose and when?
I have been programming for a couple of years and have often found myself at a dilemma.