Good practices in coding

Like many things in our society, there is also recommended etiquette in coding. There are two practices, in particular, that I find important and useful.

First, it’s beneficial to painstakingly document your code. At the beginning of any program, jog down some lines on what the program is about. Then, before any function, write something about it. If you give aliases to variables or tables that have long names, put down some notes as well. If there is any logic behind the code, make it visible to others too. Often times, folks may understand the mechanics of the code, but don’t understand what the code actually does since they don’t understand the logic.

Below is an excerpt from a document in one of my first coding classes. In our assignments, if we forgot to document our code, we would have 5-10% of our grade taken away.

As highlighted in the screenshot, a detailed documentation is very helpful to not only others looking at your code, but also yourself later on. If a program is complex and there is no documentation, you’ll find it more difficult than it should be to refresh your memory on the code. I have been there and I don’t even write complex code!

Above is an example I had from my programming class. In practice, it doesn’t need to be that detailed, but the description section and the date are necessary in my opinion.

The second practice that I think is useful is to format the code. Normally, we tend to get carried away while coding and neglect how the whole program actually looks. Lines are not aligned. Blocks of code are nested and difficult to read. Brackets are all over the place, making it challenging to debug and understand the code. What I usually do is that after I am sure my program works as expected, I search for a website to help with the formatting of code (it’s easy, just google, for instance, HTML formatter) and have the website re-format the code so that it’s easier to digest.

Why I blog

One of my goals in 2019 is to write often and specifically, have at least 200 published blog posts when the year closes its curtains. So far I have been on track to meet the target. As I look back at the last 8 months of consistent blogging, this endeavor has brought to me so much more than I anticipated.

Last August, I started this blog as a medium to practice what I learned, share my opinion in my own way to give back, create a healthy habit and build up my self-confidence. Fast forward to now:

  1. I have learned a lot more along the way. To really write about something, first I need to know what I am going to write about. I read more quarterly/annual reports, earning call transcripts, industry reports, long blog posts, you know, the boring stuff to many of my peers. I listen to more podcasts, interviews. I read more books. I analyze reported numbers by companies more. And it leads to a lot learning; which fits the name of this blog.
  2. I enjoy the process. Writing is such a pleasant experience to me nowadays that I often really look forward to it as a highlight of my day, especially when I have a long day at work. Anne Lamott said it best: “Writing has so much to give, so much to teach, so many surprises. That thing you had to force yourself to do – the actual act of writing – turns out to be the best part. It’s like discovering that while you thought you needed the tea ceremony for the caffeine, what you really needed was the tea ceremony. The act of writing turns out to be its own reward.”
  3. I feel much more confident about blogging now than when I first started. Not because I am an expert now. I still have a long way to go. But I believe it is because of the practice. Blogging often helps me reduce my self-doubt and shyness bit by bit and gives my confidence a little boost. Even though the progress is nothing earth-shattering, as long as I don’t stand still, I am happy.
  4. I came to realization that this blog gradually is becoming a collection of my notes, a bookmarking tool, a mind-refresher. Sometimes, I come back to remind myself of some highlights in a book I read, of some code I wrote and of something that I jogged down. Instead of carrying an actual notebook which would be challenging to categorize and search, I know where to find what I need with just a few key strokes.

I came across a post by M.G. Siegler that really hit home to me:

Imagine the humiliation of putting yourself out there and zero people caring because zero people saw it. I know a lot of people feel this way when they start doing something with regard to content on the internet — I applied it to blogging, but I imagine it’s the exact same story with recording videos for YouTube, starting a podcast, etc. Just keep at it.

This is, of course, easier said than done. It takes time to do anything, no matter the type of content you’re focused on. The good news is that even if the audience doesn’t show up at first, the work pays off in other ways. Namely, you’ll get better at what you’re doing.

