CSC/ECE 517 Fall 2012/ch2a 2w14 bb

From Expertiza_Wiki
Jump to navigation Jump to search

Introduction

The purpose of the wiki is to introduce and show some example about pattern fragility. The contents include definition of pattern fragility and what does the concept cover. We also give some examples of mistakes in code that spoil the benefits of design patterns.

Design Patterns

A design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. A design pattern is not a finished design that can be transformed directly into source or machine code. It is a description or template for how to solve a problem that can be used in many different situations. Patterns are formalized best practices that the programmer must implement themselves in the application. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such.

Why Patterns

A pattern is a way of doing something: a way of pursuing an intent, a technique. The idea of capturing effective techniques applies to many endeavors: making food, fireworks, software, and other crafts. In any new craft that is starting to mature, the people working on it will begin to find common, effective methods for achieving their aims and solving problems in various contexts. The community of people who practice a craft usually invent jargon that helps them talk about their craft. Some of this jargon will refer to patterns, or established techniques for achieving certain aims. As a craft and its jargon grows, writers begin to play an important role. Writers document a craft’s patterns, helping to standardize the jargon and to publicize effective techniques.

Why Design Patterns

A design pattern is a pattern—a way to pursue an intent—that uses classes and their methods in an object-oriented language. Developers often start thinking about design after learning a programming language and writing code for a while. You might notice that someone else’s code seems simpler and works better than yours does, and you might wonder how that developer achieves such simplicity. Design patterns are a level up from code and typically show how to achieve a goal using a few classes. A pattern represents an idea, not a particular implementation.

Categorization of Patterns

Benefits of Design Patterns

Pattern Fragility

What is Pattern Fragility

Symptoms of Rotting Design

Examples

Singleton

Factory

Visitor

Conclusion

Reference