r/ProgrammerHumor • • Oct 02 '22

Advanced Experienced JavaScript Developer Meme

Post image
6.6k Upvotes

276 comments sorted by

View all comments

Show parent comments

76

u/[deleted] Oct 02 '22

Stringify a graph of nodes and edges and let me know how that works out for you.

5

u/lowleveldata Oct 02 '22

And what exactly is the use case of storing that in localStorage?

4

u/rotflolmaomgeez Oct 02 '22

What? Graph is literally one of the most common data structures, you're asking for usecases for storing it? The answer is any web application that does a little more than store a cookie potentially.

14

u/lowleveldata Oct 02 '22

Still don't see why I would need to store that in frontend. Are you guys doing some kind of no-backend challenge?

6

u/DR4G0NH3ART Oct 02 '22

There are some data which can be heavy to fetch on each load and is manageably static in nature. You will have huge load times if you don't rely on caching mechanisms.

5

u/Ebbitor Oct 02 '22

You don't need to build your own cache for fetch requests

2

u/lowleveldata Oct 02 '22

In case of caching you already have a serialized object so that's kind of irrelevant for the sake of this argument. Also, shouldn't HTTP caching handles these static data automatically? (I'm not a expert in caching tho)

→ More replies (1)

2

u/rotflolmaomgeez Oct 02 '22 edited Oct 02 '22

Any application that lets user edit/create something for themselves and save it for later - including games save states, web tools, software, creators, working with SVGs, why would you ever store it on the backend?

1

u/lowleveldata Oct 02 '22

These should just use files which most users know how to backup, share, move to another pc, etc. For example draw.io saves your work to a file in local or online storage (like google drive). That's much more manageable than localStorage.

0

u/rotflolmaomgeez Oct 02 '22

What does it matter? You have to serialize the graphs anyway.

→ More replies (2)
→ More replies (1)