I look back at some of my early blog posts and cringe. They were awful. I was foolish. But I kept going and the posts got less awful and less foolish (this statement is subject to review in another decade). I honestly think the worst thing that could have happened was getting a large audience from day one. I wouldn’t have been ready for it (even if I thought I was).

And so again, the advice is simply to keep at it. Even if the next post gets zero readers too. And the next one. Eventually, zero turns to one and then one to two and then you’re off to the races.

M.G. Siegler

I know the feeling of having zero people view what you wrote all too well. Part of it is I don’t advertise it. I put a link to my blog on my Instagram profile, LinkedIn profile and in my resume. That’s it. I don’t actively post on Facebook or tweet about it whenever I publish. I am doing this for me first and foremost, not to be validated by others. Plus, I know I am not ready. Even though this blog has gained traction in the last few months , I am still on my way from zero to one. Good news is that I am willing to keep at it.

Don’t judge a person for his/her broken English

I had lunch with a friend whom I met in college today. It has been a while since we met and the meet was pleasant. In addition to catching up with what the other was doing, we touched upon what would seem to be quite a deep topic for lunch, but you could tell that we were close enough to open up on it.

Long story short, I told him the last time we met that I somehow felt looked down up on by Americans because I am Asian, because I don’t look big enough and because I don’t speak English like a native speaker. I have been trying hard since I was 16 and I wish I could, but the fact is that even though I speak the language well enough to get me a job and two Master’s degrees, I don’t talk like a native speaker.

The friend brought it back today. He talked about his encounter with a French engineer who uprooted his life back home to come to America to have a better career and life. The French guy doesn’t speak English well, said my friend, but my friend admired the courage taken to go to a foreign country alone, as he once told me. My friend said that the biggest lesson he had in the last few years was to learn that it wasn’t easy for others to come to the US and that no matter how good or bad someone’s English is, the effort to speak the language is already admirable and it shouldn’t be the basis on which judgement is passed.

As an immigrant, of course, I understand the sentiment, yet it is great to hear it from my friend. But if I have to be honest, I don’t use my inability to speak English natively as an excuse. To me, if I succeed, good. I did put in the work, but I was lucky as well. If I fail, well I was just not good enough. Coming here to study and work is a game. I chose to participate in that game and it just doesn’t make sense to say that my failure is justified because the rules are not in my favor. Nonetheless, I am happy to hear that from my friend and proud to have him as a friend.

For the compassion and humility, I have learned a great deal myself from learning technical topics such as coding and IT. I am always a believer in the notion that we all should try to find answers on our own first before asking questions or for help from others. It matters more to me that a person actually tried on his or her own first than whether he or she succeeded in finding the answer. But admittedly, I easily got irritated. I was arrogant. I got annoyed whenever I thought people asked too easy questions.

Since learning how to code, I have realized that I was…well, an asshole. Code is very binary. It either works or it doesn’t. There is nothing in between. When trying to find answers to my coding problems, I encountered numerous times guys who were better than me, but gave replies that asked more questions than answers. Some guys on StackOverflow or at school answered, but in a way that you couldn’t fathom unless a significant amount of time is spent on that or the person elaborated more.

When I was still an intern at an IT company, all the technical details and jargon floating around the office were initially another language to me. I had to, if I am honest, disturb some engineers in the office to help me understand even the basic concepts in their mind. I told them: “please speak English to me. I am dumb. Dumb it down for me”. I am glad that they did because it helped me tremendously then, now and in the future I believe.

Since then, I have learned the value of humility and compassion more. I have consciously made an effort to be very specific with words and visuals when helping others. I have consciously tried to be patient and understanding that the person processes information differently than I do and that I used to or still am in that position.

China, High Tech, Convenience and Privacy Concern

I was poring through the Youtube channel of Bloomberg, which features quite a few informative videos and this one was particularly interesting to me:

