DEV Community

Discussion on: Explain Lazy and Eager Loading Like I'm Five

Collapse
 
rhymes profile image
rhymes • Edited

Someone gives you a box of candies.

Lazy loading: you're hungry, you know where the box is, you open it and eat all the candies, you close the box

Eager loading: you open the box, you put all the candies in your mouth, you close the box and when you're actually hungry you start eating them

candies = resource
box = connection
mouth = memory
eating = resource usage

Hopefully you only get a mouthful of candies, because if they are too many you can't fit them in your mouth so eager loading won't work and you'll end up with an issue :-D

Collapse
 
phallstrom profile image
Philip Hallstrom

I can't seem to get passed the "put all candies in mouth" and then NOT eating them immediately :)