作者dasea (植栽鸡肉饭)
看板ncyu_phyedu
标题[讨论] about design pattern
时间Sat Jan 30 15:06:53 2010
About Design Pattern
--------------------------------------------------------------------------------
What is the design pattern?
If a problem occurs over and over again, a solution to that problem has been
used effectively. That solution is described as a pattern. The design
patterns are language-independent strategies for solving common
object-oriented design problems. When you make a design, you should know the
names of some common solutions. Learning design patterns is good for people
to communicate each other effectively. In fact, you may have been familiar
with some design patterns, you may not use well-known names to describe them.
SUN suggests GOF (Gang Of Four--four pioneer guys who wrote a book named
"Design Patterns"- Elements of Reusable Object-Oriented Software), so we use
that book as our guide to describe solutions. Please make you be familiar
with these terms and learn how other people solve the code problems.
Do I have to use the design pattern?
If you want to be a professional Java developer, you should know at least
some popular solutions to coding problems. Such solutions have been proved
efficient and effective by the experienced developers. These solutions are
described as so-called design patterns. Learning design patterns speeds up
your experience accumulation in OOA/OOD. Once you grasped them, you would be
benefit from them for all your life and jump up yourselves to be a master of
designing and developing. Furthermore, you will be able to use these terms to
communicate with your fellows or assessors more effectively.
Many programmers with many years experience don't know design patterns, but
as an Object-Oriented programmer, you have to know them well, especially for
new Java programmers. Actually, when you solved a coding problem, you have
used a design pattern. You may not use a popular name to describe it or may
not choose an effective way to better intellectually control over what you
built. Learning how the experienced developers to solve the coding problems
and trying to use them in your project are a best way to earn your experience
and certification.
Remember that learning the design patterns will really change how you design
your code; not only will you be smarter but will you sound a lot smarter,
too.
How many design patterns?
Many. A site says at least 250 existing patterns are used in OO world,
including Spaghetti which refers to poor coding habits. The 23 design
patterns by GOF are well known, and more are to be discovered on the way.
Note that the design patterns are not idioms or algorithms or components.
What is the relationship among these patterns?
Generally, to build a system, you may need many patterns to fit together.
Different designer may use different patterns to solve the same problem.
Usually:
Some patterns naturally fit together
One pattern may lead to another
Some patterns are similar and alternative
Patterns are discoverable and documentable
Patterns are not methods or framework
Patterns give you hint to solve a problem effectively
References
Design Patterns -- Elements of Reusable Object-Oriented Software by GOF.
The Design Patterns, Java Companion -- by James W. Cooper
Category patterns
Return to top
--------------------------------------------------------------------------------
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.58.22.74