DEV Community

Discussion on: Explain "Memory Safe Programming Languages" Like I'm Five Please

Collapse
 
rdrpenguin04 profile image
Ray Redondo

Well, you know there are things in this house that you aren't allowed to touch because mommy and daddy say so? That's because we're in a safe family. If you were in an unsafe family, where mommy and daddy didn't watch after you, you'd think you would have so much more fun. You could do whatever you want to with no consequences.

But the consequences still exist. You still get burned from touching the hot stove. You still get hurt if you trip down the stairs. You still get sick if you touch medicine you don't need.

Memory safety is like parents, but for computers. Old-timey programmers didn't think they needed a mommy and daddy to tell them what to do. They never learned what it was like to feel safe. They instead got used to burning themselves. That doesn't sound like fun now, does it?

Collapse
 
rsenna profile image
Roger Senna

And Rust is like parents with very strict rules. They won't help you, only forbid you of doing some things. And if you manage to burn yourself anyway they will tell you "Your fault, we warned you but you didn't listen"!

Collapse
 
rsenna profile image
Roger Senna

And Java, C#, Python are like "Don't worry, go play, we will clean it up everything afterwards" 😅

Thread Thread
 
jendoodle profile image
Jen Lewis

Except for event listeners. I know C# doesn't completely clean up event listeners (not sure about java). One of the nastiest memory leaks I've seen in my career was from not unsubscribing to event listeners properly. Funnily enough this was on a government project also.

Collapse
 
rdrpenguin04 profile image
Ray Redondo

I'd more say Rust is like parents that trust you. They will tell you what to do unless you can tell them why you don't want to do it, and they'll let you find out the consequences of your ignorance then :)

Collapse
 
jess profile image
Jess Lee

HA! As a parent with a toddler, I extra love this response.