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

R

Rick Johnson

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.

-rr
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top