Wednesday, November 14, 2018

We Are Our Habits

We are our habits. Per James Clear our habits are a vote for who we are. Each time we do something we are reinforcing an ideal of ourselves.

James even mentioned that if identify with being someone who is fit, if one day we really failed to prioritize a workout, it would be worthwhile to do just 5 push-ups. Not because this would be enough to make us physically stronger. But because it would reinforce the habit of who we are. We are voting ourselves into the office of fitness.

A good side effect of this strategy is that because starting is the hardest part, once we get started we will probably end of continuing. Those 5 push-ups could lead to an entire sweaty workout.

Monday, November 12, 2018

Perfect Code is the Enemy of Code

I'm trying to add a feature for CustomJournal prompts that auto expand and de-expand. This would come in handy when I do my daily review of 3 amazing things that happened today. I'll come up with 4 or 5 things and then just add them all in on the 3rd line. But it would be nice if a new line could be created instead.

So I'm trying to figure out how to write the code and I'm stuck because I have multiple ideas pulling me each way. I could get the feature done easily but the solution would be quite messy (because my previous architecture did not account for this) or I could do a whole bunch of cleanup and refactoring.

Which led me to think about the tradeoff of FaceBook's famous move fast and break things/Done is better than perfect motto. The idea is that speed and shipping is a feature too and if you take too long to ship you are depriving the customer of using that feature (even while not perfect) and also depriving yourself of getting valuable feedback.

As FaceBook grew, of course, they realized that they could no longer break as many things and move as fast. User's would complain and they had much more to risk than they had to gain. Thus the value of perfect (or near perfect) became more valuable than the value of getting a feature out faster.

I of course have an app that a small amount of user's love (but not many total users: ~150 monthly active to date). Its also making me about a sale a week which is pretty negligible (doesn't impact my life at all) for me.

So move fast and (but hopefully not) break things it is. Refactor when I need to

Sunday, November 11, 2018

Malaysia Restaurants are not Thread Safe

One of my favorite software related posts is Starbucks Does Not Use Two-Phase Commit. Its amazing because it boils down a technical topic into real world terms. Its much more easy for us to grasp when we see it in some form that we can relate to (we all are familiar with Starbucks). And just seeing it in a different form helps our understanding.

I noticed one so far over my trip in Malaysia. I'll sit down in a restaurant and a server will take my drink order. After that server has left, another one might notice that I have no drink and ask for my order. I simply tell them that I have already ordered and they go on their way.

This system is much different than what you get in almost every restaurant in the United States. In the US the waiters synchronize between themselves. Usually one is assigned per table. In Malaysia, its anything goes. If there is a person that looks like they haven't ordered yet. Then take their order.

If you think about this in terms of worker threads. In the US the waiters keep the state and coordinate between each other (using various other protocols) but in Malaysia they rely on the customer to keep state and filter out duplicate requests.

The downside to this is that my experience is a negligibly worse as I get redundant requests and have to explain that I already ordered. However, there are some good benefits to this as well.

1) Its more efficient and faster. I get my order in from the waiter that notices first.

2) Its simple for the waiters. They really don't have to communicate with each other


I only noticed this because I very infrequently have seen it back at home but now it seems to happen to me all the time. There's nothing wrong with this strategy for me as I'm not annoyed with the second request. I just think its interesting how regional this system design seems to be.


Friday, November 9, 2018

These Cities are Built for Cars


I love exploring a city by foot. It's an excellent way to experience a city. But particularly in Penang and Malacca, I noticed something interesting: I'm the only one doing it. For example, in Malacca I took a walk from Jonker street to the Melaka Straights Mosque. It was less than an hour each way which is a not bad at all; an excellent way to get a sense of the city. But once I got off the main tourist area I really didn't see any other tourists the entire way.

What I did see were a bunch of buses, big and small dropping off the tourists.I think there's 2 main reasons for this.

