Showing posts from May, 2023

I can't think in NoSQL (and neither can you)

If you're like me, a programmer taught how to think in terms of relational databases, you just can't design a NoSQL. Wait. No one can design a proper NoSQL database for relational data because it's a data store built on tradeoffs.  I have very relational data that I am being forced to feed into Firebase just because of how convenient Firebase is to set up. Here's a simplified problem statement: There are User s, each of whom has an email , name , and gender . These users can be friends , and have to consent  to their friendship - sent , pending , and accepted . Create a NoSQL json table such that there is no duplication of data, and each user is able to query a list of their friends including invites with all the user details. Your tradeoff is effectively choosing between optimizing one of either read or write . No matter how you structure your code, you'll end up with either: Optimize reads, data duplication ( View Code ) Each user contains all of their friend&#


“You know we’re still friends because life has it this way” she remarked, “there are certain things in life you chose. That you have complete control over and no matter which way the river flows, you’re always headed north. Then, there are other things that just work out in your favor. Like our friendship. You live in Europe and I live in UK, and what’s more when we go back home to India we live half an hour away from each other. How big a coincidence is that. Sure we plan trips and we make time to speak with each other. But that’s all hinged on being in close proximity. The further away we’d stay, the more our lives would change, and slowly our boats would drift apart. Imagine if I had taken up the offer to study at CMU. I’d be a poor student looking for a job. Right now, we bond over having moved away from home and setting up our own lives. As a student you just wouldn’t get my everyday problems. Heck, current me wouldn’t identify with student me. I think that’s it. We’re still close

Relationship Alphabet

At dinner in New York, A told me how he waited many years for the right one. He always wanted children. Now he sacrifices his career to pick them up and drop them off to school everyday at age 50. At lunch in the office, B told me how his wife decided to take a step back from her career and take on a part time job. Her mother was never there for her. She wanted to be there for her kids. On our monthly catch-up, C tells me they’re pregnant. He was very happy. He later told me she’s 5 years older than him and that it was a real challenge to conceive. He’s ecstatic. At his desk, D told me he broke up with his girlfriend of 6 years. He’s 32, but he’s moving to California to start a new life. He can always come back to Germany, he says. On a video conference, E told me he’s quitting his job to move to Barcelona. This was the first time in 2 years he mentioned he had a daughter. This was also the first time he said he’s a divorcee. Right before our half marathon, F tells me they’re enga

She's a canvas

The first time I met her, she was a canvas. A mystery, a piece of art yet to be painted. Was she 25? Was she 30? She looked like she had a grip on life. Like she knew what she was doing and why she was here. She moved her hair away from falling in front of her eyes. "Hi", I said breaking the invisible barrier. "You're gorgeous and I want to get to know you" is what I wanted to say. We spoke for an hour of things she was working on while sitting there, of things I was working on while sitting there. I felt as though I had uncovered a brush stroke on this artwork I was unravelling.  The next we met, we spoke of the stars and the universe, of our pasts and of our plans. There was depth beyond what one first sees. Getting to know the state of mind of the artist during the creation of the now finished piece you're looking at. The third time we met, she told me of her traumas. Of her struggles and of her worries. I realized then that what was once a mystery was no