Cookies: A Basic Form of Data Persistence

Plus they’re delicious with milk…

Nicolai Safai
Code Zest

--

There are a lot of misconceptions about how cookies work, and I hope that this article can help clarify what cookies are, how they work and how they are commonly used today.

Disclaimer: I’m not an expert on the subject, and I welcome constructive criticism.

Why Cookies Were Invented

The Internet was originally designed to be anonymous. In other words, websites did not know who a visitor was. For example, if the same person visited 2 days in a row, the website wouldn’t know whether (A) 2 different people accessed the website, or (B) the same person visited twice.

Anonymity sounds pretty good, right? Yes, anonymity is an attractive proposition in many ways, but it can be pretty inconvenient. Imagine the following scenario:

Scenario: You go to a grocery website and you add 30–40 groceries you need. You get up to go to the bathroom, and when you come back to your computer, you discover that your roommate closed the grocery website. You frantically go back to the grocery website, and to your chagrin, you discover that hours of carefully selected groceries were lost. The website has no idea that you’re the same visitor that added those 30–40 items. You have to start over from the beginning.

How one feels after losing hours of progress

--

--

Nicolai Safai
Code Zest

Software Engineer | PM | Interested in Music, Design, Psychology & Education. “Make it Happen Captain”