Chapter 3. Common Design Patterns

for RuBoard

The harder it is to see the design in the code, the harder it is to preserve it.

Martin Fowler [1]

[1] Fowler, Martin. Refactoring:Improving the Design of Existing Code . Reading, MA:Addison-Wesley, 1999. Page 55.

In their book, Design Patterns , Erich Gamma and company (commonly known as the "Gang of Four" or GoF) propose that there are certain patterns in software design that expert developers regularly use and recognize in code written by others. Design Patterns seeks to formally catalog these patterns so that developers may benefit from them without spending years learning them the hard waythrough experience alone. The idea is to promote the discussion of and research into software design patterns as a distinct area of computer science so that, having been formalized , software design patterns can continue to evolve and proliferate as software engineering itself does.

The book The Practice of Programming espouses a similar philosophy. In it, author Brian Kernighan proposes that programming languages have idioms conventions that experienced developers use to build common coding elements. [2] These are similar to design patterns, but are finer in granularity. I like to think of them as mini patterns or pattern fragments . Idioms are more generic than design patterns. They have more to do with the language than with solving a particular type of problem.

[2] Kernighan, Brian. The Practice of Programming . Reading, MA:Addison-Wesley, 1999. Page 11.

Although both of these books discuss software design from the standpoint of object-oriented programming (OOP) languages, I have long believed that common design patterns and idioms also exist in query languages such as Transact-SQL. Expert developers regularly use certain common techniques to build the code they write. The purpose of this chapter is to catalog a few of these and to help jumpstart a discussion of Transact-SQL design patterns and idioms. For succinctness, idioms and design patterns are discussed together. Just keep in mind that, although closely related , they're really two different things.

for RuBoard


The Guru[ap]s Guide to SQL Server[tm] Stored Procedures, XML, and HTML
The Guru[ap]s Guide to SQL Server[tm] Stored Procedures, XML, and HTML
ISBN: 201700468
EAN: N/A
Year: 2005
Pages: 223

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net