Here’s a puzzle for you: you have a bucket of raw, unpeeled shrimp. You need to transform this bucket into cooked, peeled, deveined shrimp. What’s the order of operations?
The answer, my friends, is to first devein the shrimp, then cook them, then peel them.
I prefer cooking them in the shell because you get a more intense flavour than if you shell them first. It also affords a bit of protection from overcooking (but not much, so you still need to pay attention!).
Most importantly, if you plan on deveining them, then you need to do it before you cook them. Once you cook them, the opaque flesh makes it hard to see the vein, much less get it out.
And just so we’re clear: “vein” is a nice way of saying “poo.”