180 likes | 281 Views
Construction and Cloning. Kirk Scott. Adonis From Wikipedia, the free encyclopedia Jump to: navigation , search For the Syrian poet, see Adunis . For other uses, see Adonis (disambiguation) .
E N D
Construction and Cloning Kirk Scott
Adonis • From Wikipedia, the free encyclopedia • Jump to: navigation, search • For the Syrian poet, see Adunis. • For other uses, see Adonis (disambiguation).
Adonis, in Greek mythology, is the god of beauty and desire, and is a central figure in various mystery religions. His religion belonged to women: the dying of Adonis was fully developed in the circle of young girls around the poet Sappho from the island of Lesbos, about 600 BC, as revealed in a fragment of Sappho's surviving poetry.[1]
Adonis is one of the most complex figures in classical times. He has had multiple roles, and there has been much scholarship over the centuries concerning his meaning and purpose in Greek religious beliefs. He is an annually-renewed, ever-youthful vegetation god, a life-death-rebirth deity whose nature is tied to the calendar. His name is often applied in modern times to handsome youths, of whom he is the archetype. Adonis is often referred to as the mortal god of Beauty.
Kylix (6th century BC) depicting Dionysus among the sailors transformed to dolphins after attempting to kidnap him
This is an introductory unit. • These are the units/chapters belonging to this section of the course: • Unit 3, Singleton, book chapter 8. • Unit 4, Prototype, book chapter 18. • Unit 5, Builder, book chapter 15. • Unit 6, Proxy, book chapter 11.
What will be given next is an extremely brief overview of these topics. • The idea is to show that according to the organizational scheme for the course, they can be treated as belonging together, even though the book’s organizational scheme put them into chapters that were separated from each other.
Singleton • Book definition: • The intent of the Singleton pattern is to ensure that a class has only one instance and to provide a global point of access to it. • Comment mode on: • In other words, the singleton design pattern puts a constraint on the construction of objects.
Prototype • Book definition: • The intent of the Prototype pattern is to provide new objects by copying an example rather than by bringing forth new, uninitialized instances of a class. • Comment mode on: • In other words, the prototype design pattern bases the construction of a new object on an already existing object.
Builder • Book definition: • The intent of the Builder pattern is to move the construction logic for an object outside the class to be instantiated. • Comment mode on: • In other words, the builder design pattern moves the logic and code of construction into another class which becomes responsible for generating instances of a given class.
Proxy • Book definition: • The intent of the Proxy pattern is to control access to an object by providing a surrogate, or placeholder, for it. • Comment mode on: • In other words, the proxy design pattern provides a stand-in for a desired object
Client code has access to the stand-in while a reference to the desired object is being obtained, for example, whether through construction or from an external source. • Even after a reference to the desired object is obtained, client code may continue to use the proxy as the “interface” to that object
In summary: • Singleton puts a constraint on construction. • Prototype basically means making a copy method and is closely related to cloning. • Builder puts the responsibility for construction into an outside class. • Proxy substitutes one object for another, desired object.
In one way or another, these patterns all have something to do with cloning or construction • More specifically, they have to do with replacing simple construction with something else which also provides a reference to an object meeting the needs of the code.
These are concise mnemonic devices for these design patterns: • Singleton: One to a customer. • Prototype: Partial copy. • Builder: Offload and delay construction. • Proxy: Placeholder or stand-in.