This was on digg today: Top Ten of Programming Advice NOT to follow. I’d like to share my take on them one by one.
10) “Use error codes instead of exceptions”
Agree. I don’t know why you want to use error codes unless you are dealing with legacy system.
9) “Use unsigned integers for values that can only be positive”
Well, I don’t really care.
8 ) “Design classes parallel to their physical counterparts”
Agree. It would be nice if you can do it. But you don’t have to. Especially if it’s gonna take a lot of effort.
7) “Make sure your team shares a common coding standard”
Disagree. I don’t care what coding style each team member uses. But with all the concurrent development, version control and merging going on, can we at lease use the same code format please?
6) “Write lots of comments”
Agree. Good programmers don’t need and don’t write comments.
5) “Use accessors or properties rather than public fields”
Disagree. I don’t see what’s the big deal with using accessors.
4) “Use the singleton pattern for variables that you KNOW you should have only one instance of”
Kind of agree. But I think singleton is appropriate for looking up stuff like factories or strategies.
3) “Be tolerant with input and strict with output”
Agree. Actually I don’t recall hearing this advice from anybody.
2) “Code all the corner cases immediately, cause otherwise you’ll never go back and fix things”
Agree. If you follow this advice, it means you are not doing Test Driven Development.
1) “Design first, then code”
Agree. That’s sooooo waterfall.