Skip to content

Coding Best Practices

August 11, 2009

ᅢリ     Automated testing

ᅡᄋ        Practice Test Driven Development

ᅡᄋ        Always create and include unit tests when writing services

ᅡᄋ        Add integration testing for critical code

ᅢリ     Team/Pair Programming

ᅡᄋ        Encourages discussion of code design decisions and best practices

ᅡᄋ        The observer catches syntax and more importantly logical errors

ᅡᄋ        Multiplies knowledge of the codebase and encourages sharing of expertise

ᅢリ     Exception Handling

ᅡᄋ        Never swallow exceptions or leave catch blocks empty

ᅡᄋ        Minimize use of “throws” (checked exceptions) in method definitions

ᅢリ     Keep the code simple

ᅡᄋ        Simple code is elegant and can be harder to write but easier to maintain and understand

ᅡᄋ        Complex code is hard to read

ᅡᄋ        Overly clever code is hard to understand

ᅢリ     Use appropriate logging levels

ᅡᄋ        When logging things that are informative for normal usage, use INFO level

ᅡᄋ        If a failure occurs which is not a problem then use WARN level, but do NOT use warn to indicate that something failed!

ᅡᄋ        That is what ERROR and FATAL log levels are for (so use them please)

ᅡᄋ        Using log levels that are inconsistent will confuse and upset the production team AND developers

ᅢリ     Minimizing dependencies

ᅡᄋ        Don’t depend on implementations

ᅡᄋ        Use IDs instead of objects when possible

ᅢリ     Interface design

ᅡᄋ        Keep interfaces small (one interface per logical piece)

ᅡᄋ        Use an extension model

ᅢリ     General Best Practices

ᅡᄋ        Minimal usage of synchronized collections (Hashtable, Vector, etc.)

ᅡᄋ        Minimize API dependencies

ᅡᄋ        Use numeric autogenerated ids in database tables

No comments yet

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: