Monthly Archives: February 2013

Coding Practice: Cut and Paste Code

Coding Practice: When is it okay to cut and paste code? The presence of code that is cut and pasted is a good indication that functionality can be extracted to a common library, class, or method.  It is also a … Continue reading

Posted in Software Architecture | Tagged , | Leave a comment

Coding Practice: Handling Streams

Coding Practice: How do I prevent memory leaks when working with streams? The safest practice is to leverage a “using” block whenever you work with streams.  The most dangerous practice is to create a stream as a static member of … Continue reading

Posted in Software Architecture | Tagged , | Leave a comment

Coding Practice: Exception Handling

Coding Practice: When should I ignore exceptions? There is never an acceptable time to catch an exception and ignore it.  If you catch an exception, at the very least you should log the exception.  If an exception gets thrown frequently, … Continue reading

Posted in Software Architecture | Tagged , | Leave a comment

Coding Practice: Class Size

Coding Practice: What is the maximum number of lines of code for a class? Looking at some popular projects on Sourceforge, the majority of classes have fewer than 200 lines of code, with the average class consisting of about 50 … Continue reading

Posted in Software Architecture | Tagged , , | Leave a comment

Coding Practice: Function Size

Coding Practice: What is the maximum number of lines of code for a function? In general, a function should fit on your screen both length and width wise without requiring you to scroll, which is about 50 lines.  A function … Continue reading

Posted in Software Architecture | Tagged , , | Leave a comment

C# Interviews and Onion Architecture

While working with Pavan Peddada on documenting our As-Is software architecture, he uncovered the blog of Tony Sneed.  He covers some really good topics in his blog.  Two posts jumped out at me right off the bat: Interviews (it has … Continue reading

Posted in Software Architecture | Tagged , | Leave a comment