The first is that there is a general culture of not walking. Many of the tourists are Chinese. I remember I was hiking in ZhangJiaJie which is the beautiful national park where Avatar was based off of. There were millions of Chinese tourists in that park that it felt like a single file line through the park. However, once I got to the more strenuous climbs, there were only foreigners like myself. It was comical to me to see that all the foreigners had chose to do this medium difficulty hike where the sea of Chinese tourists had passed (and the reward at the end was amazing)

Which leads to the second: these cities are made for cars, not people walking. I was having a discussion with friends (some local) in Penang and were talking about how terrible the traffic was and how hard it was to walk in the city. In Penang in many places there is no sidewalk. You just walk on the side of the street and hope a car doesn't clip you. There are so many cars, sometimes crossing the street gets tricky: And as there become more and more cars on the road it becomes harder to invest in public transporation and non-car infrastructure. "The Malaysian government doesn't want to invest in these things, they just want to sell more cars!". "It's ok"  I reply "This isn't a problem just in developing countries, even back at home in the San Francisco Bay Area we have the same problem." The infrastructure worked when there weren't as many cars are on the road. But now that there are a magnitude more cars on the road than what was originally planned for, we end up with severe traffic jams every day and not a good way to change things.


These 2 feed each other as well. If walking and biking is not an option at all then we lean towards cars, which leads to a car culture, which leads to more cars and more developing the city towards cars (more lanes, more parking lots).

Its sad for me because walking such a fun and healthy (and environmentally friendly) way to see the city. But as I suck in more fumes from from buses passing by, I might have to give it up.

Understanding Your Customers (Lottery Edition)

A billion dollar lottery recently happened and there was a lot of talk about buying lottery tickets. What would you do if you win?

But I want to point on one specific argument that I heard regarding buying lottery tickets. It comes from the guy who thinks he is a bit more clever then the rest. They might say something like "The lottery is a tax on people who are bad at math" or "Playing the lottery is for suckers because it is -EV (expected value)".

If you don't like math, just skip this paragraph. Its not absolutely necessary you understand this to get the picture. Let me explain first what the person is trying to point out. EV stand for expected value and it is the amount of gain or loss you are expected based on real probabilities. So for example if you and your friend flipped quarters, and the loser paid the winner money after each flip, then your expected value would be 0. Since we know that the probability of a coin flip landing heads or tails is 50%. Then you could expect to win half the time and lose half the time. You would be expected to net out. Note that although your EV is 0, what actually happens may be drastically different than the expected value. Your friend may win 5 coin-flips in a row and take all your money. However, based on the law of large numbers, the more you play, the more likely the results will be close to the EV.



