Programming Tips πŸ’‘
51.6K subscribers
67 photos
10 videos
30 files
354 links
Programming & AI:
Tips πŸ’‘
Articles πŸ“•
Resources πŸ‘Ύ
Design Patterns πŸ’Ž
Software Principles βœ…

πŸ‡³πŸ‡± Contact: @MoienTajik

🎯 Buy ads: https://telega.io/c/ProgrammingTip
Download Telegram
Value Types in the Real World 🌍

Suppose you’re reading something fantastic, and you want a friend to read it too. πŸ“œ

What do you need to give your friend so that he can read it too❓

To give your friend a copy, you’d need to photocopy all the pages and then give it to him, At that point, he has his own complete copy of the document. πŸ“ƒ

In this situation, you’re dealing with value type behavior❗️

All the information is directly in your hands, you don’t need to go anywhere else to get it.

Your copy of the information is also independent of your friend’s after you’ve made the copy. πŸ‘₯

You could add some notes to your pages, and his pages wouldn’t be changed at all.πŸ™…πŸ»β€β™‚οΈ

γ€°γ€°γ€°γ€°γ€°γ€°
#Types #ValueTypes
@ProgrammingTip
Reference Types in the Real World 🌍

Compare that with the situation where you’re reading a web page. 🌐

This time, all you have to give your friend is the URL of the web page. ↗️

This is reference type behavior, with the URL taking the place of the reference. ↔️

In order to read the document, you have to navigate the reference by putting the URL in your browser and asking it to load the page. ☝🏻

If the web page changes for some reason, both you and your friend will see that change the next time each of you loads the page. πŸ™‡πŸ»

γ€°γ€°γ€°γ€°γ€°γ€°
#Types #ReferenceTypes
@ProgrammingTip