The video talks about a world of tech alternatives to what we are all familiar with: Facebook, Amazon, Youtube… Name one famous tech household name and there is a Chinese counterpart. Also, it shows a little bit of how QR codes and by extension, mobile payments are popular in the country. However, what is most interesting to me is the extent to which surveillance takes place in the world. In the video, a Western guy told a story of how his WeChat account’s money got deducted 20 seconds after he jaywalked in Shenzhen. That’s disturbingly fast. Plus, the government knows everything you do and ranks you based on your social behavior.

I have been of an opinion that an authoritarian leadership in China is a significant factor in its fast ascendency economically and politically in the world stage. Decisions are quickly made and there is singular focus as well as continuity due to the fact that there is one ruling party and for the foreseeable future, one ruler (aka Xi Jinping). On the other hand, decisions and policies take ages in the US and the pattern is, as I observe, that one president will undo all the work of the his predecessor, if the predecessor comes from the opposing party. The same may also be said to the ruling party in Congress.

On the other hand, it can be argued that privacy violations in the Western world are nowhere near as severe as they are in China. The NSA may have the same capabilities as the Chinese government in terms of surveillance, but we haven’t, thankfully, seen it do what the Chinese government is doing. Plus, the society we are living in allows us to practice freedom of speech more than the one in China. In the US, you can make fun of anyone in the government and Congress, though I don’t think you should do so in China.

If you think about it, we have speed of decision-making process due to one ruling party vs the lack of freedom, or convenience vs human right violations at the extremes. You can have one extreme at the expense of the other, but you can’t have both. It’s like the dilemma: does the means or the end matter more?

What works for this country will not likely work for another. I don’t know which one is inherently superior. I think it is just down to personal preference and perspective. Personally, I value freedom more.

Vietnamese movie: Wayless by Imaginary Friends

I came across this short movie by a group of Vietnamese folks. It’s great that the film won the Best Director category at 48 Hour Film Festival and will be screened at Cannes.

Have a watch and don’t worry as there is English subtitle. Below is the trailer:

3 questions/concerns I have:

  • What happened to the dog?
  • Don’t shoot people in front of kids!!!
  • Why keeping the body in the trunk?

Joking aside, I am happy for the team and glad that there will be some exposure to the international audience for Vietnamese films.

Finnish education

I was lucky enough to live and study in Finland for a while. It is and will always be my “second home”, even now that I have already lived in Canada and America as well. It is where I forged relationships that have been instrumental in my life ever since and where I grew up significantly as a person.

Finland isn’t a country rich in natural resources. Its population is just 5.5 million people. Yet, it’s one of the most advanced and happiest countries in the world. A key reason is its world-class education. There is no shortage of coverage on the greatness of Finnish education, so I am just going to tell you a few personal stories I had while living there.

In our Bachelor’s program, there was one math course. We Vietnamese grow up learning complex math problems so the kind of math we had in that course was pretty easy. My classmates struggled at first. Yet, I saw first hand that they spent only 2-3 hours a day after class on math problems and achieved progress that I knew myself I wouldn’t have had. It’s incredible and a bit shameful for me to witness. I had years of a head start, but deep down I knew that without it, I wouldn’t have been able to grow as much in a short amount of time as my Finnish friends.

The first ever class in our program was with our Dean in an auditorium of 80 students. We often had debates and presentations. Most Vietnamese students were very shy and quiet, yet my Finnish peers were confident, persuasive and critical, to the point that the Dean, who is a Swedish American, said this about one guy: “he is terrifyingly persuasive”. The same ability to communicate with confidence and substance was consistent throughout the time I was there, either in or outside of the classroom.

One time, I was sitting next to a guy in class. He was gluing his eyes to a book. I asked him what he was reading and his response was “An Arabic dictionary”. It turned out the guy could speak 6-7 languages already and was trying to learn a new one. In addition to that guy, I was friends with another guy who could speak 7 languages and play piano well. In Finland, the official languages are Swedish and Finnish. English is so popular that many Finns speak the language like native speakers. Plus, a lot of Finns learn a language or two in high school and spend time abroad. So it’s very common to meet Finns who can speak multiple languages.