The true expected value of the lottery is actually tricky because it depends on the number of people playing and factoring in taxes. There are cases where the lottery can actually be +EV (but due to game theory this usually doesn't last for long). So in general, your friend is correct in saying that it is a losing proposition to buy lottery tickets. For each dollar you put in you are expected to get much less back.

And we could leave it there. But that's not the point. What that person is really missing is the reason why people by lottery tickets. And it isn't to make money. That's right, most people do not buy lottery tickets to make money. If you asked them about their odds of winning or at least if they believe they will make money, I'd think that nearly all of them would understand that they will likely lose money. So why do they buy? They are buying the experience of owning a lottery ticket. To be in the game. To dream and talk to their friends about all the things they will do and buy and how their life will change. They are happy to be in the game rather than be left out. There are a so many reasons for buying a lottery ticket, "making money" is probably one of the least common reasons.

And I'm certain The Lottery (the company) understands this well as their commercials are perfectly aligned. They show a couple frolicking in their newly bought mansion next to the beach and ask "What would you do if you won?"

Another lesson in understanding why customers buy a product and those who say "People are stupid, playing the lottery is -EV" just don't get it. 






Wednesday, November 7, 2018

Opportunity Cost

I'm writing this right before catching my bus from Ipoh to Malacca. I have 30 minutes so I will spend 30 minutes. If I had more time I'd probably waste it. So this is perfect. Just enough time to quickly touch on the concept of opportunity cost.

When I was quitting my job. I was explaining to my friend about how, even though I had cut down my expenses drastically, it was really expensive for me. The reason is that quitting your job has another cost associated to it which is opportunity cost: the cost of the salary that you aren't receiving anymore. So I was giving up quite a good amount of money to pursue something else.

However, it wasn't until much later after that conversation that I realized opportunity cost cuts both ways. If I was still at my job working, I'd be thinking about the opportunity cost I was giving up (my time as I was getting older, the different experience) by continuing to stay at my job. There is cost of missed opportunity to everything we do.

There's definitely a grass is always greener mentality to this as well. We fall into the trap of thinking that the other opportunity is better than the one we are in.

And there's one last observation that I want to point out. Its easy for use to be trapped by the opportunity cost. For example, if you were to only think about maximizing money, and if you were making a fairly good salary like I was at my engineering job, then if you wanted to maximize it then the rational decision would be to work in that job for as long as possible. And this is the decision that traps many of us. As we get paid ever more and rise in the ranks, we find the decision to change harder and harder. There is so much sunk cost it would be crazy to give that up, even if we notice that our path might not be the right one. "Oh well, we are already this far and it isn't that bad, might as well keep going"
Its easy to hold on to that idea of maximizing profit and we end up with a life that we are unhappy with.

The Green Shark

I was sitting on a plane once and two kids were playing on the seats next to me. One of them, couldn't be more than 5, was being pestered by his older brother. The younger kid had a little plush blue shark that he was quite fond of. The older brother kept calling the shark green on purpose which the little one would cry out "No its not! Its blue!!" in an annoyed tone. But the brother kept on insisting it was green, trolling the younger kid.

After hearing her younger son scream "no its blue!" angrily a couple times the mother got annoyed and asked the child. "What color is the shark?"

"It's blue" replied the child.

"Ok you know the shark is blue, stop worrying about what your brother thinks" she instructed.

It was comical to witness the entire scene and particularly the behavior of the young child. Why did it matter to him what color his brother thought the shark was? Why did he get so angry and annoyed about it (being teased in itself)?

Some thoughts:

1) The child doesn't know how to deal with a trolling situation, he understands he is getting teased, and gets angry about it

2) "Someone on the internet is wrong!" syndrome. Some people can't let it go and need to make sure the person who is seeing things differently changes their mind or at least understands. The child is angry that his brother is wrong

3)  Maybe its the fact that it is his brother and not some random person on the internet. Maybe the brother is respected by the younger brother and part of his tribe. Thus it is important that someone so close to him understands and sees things the same.


