The Gurus Guide to SQL Server Stored Procedures, XML, and HTML [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

The Gurus Guide to SQL Server Stored Procedures, XML, and HTML [Electronic resources] - نسخه متنی

Ken Henderson

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید









Chapter 3. Common Design Patterns




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 idiomsconventions 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.



/ 223