Background to my question:
I watched a recent episode of The Expanse where the ship's captain
self-nuked a main battleship/flagship to keep it from being captured.
It got me thinking, in-universe this appears to make no sense!
Ships having a self-destruct is a thing across many books/movies. Is this done only for "drama"?
Scuttling a ship and/or melting down certain tech (cryptography machinery e.g.) prior to capture makes good sense regardless of setting but blowing everything and everyone up seems a mere conceit to the writers craft.
I can imagine that at times a self-destruct may fit the story - Borg assimilation or other wars of total annihilation of the human species. Otherwise it just seems dumb to me.
Further proof of this device being merely a conceit, and not a coherent in-universe thing, is the fact that no matter how badly damaged the ship is it always retains the capacity to self-destruct. All other systems are fair game for being knocked off line but the self-destruct is somehow indestructible (until it's actually used of course).
Even the movie Galaxy Quest pokes fun at this by having the characters fail to disable the self-destruct at the last moment and it doesn't blow up because, well, it never has before so obviously it's supposed to be built to stop at 0:01:14 time remaining :D
Am I missing something?
~~~ So here's my edit. ~~~
There is lots of talk in answers and comments about "scuttling" a ship. I'm not asking about how one might scuttle a spaceship. If you re-read my question, now helpfully bolded or italicized to show clear emphasis, you will see I call out scuttling as a sensible procedure.
What is not sensible is atomizing the ship in a massive explosion, particularly while friendly people are still on board or near-by. Self-destruct is not scuttling a ship! It's turning it into a crazy up scaled IED. As it is usually presented, self-destruct is simply insane. And itt's the suicide-bomber part that bothers me.
If it was such a great idea it wouldn't be found only in fantasy literature, right?
As for methods of effectively scuttling a spaceship.
"Scuttle" it into a gravity well; "Scuttle" it by radiation "leak"; "Scuttle" it by fusing all critical electrical components; "Scuttle" it by giving it extreme rotational momentum at the time of abandonment; etc.
Excepting in science-fantasy settings, the hard vacuum of boundless space is a great place to scuttle a ship. Especially if you've toasted the critical components, then salvage is of dubitable worth. And for those who think spinning a multi-thousand-metric-ton ship at high speed and sending it off into deep space isn't a good way to scuttle it, then you need to consider how you would actually go about salvaging such a ship. How apart from tech that is really just a different name for magic that is (cough>transporter< cough).
~~~ So here's my 2nd edit ~~~
It seems the USS Halibut may have been under orders to scuttle itself with all hands on board if necessary to avoid capture. While this is seemingly a real example of mass suicide by the decision of one (or a few) senior officer(s) as a standing order,
it still fails as a direct comparison of what happens in The Expanse. Given the tech level exhibited in the show, self-destruct is a completely unnecessary method of keeping secrets IMO.