PyTut: (Teminology) To clone, copy, or spawn -- that is the question!

Discussion in 'Python' started by Rick Johnson, Jan 16, 2013.

  1. Rick Johnson

    Rick Johnson Guest

    PyTut: (Teminology) To clone, copy, or spawn -- that is the question!

    I've many time seen these three words applied improperly as symbols and believe i should explicitly define these terms in a programming context so that we all might use them correctly.

    Also notice that i did not mention "deepcopy". I did so for good reason because i believe the term "deepcopy" should NEVER be used in a programming context anymore (maybe anywhere).

    Firstly let's understand the English definitions of clone, copy and spawn:

    Define: Clone
    1. A cell, cell product, or organism that is
    genetically identical to the unit or individual from
    which it was derived.

    2. Something that duplicates, imitates, or
    closely resembles another in appearance, function,
    performance, or style: All the fashion models seemed to
    be clones of one another.

    [Disambiguation] In the first definition, a clone is an object that is created by building an new object whos' internal structure is perfectly /identical/ to the internal structure of the existing object. In the second definition an object imitates another object so closely that an observer cannot distinguish between the individuals of a group and consequently refers to all members as a whole. Both are correct within their respective relativities, however, the first definition is based upon /tangible facts/ and the second depends on an observers' /interpretation/.

    Define: Copy
    A thing made to be similar or identical to another.

    [Disambiguation] I believe this definition is self-defeating. Maybe even expressing circular reasoning. Can something be similar or identical? I thinknot! identical and similar are NOT interchangeable. My /strong/ opinion isthat ALL copies must be /identical/. Not only in appearance, but in every possible detail; internal structure, state, EVERYTHING!

    Define: Spawn
    To bring forth, or generate.

    [Disambiguation] This definition is the correct base definition of "spawn".However, the definition does disqualify specific use of the word leaving only general usage. Sure, we are creating (or "spawning") /something/, but what /exactly/ are we creating? Also, we have no hint as to which paradigm will be used to do the creating; will the result of this "spawning" be an *exact* copy of "something", or a /similar/ copy of "something", or somethingnew that is based on a paradigm of creation for which we are oblivious? Who knows?

    Terminology Transformation

    If you ever find yourself in a situation where you need to create a new object from an existing object, be sure you use them following these simple and intuitive rules:

    * Clone: Only use "clone" when you intent to create a new object that is an exact replication of the existing object (interface) but NOT an object that will be initalized with the existing objects' state! The new clone should look like the old object and interface like the old object, HOWEVER, the new clone's state should be a default, NOT A COPY!

    * Copy: Only use "copy" when you intend to create a new object that is an EXACT copy of the original object. Yes, that means all the way down to the deepest nesting, farthest corners, and smelliest nether-regions of the object! I don't like the term "deepcopy" because there is only ONE type of copy, and that is the *EXACT* copy.

    * Spawn: This term is so general that usage of it should be limited to /very/ generic interfaces. Interfaces that need to create something in a "factory" type manner would be a good example. These interfaces should be low level. Interfaces existing above should provide more specifics and use the copy or clone terminology appropriately.

    Rick Johnson, Jan 16, 2013
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tim Tyler
    Aug 8, 2010
  2. lordy

    To clone or not to clone..

    lordy, Jul 7, 2006, in forum: Java
    Jul 7, 2006
  3. Derek Basch
    Donn Cave
    Jan 21, 2005
  4. Alex
  5. Replies:
    Roland Pibinger
    Sep 1, 2006
  6. Ed Hames
    Ed Hames
    Apr 16, 2008
  7. Edgardo Hames
    Ed Hames
    May 6, 2008
  8. Rick Johnson

    PyTut: Tkinter #1

    Rick Johnson, Mar 1, 2012, in forum: Python
    Rick Johnson
    Mar 1, 2012