Thursday, June 5, 2008

Ways to improve your code

Neal Ford – Ways to improve your code

• Metrics and Anaylsis
• Good Citizenship
o Properties != encapsulation
Kill accidental complexity
Ceremony vs. Essence
Static vs. dynamic
F#

Don’t invent your own caching framework
Don’t buy an entire tool suite if you only use 10% of the product
Don’t use Biztalk
The old “we can’t use open source code because the lawyers say we can’t” is ridiculous.
Don’t have an architect review all of the code before allowing items to be checked in.
Don’t keep ALL of the logic in stored procedures just because you think that it keeps performance from slowing down.
Perform unit tests. If you have to spend too much time debugging, then you have time to do unit tests.
Handle exceptions.
Question authority. Don’t do things a certain way just because it’s the way you’ve always done them. Know why you are doing it that way and fight it if it’s not a good way to do it.
Create fluent interfaces and do away with too much code.
Don’t name interfaces with a leading “I”…instead creat good naming patterns so you can find things.
Pier programming is a really good idea. Two people are slower to code, but are far more accurate. It ends up saving time in the long run.
Software Development Anti-patterns—(i.e. Give me an estimate Now!!) It takes detailed research to determine exactly what needs to be done and the best way to do it. You need to try to determine up front any problems that might occur so that you can find the best way around them. Otherwise, nobody can stick to an estimate.
Composed Method – “SmallTalk Best Practice Patterns” is a book that you should read even if you don’t care about SmallTalk. The solutions they came up with for patterns in this book are very good.
Polyglot Programming (Language != Platform)—leverage existing platforms with languages targeted at a specific platform. (i.e. IronPython, IronRuby, Django, Ruby on Rails—which makes writing unit testing easier)
Learn everything there is to know about your language like reflection, regular expressions, and dependency injection.
Anti-Objects (look up OOPSLA)
PacMan code is very poor because the ghosts can only tell where PacMan has been, but they can’t cut him off at the pass or guess where he’ll be next.

No comments: