0
votes
1answer
205 views

Do programmers have a mother tongue/first [programming] language? [on hold]

When talking about real [spoken/written] languages everyone has a first language the one that was learnt first and well. They studied this language every well, know the grammar very well can express ...
9
votes
3answers
666 views

Are these programming “classics” still relevant today and should I read them? [closed]

I have come across numerous older posts that highly recommend the following language agnostic programming books: Code Complete by Steve McConnel The Pragmatic Programmer - Andrew Hunt and Dave ...
4
votes
4answers
230 views

Returning null or a empty value/throw exception? [duplicate]

Various programming books suggest that methods should not return null values (Clean Code for example). Instead of returning null default values (0 or empty string or empty object) should be returned ...
14
votes
2answers
613 views

Which is better: a bunch of getters or 1 method with a selection string parameter?

Our knowledge domain involves people walking over a pressure-recording plate with their bare feet. We do image recognition which results in objects of the 'Foot' class, if a human foot is recognized ...
5
votes
3answers
1k views

Should I refactor a F class from code climate? [closed]

According to code climate (static quality analysis), a class is F, aka the worst mark you could be granted. I did submit a pull request to rearrange it here Which has been refused because the new ...
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 ...
1
vote
3answers
555 views

When should one use “out” parameters?

In Objective-C, there are several methods like initWithContentsOfFile:encoding:error: where one passes in a reference to an NSError object for the error: parameter. In this example, the value of the ...
32
votes
15answers
3k views

Why use other number bases when programming

My coworkers and I have been bending our minds to figuring out why anyone would go out of their way to program numbers in a base other than base 10. I suggested that perhaps you could optimize longer ...
2
votes
3answers
163 views

Overloading interface buttons, what are the best practices?

Imagine you'll have always a button labeled "Continue" in the same position in your app's GUI. Would you rather make a single button instance that takes different actions depending on the current ...
5
votes
5answers
441 views

When decomposing a large function, how can I avoid the complexity from the extra subfunctions?

Say I have a large function like the following: function do_lots_of_stuff(){ { //subpart 1 ... } ... { //subpart N ... } } a common pattern is to decompose it ...
2
votes
2answers
372 views

Using a DSN database connection is a bad practice?

During all my professional lifetime that I have been programming in Windows enviroments, I advised my friends and coworkers to not use a DSN database connection in their applications, based on my own ...
16
votes
6answers
1k views

while(true) and loop-breaking - anti-pattern?

Consider the following code: public void doSomething(int input) { while(true) { TransformInSomeWay(input); if(ProcessingComplete(input)) break; ...
55
votes
17answers
4k views

How to deal with tautology in comments?

Sometimes I find myself in situations when the part of code that I am writing is (or seems to be) so self-evident that its name would be basically repeated as a comment: class Example { /// ...
6
votes
3answers
182 views

Is it bad practice to define/use “Preset” functions

Lets say I have an extremely robust and versatile function: void DoAnything(action, target, context) In my program, 90% of the time I call this function, it's with the same parameters: ...
53
votes
17answers
4k views

How to train yourself to avoid writing “clever” code?

Do you know that feeling when you just need to show off that new trick with Expressions or generalize three different procedures? This does not have to be on Architecture Astronaut scale and in fact ...