It was an interesting situation and the more I think about it, the more I lean towards 1 as it is the simplest (Occam's Razor!).

Do we have our own green sharks?

Could there be some takeaway from this situation? Maybe we all have experienced our own green sharks: when someone tells us something is different then what we clearly see.

I think the mom's advice is good in most situations: ignore it. Let them have their opinion and move on.

but... what if they are wrong? Which is why it is so situational dependent because in some cases it is the responsible thing to inform and educate. Dialog is good for both parties, but when it crosses that, let them have their opinion. Don't forget.. what if it is YOU who is wrong?

As our communities grow and opinions spread, our goal should not be to convince everyone to see things the way we, or our tribe, sees things. Instead it is more important that we learn to co-exist with the with other's opinions.








Monday, November 5, 2018

Blogging is Not for Other People

I was listening to Seth Godin on the 1% better podcast and although Seth is not big on giving specific tactics (like what his morning ritual is or what his habits are). He did relent and give what he thinks is the single most valuable, actional thing someone can do to improve themselves: blog every day for 1 month. Every day, make a prediction or give some advice. That way, you will notice things in the world and make better predictions and give better advice over time. When facing the argument "the world doesn't need the another blog", he brilliantly agreed and pointed out that the blog is not for other people. It doesn't matter if you share it with anyone. It doesn't matter if you use a pseudonym. "The world doesn't need more people to run the Boston marathon. But you should run anyhow".

My advice for today is passing on the one from Seth: blog everyday. Not because you will get rich or famous. Not because anyone will actually read your blog. But, similar to running, because it will have a profound impact on yourself.

Training our Minds

We go to the gym to train our bodies. We sign up for CrossFit or do Yoga at the gym. Regular practice keeps our bodies in tip top shape. But what do we do for our minds?

In this information age our attention is bombarded with more signals and information than ever. It's only going to increase. We are mentally strained when we come home from work. Then we go on Facebook, or watch TV, or do a million other things on the internet, each soaking up another drop of our attention.


I'd argue in the future, that training our minds will be just as important as training our bodies. It won't be uncommon for people to sign up for mental "gyms" as it isn't uncommon for people to sign up for gym membership.



What are some of the things we can do to train our mind?

The first step is to disconnect. Anything that gives us a break from the information stream. That means turning off our devices and making sure we silence those buzzes and beeps. It might mean getting away from the noise, like going on a hike in nature or just staying home and sitting in silence. Mediation has become a big one. So many well accomplished people have attributed their success to their daily meditation habits.


Then there's training our thoughts. This means thinking about the things that we want to be thinking about. It might be practicing affirmations, reflection on past events, reviewing your goals and commitments. Maybe stoicism appeals to you and you practice worst case scenarios so that you are prepared for anything. Practicing gratitude, being grateful for what we do have vs what we do not, is a great way to stay positive and happy.

There are many ways we can train our bodies and it is similar for the mind. Choose whatever appeals to you, just know that it is just as important. If you looked at your body and saw some unappealing curves or if you lacked energy, you would probably go to the gym. The same should be true for the mind. If you feel a lack of energy (there is a lot of synergy between mind and body) or you feel overwhelmed, or you see yourself unable to focus and easily distracted, then join a local "mental gym" near you!

*shameless plug: I am the creator of CustomJournal which is an Android journal that allows you to tailor your mental workout. You can use it for gratitude, goal planning, review, and more.

Saturday, November 3, 2018

You are the Average

Everything is contagious. As human beings, we naturally draw our worldviews from around us. We become the average of the 5 people we are around the most. If they are fat, we will be. If they are rich, we will be. If they are sad, we will be too. The opposite is true as well.

In order for us to change our state, we can focus on changing ourselves or our environment. If we just focus on ourselves, we need to take into consideration this rule of averages. If all 5 people (for whatever metric you chose) are below you. Then they could be pulling you down and you would be fighting significant resistance. Its possible that you are strong enough to pull them up, but more likely than not you will be unable to overcome the resistance.

Instead if you find the group of people you aspire to be like, they would pull you up to their level. Its more likely you get pulled up to them vs the opposite because you want to be there.


The real world is much more messy than this. I'm not saying to find new friends but I am saying to think about how the people around you are affecting you and which way the gravitational forces are pulling. Who in your group is the stubborn one, unwilling to change their ways, having a negative impact on the rest? Who is the high achiever spreading positivity and encouraging others? Who outside your group, who is someone or has something you want, might you want to spend more time with?

Assume Failure

We all make mistakes. It happens to the best of us. We break our diet and eat a bunch of sweets until we feel sick. Or we set a resolution to write everyday but our calendar says we haven't written in our blog in a month. 

If we assume that we are not perfect and build imperfection into the model itself, we would do better.

So if I plan on going on a diet I should assume that I will have times where I will be peer pressured into enjoying deserts out with friends or have a late night pizza craving once in a while. That means my rules should allow cheat days. Or, maybe the real metric I should be tracking is how many days it takes me to get back on track after a miss.

That might be the most important thing. Psychologically, one day of breaking the diet might make us feel like we failed. We are incapable of staying on the diet. That might cause us to give up. But challenging ourselves to correct course after veering off keeps us in the game.

In my days of software development, almost every engineer will write code where the main way of using the feature will work. We call this the happy path. However, the excellent engineers are the ones who are able to see and plan for the failure cases ahead of time: "System A is supposed to get data from system B. But what should the user expect to see if system B unexpectedly goes down?"

When setting up a goal. The same thing should apply. Don't just think about the happy case. But consider what you plan to do when things don't go right.