Ben
  • Member for 9 years, 3 months
  • Last seen more than a month ago
  • Farmington, NY
Are flag variables an absolute evil?
Accepted answer
42 votes

The issue I have seen when maintaining code that makes use of flags is that the number of states grows quickly, and there are almost always unhandled states. One example from my own experience: I was ...

View answer
Is wrapping a third party code the only solution to unit test its consumers?
Accepted answer
22 votes

You always want to wrap third party types and methods behind an interface. This can be tedious and painful. Sometimes you can write a code generator or use a tool to do this. But don't be tempted to ...

View answer
What triggered the popularity of lambda functions in modern mainstream programming languages?
14 votes

As Yannis pointed out, there are a number of factors that have influenced the adoption of high-order functions in languages that were previously without. One of the important items he only touched ...

View answer
Exception Handling Frequency/Log Detail
Accepted answer
12 votes

Catch at the granularity that is meaningful to your application. If you are not going to take a different action for a different exception source, then there is no need to break those things apart.

View answer
Equal Gifts Algorithm Problem
Accepted answer
7 votes

Just winging this off the top of my head before morning status meeting: Sort books descending by value Give first book to Lavanya while books remain while Nikhil's values < Lavanya's values ...

View answer
What is considered third party code?
6 votes

The goal of wrapping up a library is to break your own code's dependency on that library in order to enable: Unit testing - You must be able to test your code. If a library does not allow you to mock ...

View answer
Is conditional return type ever a good idea?
Accepted answer
4 votes

There are occasions where returning different types is OK - those occasions are when you want to take advantage of polymorphism or some other mechanism that amounts to "the types you return will ...

View answer
Learning good OOP design and unlearning some bad habits
4 votes

As for training, I suggest going to http://www.cleancoders.com/ and watching those. They cover very important ideas. Once you have watched the videos, take a look at Head First Design Patterns. That ...

View answer
What are the differences between abstract classes, interfaces, and when to use them
3 votes

First off, you should understand that you will often provide both an interface and an abstract class. The reason for this, and the core difference between the two, is that they allow you to re-use ...

View answer
How can you get constructive criticism for your code?
2 votes

Do you have good tools for code reviews? We had a similar problem in my group. I took some time to install a Reviewboard server, and participation in code reviews jumped. I have found that people like ...

View answer
Should static parameters in an API be part of each method?
Accepted answer
2 votes

I think what Telastyn is suggesting is public class ConsumerContext { string key; string secret; string token; } public ApiObject callMethod(ConsumerContext, ...) This is sometimes a way of ...

View answer
Why do old programming languages continue to be revised?
1 votes

The fundamental concepts or goals a general purpose language is built around do not lose relevance; however minor changes in work environment or hardware demand that updates or small features be added ...

View answer
Is comparing an OO compiler to a SQL compiler/optimizer valid?
1 votes

There are a couple things going on here, so it's back to basics time. As a rule of thumb, when you are implementing you want to make things: Complete Correct Optimized Optimizing before making ...

View answer
What is the pattern for a safe interface in C++
0 votes

You're not paranoid. My first professional task as a C++ programmer resulted in slicing and crashing. I know of others. There are not a lot of good solutions for this. Given your compiler constraints,...

View answer
Should we exclude code for the code coverage analysis?
0 votes

I suggest reporting a set of metrics for each layer of your code. These metrics should include size information (e.g., LoC, number of libraries, number of classes or methods, etc.), testing ...

View answer
Start with open source desktop application and move to iPhone/Android app
0 votes

There are open-source licenses that allow you to sell, and there are ways to license your open-source project for non-commercial use. mattnz's question about the competition rules is an important one. ...

View answer
C++ Building Static Library Project with a Folder Structure
Accepted answer
0 votes

I would suggest creating a deployment MSBuild file that copies your files to the various destination directories. This will keep all your deployment rules in one place, and allow you to change both ...

View answer