MacBook: Should I close all applications before going to sleep? Picture this:
It's 2 am, I'm coding, got XCode, a Browser, a Terminal... running and want to call it a day. I know very well that the next thing I'm doing on my MacBook is exactly where I left off, so with the same windows, tabs etc.
My question is:
Is it good practice to close all my applications before I put my MacBook to sleep (not shut down, just sleep)?
I've found an old post where they discussed this, regarding the time it takes to wake up your MacBook and get back to work. But what I want to know is, if leaving applications open drains my battery, or if it has any bad effects on my device over the long term.
Thanks
...what I want to know is, if leaving applications open drains my battery, or if it has any bad effects on my device over the long term.

Yes, it drains your battery, but it uses a fraction of energy than when awake.  When your Mac goes to sleep, it suspends all of your applications in their current state in memory meaning that (CPU) processing and disk activity have all been stopped, but the application state is in memory being supported by battery - so yes, your battery will drain.
However, when your Mac goes into hibernation it will write those saved states to a sleep image in which your Mac is all but turned off.  If the battery drains completely, the memory states though lost in RAM are preserved in the sleep image.
For more information, see Use sleep and Energy Saver on your Mac

or if it has any bad effects on my device over the long term.

Why would it?  Whether your Mac is fully operational and memory is being utilized versus in sleep mode where memory is also being utilized, there’s nothing that the latter condition is going to do to “have bad effects on your device over the long term.”   Memory just holds values and when you get down to it, it's simply holding on or off states (the 1s and 0s) representing values.
Whether it’s holding a spreadsheet, an photo, an animation, or the state of your application, it affects the memory no differently.  It doesn’t matter if your CPU is doing things with that memory or it’s in a static state, it doesn’t have adverse effects to your computer - it’s doing what it’s designed to do - hold on/off states representing values so long as there’s power.  In fact, an argument can be made that computer that’s awake causes more “wear” on one that’s asleep or hibernating.
Bottom line, the sleep/hibernate function has been used on all computers - Windows, macOS, and BSD/Linux alike across many different architectures like X86, ARM, RISC, SPARC and PowerPC - it’s a mature technology that works very well.  It’s designed to be a convenience feature that has no detrimental effects to your system.