Moreover, Finns are very modest. They tend to display a healthy level of shyness and play down their abilities. I rarely detected a sense of ostentation from my Finnish friends or folks I met over there. If you meet a Finn salesman to ask about a service or product, don’t be surprised to hear something along the line of “it works!”. In my experience, Finns are like that. Down-to-earth, direct, modest, honest and genuine.

I came across a clip that explained quite well the modesty and why Finnish education is so good. Have a listen.

Direct flights to the US from Vietnam

Last week, the US Department of Transportation’s Federal Aviation Administration (FAA) announced in a press release that Vietnam’s aviation industry meets the international safety requirements. The approval means that Vietnam carriers can now open direct flights from the S-shaped country to the US.

It is a huge announcement. There are hundreds of folks traveling back and forth between the two countries on a daily basis, whether it’s for business, leisure or just a quick family visit. As of this writing, flights from Vietnam to the US have at least one layover. If you live in a less popular city like myself in Omaha, it will require at least two stops. In my experience, it took me 3 stops and at least 33 hours for a one-way trip. Layovers are just a waste of time. It’s not just about the time spent at the airports, but also about the hassle in scheduling.

Direct flights will definitely ease the pain and facilitate the travel between the countries. It’s a boon for tourism and commerce. So much productivity can be saved. American travelers will be more tempted to visit Vietnam as the first destination in the region when the flights are no longer as long and taxing as they were.

I am really excited about this development for my country. Becoming a flight hub matters a great deal to our tourism and economy. There is still a very long way to go, but it’s a bright first step. I really hope the carriers in Vietnam will jump at this opportunity.

Humans of New York and Brandon Stanton

I am a big fan of Humans of New York. There are so many great stories told in just ordinary yet moving languages. Whenever I run into those stories, they just create beautiful moments in my days and lift the spirit a little bit. In the time when racism, lack of compassion and cynicism are dangerously present as our time now, stories like the one below offers a pure and beautiful break

Source: Humans of New York

I also recommend the interview between Tim Ferriss and the founder of Humans of New York. It’s an engaging and incredible interview shedding light on his story and the struggle he went through to have his photo project take off

Thoughts on Venezuela and the alleged association between social welfare and socialism

Every time free education and healthcare for all is mentioned in the US, the chief criticism is that the proposal will throw the country into socialism and dismay. Critics cite Venezuela as the failed example of socialism and an outcome that the US must avoid. Seeking for the truth, I decided to do a little bit research on Venezuela and what actually took place to see. My intention is to see if the criticism is well-founded. Below are my findings.

What transpired in Venezuela

Dependent on oil, Venezuela’s economy fluctuates in tandem with oil price. In the 1970s, Venezuela was one of the richest countries in the world, due to rising price of the valuable substance. In the following decade, a decline in oil price brought Venezuela to its knees. The economy contracted while inflation rose steadily, hitting its peak of 81% in 1989. In response, the government cut spending, but its effect was almost nonexistent. Half of the population lived under poverty in the latter half of the 1990s. Inflation rate was 100% in 1996. Deadly chaos saw multiple deaths.

In 1992, Hugo Chavez led a failed coup, was arrested and sent to prison for two years. After his release, he ran for the presidency in 1998, vowing to give the power back to the people of Venezuela and use oil money to re-distribute wealth in the country. He won the election in an impressive fashion and with a significant margin.

