Tagged Questions
73
votes
8answers
7k views
Is it okay to not completely understand code functionality? [duplicate]
As I am currently struggling with learning WCF for a project at work, for the past several days I have been looking at online tutorials and examples on the best way to make a WCF client; and today, ...
4
votes
4answers
482 views
Using a function's return value as an if condition, good practice?
Do you think it is a good practice to use function return values as if conditions? I'm coding in PHP atm but it holds for many other languages.
if(isTheConditionMet($maybeSomeParams))
{
}
or
$res ...
0
votes
1answer
194 views
How can I organize my data flow to process a good program solution? [duplicate]
My main problem when trying to form a program is that while I have the tools at my disposal, I am too disorganized to properly use them to solve my problems. Often my process is simply trial and ...
-1
votes
1answer
68 views
What are the most crucial categories of content to organize into an internal developer portal in a large company? [closed]
I have been tasked with organizing all of the company's internal content currently spread around sharepoint, a markdown reference manual and confluence into a single cohesive and usable portal in ...
3
votes
3answers
1k views
articles in variable names and hard-coding strings
re-edited by author: no this is not 2 questions. This is one question about code review questions containing two separate points. Please do not edit my question.
For naming variables, the two sides ...
0
votes
1answer
80 views
Writing contextually related control statements next to each other [duplicate]
Recently I've been messing around with this. Note that I'm not using LINQ because while this could be easily be done that way, I could do this in any language.
Allow me to exemplify:
foreach ( var i ...
6
votes
7answers
1k views
Making Simple IF Statements Shorter
If we assume we have this little snippet of code:
string str = "checked";
bool test1;
if (str == "checked")
{
test1 = true;
}
else
{
test1 = false;
}
Is it bad practice to change a simple ...
2
votes
4answers
3k views
Creating a coding standards document
I work in a control systems company, where the primary work is SCADA and PLC, along with other control systems stuff.
Softwre development is not really something the company does, apart from little ...
5
votes
8answers
758 views
Why is (position < size) such a prevalent pattern in conditionals?
In a condition statement (IF) everyone use (position < size), but why? Only convention or there is a good reason for that?
Example:
if (pos < array.lengh) {
// do some with array[pos];
}
...
8
votes
3answers
465 views
When comparing a combination of String literals, is it convention to call .equals() on the literal? [closed]
There are benefits to each, and I understand the differences - but what is considered best / standard practice? Why?
"myString".equals(myStringVar)
Avoids a potential NPE and does not require a ...
71
votes
10answers
13k views
Why do most of us use 'i' as a loop counter variable?
Has anyone thought about why so many of us repeat this same pattern using the same variable names?
for (int i = 0; i < foo; i++) {
// ...
}
It seems most code I've ever looked at uses i, j, ...
104
votes
18answers
8k views
Can a function be too short?
Whenever I find myself writing the same logic more than once, I usually stick it in a function so there is only one place in my application I have to maintain that logic. A side effect is that I ...
12
votes
5answers
602 views
Can there be too much uniformity in coding standards?
Is there such a thing as too much uniformity? Where I work we of course have standards including naming conventions, architectures, frameworks to leverage etc. However lately there has been a lot of ...
21
votes
18answers
4k views
What should be the maximum length of a function? [closed]
What should be the maximum length of a function?
And are there cases which are an exception to this?
38
votes
6answers
16k views
Method vs Function vs Procedure
Simple question, but I often hear these three terms defined with such ferocity, but which have been known to me to mean different things over the years.
What are the "correct" definitions of ...
10
votes
12answers
1k views
Maintainability of Boolean logic - Is nesting if statements needed?
Which of these is better for maintainability?
if (byteArrayVariable != null)
if (byteArrayVariable .Length != 0)
//Do something with byteArrayVariable
OR
if ((byteArrayVariable != ...