Code Patterns

Does it make sense to catalog "Code Patterns"? This is an idea I've been kicking around for a few weeks.

A "Code Pattern" is like a Design Pattern, but at a much, much smaller level of granularity.

For instance, there are many ways to get data into a function - PassByValue, PassByReference, PassByPointer, GlobalData, referring to an external SharedData, TemplateParameter, StoreItInAFile... This list goes on and on. There are as many ways to get data out of a function. There are as many ways to decide which code to execute based on a variable. There are as many ways to loop over data.

Much of the value of CodePatterns is to catalog them and have a shared vocabulary - to talk about times when some of them are useful, and to talk about drawbacks. To highlight maintainability. To point out the range of options to people who maybe don't think about the opportunities.

I'd appreciate feedback about whether such a thing would have value - and more importantly, to find out if it's been done before! Thanks!

-- MattCruikshank, January 24, 2006

P.S. I see the page on ParameterPassing, and on AlternativesToPassByReference, but I honestly feel like there are enough of these (and enough discussion that could go with it all) to warrant an entire book! Am I crazy?


There is already a fairly popular term for these: programming idioms. See for instance IdiomOrPattern. Note that they necessarily tend to be language-specific. -- DanMuller


EditText of this page (last edited September 8, 2012) or FindPage with title or text search