After the election, Hugo Chavez started social programs that left positive impact on healthcare, education, unemployment and poverty in the country.

  • Unemployment rate went down from 19.2% in 2003 to 9.3% in 2007 and 7.8% in 2009
  • “The most pronounced difference has been in the area of health care. In 1998 there were 1,628 primary care physicians for a population of 23.4 million. Today, there are 19,571 for a population of 27 million. In 1998 there were 417 emergency rooms, 74 rehab centers and 1,628 primary care centers compared to 721 emergency rooms, 445 rehab centers and 8,621 primary care centers (including the 6,500 “check-up points,” usually in poor neighborhoods, and that are in the process of being expanded to more comprehensive primary care centers) today. Since 2004, 399,662 people have had eye operations that restored their vision. In 1999, there were 335 HIV patients receiving antiretroviral treatment from the government, compared to 18,538 in 2006.”
  • Poverty rate dropped from 55.1% in 2003 to 27.5% in 2007
  • “Access to education has also increased substantially. For example, the number of public schools in the country has increased by 3,620 from 17,122 in the 1999/2000 school year to 20,873 in the 2004/2005 school year. By comparison, in the period between the 1994/1995 and 1998/1999 school years, the number of public schools increased by 915. School enrollment has also increased at all educational levels. For example, in the period between the 1999/2000 and 2005/2006 school years, gross enrollment rates for preschool have increased by 25 percent, for primary education by 8.3 percent, for secondary education by 45 percent and for higher education by 44 percent.”

A labor strike in 2003 at PDVSA, a stated-owned oil company responsible for the exploration, production and exportation of oil in Venezuela, severely damaged oil production and hence the economy, with GDP falling 27% during the first half of 2003. After the strike, Chavez also began a plethora of actions to concentrate his power and radicalize his agenda:

  • Fired highly experienced workers at the state-owned PDVSA
  • Eliminated term limits
  • Established a Supreme Court that was friendly to him
  • Oppressed free press
  • Nationalized key industries in the country
  • Imposed subsidies on food and consumer goods
  • Expropriated private companies

The country’s finance relied almost completely on export income, not taxes, dominantly made of oil export income. In 2004, oil price hit $100 and climbed higher in the years after. The hike in oil price allowed Chavez to fund his social programs, nationalization of key industries, foreign borrowing and import of, well, almost everything.

However, oil price started to decline in 2014, throwing Venezuela into chaos. Years of toxic dependence on oil and lack of proper investment in agriculture as well as manufacturing robbed the country of an ability to be self-sustained. Suddenly, the country no longer had sufficient income to finance its import of food as well as consumer goods, and its debt payment. Food and medicines became rare. Inflation went up dramatically. The economy entered a free fall. After Chavez died in 2013, Maduro took over and started his quest for dictatorship. Electoral manipulation, oppression of free speech, censorship and violation of human rights were the hallmarks of Maduro’s reign. Recently, the United States and other countries refused to recognize Maduro as the legitimate leader of Venezuela.

Definition of socialism

The freedictionary website describes socialism as follows:

  1. (Economics) an economic theory or system in which the means of production, distribution, and exchange are ownedby the community collectively, usually through the state. It is characterized by production for use rather than profit, by equality of individual wealth, by the absence of competitive economic activity, and, usually, by government determination of investment, prices, and production levels. 
  2. (Government, Politics & Diplomacy) any of various social or political theories or movements in which the common welfare is to be achieved through the establishment of a socialist economic system

The definitions clearly point out that common welfare alone isn’t enough to label a country “socialist”. It has to come with the state-controlled means of production, distribution and exchange.

Thoughts

That is also the exact reason why the US and Venezuela can’t be more different. While the former’s economy is the epitome of a free economy in the world, the latter’s is tightly controlled by the state. Also, the US economy doesn’t have the level of dependence on oil as Venezuela does. Saying that implementation of free healthcare and education is equal to launching America into socialism ignores completely the difference in the two countries’ economic systems.

Would free social welfare lead to chaos? Advanced countries such as Western Europeans, Australia and Japan provide their citizens with free education and healthcare. Yet, those countries’ economies are anything, but similar to what Venezuela presents. Hence, the alleged association of social welfare and socialism seems ill-founded in my opinion. Instead, the fear mongering and propaganda, I believe, are driven by corporations and individuals whose interests would be in jeopardy with the implementation of free education and healthcare.

