Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the Ghost Design Pattern?

Someone recently asked a question about the Ghost Design Pattern - I have not seen this before.

What is the Ghost Design Pattern and how is it implemented? I can only find snippets on the web in reference to it.

like image 447
Robben_Ford_Fan_boy Avatar asked Jun 09 '10 17:06

Robben_Ford_Fan_boy


2 Answers

The only reference I've ever heard to a Design Pattern and 'Ghost' is in Lazy-Loading.

Since Lazy-loading involves only loading the object when it's actually needed, you can think of it as a 'Ghost' until then. You can see its outline, but can't really use it until it's loaded.

like image 82
George Stocker Avatar answered Nov 24 '22 16:11

George Stocker


Ghosts are mentioned in PoEAA, pp 202, 206-14. A ghost is a lazy loaded object that contains just enough info to instantiate itself on demand. They can be useful because they can trigger a bulk load of similar ghosts on the first access if they register themselves with a loader (dunno if Fowler mentions that bit though).

like image 29
Bill Hails Avatar answered Nov 24 '22 14:11

Bill Hails