'2008/10/21'에 해당되는 글 2건

  1. 2008.10.21 Flyweight pattern by 알 수 없는 사용자
  2. 2008.10.21 Proxy pattern by 알 수 없는 사용자 2

Flyweight pattern

Computer/Terms 2008. 10. 21. 11:29

Flyweight is a software design pattern. A Flyweight is an object that minimizes memory occupation by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple representation would use an unacceptable amount of memory. Often some parts of the object state can be shared and it's common to put them in external data structures and pass them to the flyweight objects temporarily when they are used.

A classic example usage of the flyweight pattern are the data structures for graphical representation of characters in a word processor. It would be nice to have, for each character in a document, a glyph object containing its font outline, font metrics, and other formatting data, but it would amount to hundreds or thousands of bytes for each character. Instead, for every character there might be a reference to a flyweight glyph object shared by every instance of the same character in the document; only the position of each character (in the document and/or the page) would need to be stored externally.

Reference:
http://en.wikipedia.org/wiki/Flyweight_Pattern

Posted by 알 수 없는 사용자
,

Proxy pattern

Computer/Terms 2008. 10. 21. 10:53

In computer programming, the proxy pattern is a software design pattern.

A proxy, in its most general form, is a class functioning as an interface to another thing. The other thing could be anything: a network connection, a large object in memory, a file, or some other resource that is expensive or impossible to duplicate.

A well-known example of the proxy pattern is a reference counting pointer object.

In situations where multiple copies of a complex object must exist the proxy pattern can be adapted to incorporate the Flyweight Pattern in order to reduce the application's memory footprint. Typically one instance of the complex object is created, and multiple proxy objects are created, all of which contain a reference to the single original complex object. Any operations performed on the proxies are forwarded to the original object. Once all instances of the proxy are out of scope, the complex object's memory may be deallocated.

Reference:
http://en.wikipedia.org/wiki/Proxy_pattern

Posted by 알 수 없는 사용자
,