Every social system has its strengths and weaknesses. As mentioned above, Hugo Chavez managed to do some goods for his people, a fact that has been conveniently ignored by the media and politicians. Yet, socialism is flawed and the flaws in the case of Venezuela are exacerbated by a colossal failure in governance and management. There was no check on the regime that drifted into an authoritarian. Oil money wasn’t reinvested properly into agriculture and manufacturing, areas that could have made Venezuela more self-sustaining and less dependent on oil.

On the other hand, capitalism isn’t perfect either. While free markets allow for innovation, fiscal freedom and growth, it usually comes with income inequality. Take the US for instance. The top three billionaires own more than the poor half of the country combined. While many Americans don’t have $400 ready for an emergency, the US is home to 25% of the world’s billionaires and more billionaires than Germany, China and India combined.

To have a fair society and strong economy, a balanced mix of socialism and capitalism is better than a lone pursuit of either, I believe. In fact, that’s the model adopted by Western European countries. Social benefits are financed by high taxes in a free market to ensure that the less wealthy have more help and the playing field is more even. While a combination of socialism and capitalism may work in theory, the implementation is guaranteed to have many nuances, given the differences in natural resources, cultures, demographics and other factors in each country. The devil is in the details. Any claim that a social system doesn’t work because of a failed example somewhere else without thorough review of each country’s conditions is false, in my opinion. Sadly, that is usually what happens in the news.

References

Some sources that helped me with this piece:

https://www.cfr.org/backgrounder/venezuela-crisis

https://fas.org/sgp/crs/row/R44841.pdf

https://www.forbes.com/sites/garthfriesen/2018/08/07/the-path-to-hyperinflation-what-happened-to-venezuela/#595ca58d15e4

https://www.aljazeera.com/indepth/features/2017/05/venezuela-worst-economic-crisis-wrong-170501063130120.html

https://www.cnbc.com/2018/05/15/the-countries-with-the-most-billionaires.html

https://www.files.ethz.ch/isn/46713/venezuela_update_2008_02.pdf

Vietnamese Lunar New Year Holiday

Tomorrow will be the official start of the Lunar New Year holiday in Vietnam. It’ll be the third straight holiday that I have missed since I landed in the US 2.5 years ago. Time does fly, doesn’t it?

Contrary to what may be the conventional thinking, I personally don’t think Lunar New Year, or we call “Tet” in Vietnamese, isn’t a great time to visit for foreigners. Big cities will be seriously less crowded since folks go back to their hometown to spend quality time with their families. Meanwhile, folks who were born and raised in big cities such as myself will likely travel somewhere. Hence, big cities become boring and popular destinations become too annoying.

I’ll let you in a little secret. Tet is only truly great during the days leading up to the first day of the holiday. Families gather and hustle to decorate houses and prepare for the holiday. The sense of togetherness is greater than ever during the 365 days of sunsets of the year. After the first day, it’s just formalities and gift-changing for a few days before the normal life kicks in again. In the past, my family used to prepare marinated allium chinense in jars. But my grandmother, mother and aunts are now too occupied and old to do it. Time doesn’t spare anyone in its wake, does it? I missed that time. The tradition is no longer there and there is something missing during Tet.

Cách làm dưa kiệu ngon, trắng giòn, để lâu không hỏng
Source: sieungon

Personally, I like Tet. Growing up in the economic capital of Vietnam, I grow used to and sick of the terrible traffic in the city. 12 million people hustle every day to make ends meet. During Tet, the majority which is made of ambitious immigrants from poorer provinces go home to spend time with family, a privilege of which life strips them during the other 345 days of the year. Hence, traffic is much more pleasant during Tet and I like it.

This will be my 3rd consecutive time missing out on Tet since landing in America 2.5 years ago. This is not my first rodeo, but it sure doesn’t make it any easier. Anyway, I really hope 2019 will be better than it has been to me so far. The calendar will turn pages in about 22 hours. Finger fucking crossed!