Jump to content

Design pattern

From Simple English Wikipedia, the free encyclopedia
Revision as of 22:49, 30 May 2006 by Eptalon (talk | changes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

In Computer science, a Design pattern is an abstract solution to a certain problem. Design patterns are used in object oriented programming. They give a possible solution to a problem of designing software.

Example

In a text-processing system, each word or letter can have some attributes (like, eg. formating, typeface, size, position on the page...). It would be possible to create a new object for each character in the document, and give it these attributes. This is extemely expensive, however.

So what people do is they create one object for each type of formatting they have, and link that to the information what letter it is. That needs a lot fewer objects. Smart people who found this, called the pattern Flyweight.