# 'delete' vs 'destroy' etymology?

**URL:** <https://www.ruby-forum.com/t/delete-vs-destroy-etymology/67059>\
**Category:** Rails\
**Created:** [August 31, 2006, 11:25am UTC](https://www.ruby-forum.com/t/delete-vs-destroy-etymology/67059 "2006-08-31T11:25:21Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan\_del\_Stroth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a87d85/32.png) [@Jonathan\_del\_Stroth](https://www.ruby-forum.com/u/Jonathan_del_Stroth)\
**Post date:** [August 31, 2006, 11:25am UTC](https://www.ruby-forum.com/t/delete-vs-destroy-etymology/67059/1 "2006-08-31T11:25:21Z")

</div>

Why were the words delete & destroy chosen for those particular  
operations? It always seems to me that they’re the wrong way round -  
‘delete’ sounds like a careful removal, whereas ‘destroy’ sounds like  
wanton removal without regard for the aftereffects. Are there legacy  
reasons for the choice?

Jon

---

<div class="post-metadata">

**Author:** ![Jonathan\_del\_Stroth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a87d85/32.png) [@Jonathan\_del\_Stroth](https://www.ruby-forum.com/u/Jonathan_del_Stroth)\
**Post date:** [August 31, 2006, 3:54pm UTC](https://www.ruby-forum.com/t/delete-vs-destroy-etymology/67059/2 "2006-08-31T15:54:00Z")

</div>

Jonathan del Strother wrote:

> Why were the words delete & destroy chosen for those particular  
> operations? It always seems to me that they’re the wrong way round -  
> ‘delete’ sounds like a careful removal, whereas ‘destroy’ sounds like  
> wanton removal without regard for the aftereffects. Are there legacy  
> reasons for the choice?

Think that “delete” comes from low level sql command “DELETE”, i.e. dumb  
removal without any intervention from rails.

Zsombor

–  
Company - [http://primalgrasp.com](http://primalgrasp.com)  
Thoughts - [http://deezsombor.blogspot.com](http://deezsombor.blogspot.com)

---

<div class="post-metadata">

**Author:** ![Jonathan\_del\_Stroth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a87d85/32.png) [@Jonathan\_del\_Stroth](https://www.ruby-forum.com/u/Jonathan_del_Stroth)\
**Post date:** [August 31, 2006, 4:52pm UTC](https://www.ruby-forum.com/t/delete-vs-destroy-etymology/67059/3 "2006-08-31T16:52:13Z")

</div>

> Why were the words delete & destroy chosen for those particular  
> operations? It always seems to me that they’re the wrong way round -  
> ‘delete’ sounds like a careful removal, whereas ‘destroy’ sounds like  
> wanton removal without regard for the aftereffects. Are there legacy  
> reasons for the choice?
> 
> Jon

Haha, I’ve always thought the same thing 🙂 I’m guessing only David  
knows for sure.

–  
Rick O.  
[http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
[http://mephistoblog.com](http://mephistoblog.com)

---

<div class="post-metadata">

**Author:** ![Jonathan\_del\_Stroth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a87d85/32.png) [@Jonathan\_del\_Stroth](https://www.ruby-forum.com/u/Jonathan_del_Stroth)\
**Post date:** [August 31, 2006, 9:56pm UTC](https://www.ruby-forum.com/t/delete-vs-destroy-etymology/67059/4 "2006-08-31T21:56:37Z")

</div>

Rick O. wrote:

> > Why were the words delete & destroy chosen for those particular  
> > operations? It always seems to me that they’re the wrong way round -  
> > ‘delete’ sounds like a careful removal, whereas ‘destroy’ sounds like  
> > wanton removal without regard for the aftereffects. Are there legacy  
> > reasons for the choice?
> > 
> > Jon
> 
> Haha, I’ve always thought the same thing 🙂 I’m guessing only David  
> knows for sure.
> 
> –  
> Rick O.  
> [http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
> [http://mephistoblog.com](http://mephistoblog.com)

Newbie question:  
What does “destroy” check for and/or fix up that might get skipped by  
“delete”?

I struggled with this just a couple days ago and wound up apparently  
picking the wrong one since I couldn’t find any documentation (as usual)  
for the difference. Just something about “instantiates it first”; and  
since I didn’t particularly need to instantiate it, I chose “delete”.

thanks,  
jp

---

<div class="post-metadata">

**Author:** ![Jonathan\_del\_Stroth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a87d85/32.png) [@Jonathan\_del\_Stroth](https://www.ruby-forum.com/u/Jonathan_del_Stroth)\
**Post date:** [August 31, 2006, 10:31pm UTC](https://www.ruby-forum.com/t/delete-vs-destroy-etymology/67059/5 "2006-08-31T22:31:41Z")

</div>

Jonathan del Strother wrote:

> It always seems to me that they’re the wrong way round -  
> ‘delete’ sounds like a careful removal, whereas ‘destroy’ sounds like  
> wanton removal without regard for the aftereffects.

I think of it the other way around - delete sounds precise and  
smaller-scale, destroy sounds larger-scale and destroying something  
destroys it and usually things around it. That said, I’m not crazy about  
the term destroy – sound too video-gamey or something. 😜

Joe

---

<div class="post-metadata">

**Author:** ![Jonathan\_del\_Stroth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a87d85/32.png) [@Jonathan\_del\_Stroth](https://www.ruby-forum.com/u/Jonathan_del_Stroth)\
**Post date:** [August 31, 2006, 11:21pm UTC](https://www.ruby-forum.com/t/delete-vs-destroy-etymology/67059/6 "2006-08-31T23:21:15Z")

</div>

On 8/31/06, Joe R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Joe

obliterate?

annihilate?

massacre?

decimate?

too much caffeine.

–  
Rick O.  
[http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
[http://mephistoblog.com](http://mephistoblog.com)

---

<div class="post-metadata">

**Author:** ![Jonathan\_del\_Stroth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a87d85/32.png) [@Jonathan\_del\_Stroth](https://www.ruby-forum.com/u/Jonathan_del_Stroth)\
**Post date:** [August 31, 2006, 11:33pm UTC](https://www.ruby-forum.com/t/delete-vs-destroy-etymology/67059/7 "2006-08-31T23:33:17Z")

</div>

Jeff P. wrote:

> What does “destroy” check for and/or fix up that might get skipped by  
> “delete”?
> 
> I struggled with this just a couple days ago and wound up apparently  
> picking the wrong one since I couldn’t find any documentation (as usual)  
> for the difference. Just something about “instantiates it first”; and  
> since I didn’t particularly need to instantiate it, I chose “delete”.

Every ActiveRecord object can have ‘callbacks’ associated with it.  
These let you attach behaviour to certain points in the object’s  
lifecycle. For example, you could run validity checks on an object  
before it is created, or you could make it so that only objects that  
are in a certain state are allowed to be destroyed/deleted. Also, some  
of the built-in ActiveRecord facilities (such as :dependent =\>  
:whatever) internally make use of the callback system to do their dirty  
work.

When you use a ‘destroy’ method to delete an object or objects,  
ActiveRecord goes through the full process of creating the object in  
memory as an ActiveRecord object (AKA instantiating the object),  
checking all the callbacks and running them if appropriate, and  
deleting the row from the database.

In pseudo-ruby, calling User.destroy(1) does something like this:

user = User.find(1)  
user.run\_all\_before\_destroy\_callbacks  
user.execute\_sql\_to\_delete\_this\_row  
user.run\_all\_after\_destroy\_callbacks

On the other hand, calling a ‘delete’ method doesn’t bother with any of  
this. It simply executes a SQL statement to delete the row(s) from the  
database, and doesn’t give any other bit of ActiveRecord a chance to  
get involved. So, calling User.delete(1) does something like this:

User.execute\_sql\_to\_delete\_row(1)

As a rule of thumb, I’d say you should always use ‘destroy’. I’d only  
use ‘delete’ if I needed to for a specific performance optimisation,  
and if I was absolutely sure that the class in question had no  
callbacks or similar related behaviour attached to it.

Chris

---

<div class="post-metadata">

**Author:** ![Jonathan\_del\_Stroth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a87d85/32.png) [@Jonathan\_del\_Stroth](https://www.ruby-forum.com/u/Jonathan_del_Stroth)\
**Post date:** [August 31, 2006, 11:33pm UTC](https://www.ruby-forum.com/t/delete-vs-destroy-etymology/67059/8 "2006-08-31T23:33:25Z")

</div>

Rick O. wrote:

> On 8/31/06, Joe R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Joe
> 
> obliterate?
> 
> annihilate?
> 
> massacre?
> 
> decimate?

Or…

# destroy, a la War Games

object.GlobalThermonuclearWar

Or…

# AKA delete

object.kill

# AKA destroy

object.kill(:mafia) # I’ll kill you, your children, your children’s  
children, …

😜

Joe
