Bridge pattern

The bridge pattern is a design pattern used in software engineering

The bridge design pattern is meant to "decouple an abstraction from its implementation so that the two can vary independently" (Gamma et. al.). The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.

When a class varies often, the features of object-oriented programming become very useful because changes to a program's code can be made easily with minimal prior knowledge about the program. The bridge pattern is useful when not only the class itself varies often but also what the class does. The class itself can be thought of as the abstraction and what the class can do as the implementation.

When the abstraction and implementation are separated they can vary independently. A good example use of the bridge design pattern comes from Design Patterns Explained: A New Perspective on Object-Oriented Design by Shalloway and Trott. Say you have an abstraction, shapes. You want to have many types of shapes and each with its own properties but there are things that all shapes do. One thing you want all shapes to do is draw themselves. However, drawing graphics to a screen can sometimes be dependent on different graphics implementations or operating systems. You want your shapes to be able to be drawn on many types of systems but having the shape itself implement them all or modifying the shape class to work with different architechtures. The bridge helps by allowing you to create new classes that provide the drawing implementation. The, abstraction, shape class provides methods for getting the size or properties of a shape while the, implementation, drawing class provides an interface for drawing graphics. Now if a new shape needs to be created or you want to draw your shapes on a new graphics API then it is very easy to add a new class that implements the features you need.

References

  • Shalloway, Alan. Trott, James R. Design Patterns Explained: A New Perspective on Object-Oriented Design. Addison Wesley 2002
  • Gamma. Helm. Johnson. Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software. Addison Wesley 1994


In the News

Scientists Stop Autoimmune Disease Without Shutting Off Immune System
Researchers at the University of North Carolina at Chapel Hill may have found a safer, more effective way to treat the life-threatening autoimmune skin disease pemphigus vulgaris without turning off the immune system.

New Gene Prediction Method Capitalizes On Multiple Genomes
Scientists report a new approach to computationally predicting the locations and structures of protein-coding genes in a genome. Gene finding remains an important problem in biology as scientists are still far from fully mapping the set of human genes. Furthermore, gene maps for other vertebrates, including important model organisms such as mouse, are much more incomplete than the human annotation. The new technique works by comparing a genome of interest to the genomes of several related species.

Nuts Fact Sheets: Chestnuts
Collection of essays about growing chestnut trees in the U.S. Includes essays on a history of the introduction of foreign chestnut trees to the U.S. mainly in the 19th century, how to distinguish American chestnut trees from other chestnuts within the original native range, the spread of the chestnut blight fungus in the early 20th century, and growing chestnuts from seeds. From the Connecticut Agricultural Experiment Station.

Human RecQ Helicases, Homologous Recombination And Genomic Instability
Two articles detail how human RecQ helicases regulate homologous recombination and protect genome stability. Taken together, these papers lend new insight into the molecular function of human RecQ helicases in protecting genome stability and preventing tumorigenesis.

Challenging Dyslexia Research
Should reading and writing researchers redefine basic concepts? One researcher commented that it is paradoxical that scholars are so unanimous in stating what dyslexia and language impediments are when the concepts they build their research on are vague and fuzzy.

New Technique Produces 10-carat Diamond
Researchers at the Carnegie Institution of Washington, D.C. have produced 10-carat, half-inch thick single-crystal diamonds at rapid growth rates (100 micrometers per hour) using a chemical vapor deposition (CVD) process. The size is approximately five times that of commercially available diamonds produced by the standard high-pressure/high-temperature (HPHT) method and other CVD techniques.

Summer a Go-Go, From Tiny Cameras to Campfire Microwaves
Our editors test a bitty Sony camera, a budget big TV, a microwave that ports to your campsite, a blender that grinds anything and a pair of rugged walkie-talkies. But check out the reviews before you buy to find out what's wired, what's tired.

Engineers Develop More Than Tenfold Improvement In Measuring Virus Inf
A University of Wisconsin-Madison biological engineering team tweaked the standard system for measuring virus infectivity, digitized it, quantified it, analyzed it and discovered a method more than 10 times as sensitive.

New Technology Quickly Finds Leaks In Spacecraft
Tiny meteors flash through space. There's spacecraft debris flying around, too. And so there's a risk that objects just a few millimeters across could pierce the thin aluminum skin of spacecraft such as the International Space Station orbiting 220 miles above Earth. A tiny hole means a tiny leak of pressurized air. And these leaks can be hard to find. Researchers have developed a new tool that will make finding these leaks quick and easy.

Bone Marrow Fat May Indicate Bone Weakening
Measuring bone marrow fat (BMF) along with bone mineral density (BMD) can better predict weakening of bones than either test done alone, a new study indicates. BMD measurement with DEXA is presently the most commonly used parameter for determining bone weakening. Researchers have long questioned whether there may be other measurable bone components that influence mechanical stability of bone.


MP3 Music Downloads

Preview songs, Download Free Music,Burn CDs at ITunes.com
iTunes_RGB_9mm

 


Google




InformationQuickFind.com - Find Information Fast

Links