Tagged Questions
7
votes
3answers
193 views
Dynamic typing function arguments - how to keep readability high?
Dynamic typing newbie here, hoping for some wizened words of wisdom.
I'm curious if there is a set of best practices out there for dealing with function arguments (and let's be honest, variables in ...
2
votes
2answers
147 views
Are there standard style guides for PHP?
I've been working in a very small team for PHP development and we've been using an ad-hoc, "Invented Here" style guide. Now that our team and codebase is growing, we would like to use a more ...
2
votes
3answers
358 views
Microsoft's coding standards for ASP.NET controls
I cannot find any naming standards/conventions in MSDN for naming ASP.NET controls.
One of the following standards tends to be used by programmers:
lblAddress
AddressLabel
Address
According to ...
1
vote
4answers
355 views
Is using `continue`, `break` in non-`switch` loops and `?:` bad practice? [duplicate]
Back in college I've been told that using break; and continue; outside switch statements (e.g. to escape for or while loops) is wrong, bad practice and bad habits at the same time because it only ...
-4
votes
1answer
76 views
Check Javascript coding practice and overall performance [closed]
I have a Edit/Details form which has 4 user related fields. On click of Save, I save the edited fields to local storage (if supported) and display the same values in the Details view.
Below is the ...
7
votes
7answers
963 views
Prevent developers from using constants
I have one one software system which allows developers to specify an ID or name to create NodeReferences. Both work fine, but ID's are not guaranteed to be the same across different environments. I've ...
-1
votes
1answer
176 views
What is the C++ convention, if any, for naming to differentiate between structure types and other types? [closed]
In general, should I use some sort of convention for structure names which is distinct from other type name? I was thinking about this when my professor started talking about structures.
I had the ...
1
vote
2answers
311 views
coding style for If condition [duplicate]
I came across below style of writing if statements in C#, on msdn code examples. Usually when I write if statements, the conditions I would write `(Customer != null)
I want to know if there is any ...
10
votes
4answers
431 views
Always pull out common cases and branch separately? [duplicate]
We had a disagreement in a code review.
What I had written:
if(unimportantThing().isGood && previouslyCalculatedIndex != -1)
{
//Stuff
}
if(otherThing().isBad && ...
59
votes
19answers
10k views
How important is it to reduce the number of lines in code?
I am a Software developer who works on J2SE (core java).
Often during our code reviews we are asked to reduce the number of lines in our code.
It's not about removing redundant code, it's about ...
17
votes
15answers
2k views
I hate one of our coding standards and it drives me insane, how to process it? [closed]
Disclaimer: Not as exaggerated as the title suggests, but it still makes me uncomfortable. I'm just going to express honestly, so take it with a grain of salt. Just pretend that I'm talking about that ...
0
votes
1answer
149 views
Preventing override of methods in Objective-C [closed]
Objective-C lacks private methods or java-esque final methods. This means that it is possible for a subclass to (accidentally) override some of the internals of a superclass.
How does one prevent ...
4
votes
5answers
433 views
How can I avoid mistakes using the same variable name again?
This isn't a rare case and occurs with me often and I spent countless time trying to debug the code.
Latest example, this PHP code where I used $email for the parameter and for object as well.
...
20
votes
8answers
1k views
Should comments say WHY the program is doing what it is doing? (opinion on a dictum by the inventor of Forth)
The often provocative Chuck Moore (inventor of the Forth language) gave the following advice (paraphrasing):
"Use comments sparingly. Programs are self-documenting, with a
modicum of help from ...
9
votes
1answer
254 views
Are there well-known PowerShell coding conventions?
Are there any well-defined conventions when programming in PowerShell?
For example, in scripts which are to be maintained long-term, do we need to:
Use the real cmdlet name or alias?
Specify the ...