Shuhei Kagawa

2020 in review

Jan 13, 2021 - Review

Park with yellow leaves

It’s already been two weeks in 2021, but I’ll write anyway in the spirit of better late than never.

2020 was finally over. It was a weird year. Time flies, but things that happened feels like a long time ago.

Work

I had been working in the same area as before at Zalando. But I was not bored. My team welcomed new members. I helped building a brand new product. I was promoted. The new role exposed me to new perspectives even though I left before fully embracing it. Thanks to the remote work as the default, I collaborated with colleagues in Dublin more closely than ever.

At the end of November, I left Zalando where I met wonderful colleagues and friends. The four years there became an important part of my life.

After a week of vacation, I started a new job at Google. I am currently working remotely from Berlin. But I will eventually relocate to Zurich when the situation improves. My current plan is to move at the end of March, but we never know.

This job change took longer than I thought. I applied in February and heard a result in June, but most of the positions were canceled due to COVID-19. It took a few more months to find a team to join. I received an offer at the end of August.

A new job means a lot of learning. Now I’m experiencing how it feels to join a new place. I haven’t had this feeling for a while. I tended to think that software engineers should thrive on depths. But I missed that we needed an overview before pursuing depths.

I just finished an onboarding program. I’m excited to catch up and start contributing to real projects.

WfH

I had been working from home 100% since February. I liked to go to the office and talk to colleagues in person. But I also like working from home.

It didn’t take long to adapt to working remotely. We were already working cross-location with Dublin and Helsinki using online collaboration tools like GitHub, Google Meet/Chat/Docs. It became even easier to attend meetings than before. Instead of climbing upstairs to go to a meeting room, meetings are only a few clicks away.

The problem was physical equipment. I didn’t realize that the office equipment was very nice before starting WfH. I bought tons of things to set up a comfortable home office—I may write more about this later.

No commuting means huge time-saving. I saved at least one and a half hours every day. At the same time, I lost a good chance of exercise. I try to walk outside every day, but the amount of my physical activities drastically decreased.

Computer science

It was fun to learn and practice algorithms and data structures for interview preparation. I solved about 300 Medium/Hard LeetCode problems in two months. Before 2020, I had been learning them with books and Coursera courses, but knowing and doing are two different things. Solving problems shed light on what I didn’t fully understand. I studied topics that I was stuck—graphs, dynamic programming, string searching, well, most of them!

After the interviews, I still wanted to learn more. Someone on Twitter tweeted about Teach Yourself Computer Science. I started with Operating Systems: Three Easy Pieces because it looked easy to read—and it was. Then I moved on to Computer Systems: A Programmer’s Perspective. The book is more textbook-ish than OSTEP. But I found it fun to learn things that I hadn’t taken a deeper look at—the binary representation of floating-point numbers, assembly, processors, etc.

Travel

Before COVID-19 started, I traveled to Granada, Spain in January. It’s a city of Alhambra—and free tapas. The city’s bars give you tapas as long as you order drinks. Seafood and Jamón ibérico were so good.

In September between the two lockdowns of the spring and the winter, I visited Goslar, Quedlinburg, and Düsseldorf in Germany to use too many vacation days left. Goslar and Quedlinburg were beautiful. As a substitute for a trip to Japan, I ate Japanese food extravagantly in Düsseldorf. My favorite restaurant was Hyuga. It felt like being at an izakaya in Tokyo. Shochiku, a Japanese supermarket, had a fish counter where you can ask them to cut sashimi. I took it out and ate in the hotel room. So good.

Food and drinks

I had rarely used food deliveries before 2020. But yes, I did it this time. My favorite dishes have been Tacos and Korean fried chicken. Also, many restaurants started take-away. I had never imagined taking out ramen before 2020.

I kept drinking bubble tea. Dosha in Friedrichshain is my favorite in Berlin so far. In addition to authentic Taiwanese tea, they have waffles with Tapioca inside!

Then, winter came. Even though warm bubble tea is nice, it became tedious to go out on the cold street to grab drinks. I finally bought an entry-level espresso machine and a hand grinder. My less educated taste is already satisfied with it. Let’s see if I can make some latte art in 2021.

Books

I bought 42 books or so but finished only a few non-tech books. Much less than I thought. One was Into The Wild. The others were two volumes about fermented beans, natto in Japanese, around the world even though I’m scared of its smell and haven’t tried it yet.

I want to read more in 2021. I will cut the time on social media and read books instead. If you want to see the progress and my ever-growing Tsundoku collection, here is my Goodreads account.

2021

I’ll move to another country this year. We can’t socialize in person under the current circumstances, but you know, remote meetings are a few clicks away ;)

A station in Berlin

4 years at Zalando

Nov 30, 2020

Spree in November, 2020

I’m leaving Zalando with fond memories after 4 years. Here I’m writing down my experience. It’s never comprehensive, but I hope some people find it interesting!

Beginning

I had lived mostly in Japan for 34 years until 2016. I wanted to travel more, but I was lazy. I decided to work abroad so that I could travel while earning money.

A job-matching website called Honeypot introduced me to Zalando. I had 5 interviews and got an offer for Senior Software Engineer (Frontend). I accepted the offer without looking into any other companies because I liked the interviewers and the company’s OSS projects looked interesting. (Honeypot was very happy about it. They put me on their top page and an interview blog post.)

I moved from Tokyo to Berlin and joined Zalando in October 2016. With 200 other newbies in a month! Zalando is a fashion e-commerce company that sells shoes, clothes, etc. on its website. I had no clue why they needed so many people at the beginning. Isn’t it a website in the end? I later learned that the visible part of the website was the tip of the iceberg. There were many more areas like wholesale, brand relationship, pricing, warehouse management, shipping, payment, and so on.

Team(s)

In 2016, Zalando was hiring software engineers with pool hiring. We were hired without specific teams to join. After a month of onboarding, each newbie was offered two departments to choose from. I chose the Catalog and Navigation team in the Fashion Store, the e-commerce website of Zalando.

For the first few months, I thought that the company was providing free beer to employees because fridges were always full of beer bottles even if we drank them a couple of times a week. I later learned that the beer was provided by the delivery lead and the product owner of the team. I joined the right team.

Aside from the beer, I liked the team. We worked together and played together. It was multi-cultural and magically bonded. It was an old team, but several members including me joined the team in late 2016. We learned the German language and explored the city of Berlin. We had BBQs in a park and drank vodka playing games in the office. It felt like a youth again. Some of the teammates were actually young. After two years or so, we stopped drinking as much as we did. We all became grown-ups...? Maybe.

Through re-organizations, the shape of the team has changed. It was split into multiple teams. Some people left and new people joined. But I stayed in the same area more or less.

Frontend engineer...?

At Zalando, frontend engineers were more like JavaScript fullstack engineers.

In 2016, Zalando had a slogan, Radical Agility. It promoted team autonomy and Microservices to support it. Each engineering team was supposed to operate what they built on top of the STUPS infrastructure. Frontend was not an exception. Mosaic (frontend-microservices architecture) allowed each product team to own their Node.js servers for data aggregation and React server-side rendering in addition to frontend components.

The team’s responsibilities were broad. Building new features and UI improvements with A/B testing, contributing to shared UI components, web performance optimization, Node.js server operations, 24x7 on-call, writing post mortems, and so on.

In the new architecture that the Fashion Store is moving to, product teams don’t need to maintain Node.js servers. I would miss the burden, but I think it’s a good thing.

Operation and reliability

I had a good opportunity to work on Node.js servers with serious traffic and business impact. Before joining Zalando, I had worked only on products that didn’t take off or were just taking off. I didn’t have much experience in scaling, monitoring, etc. But writing post mortems became one of my favorite activities after 4 years.

When my team migrated one of Zalando’s most frequently visited pages to the microservice architecture, our journey in this area started. Even among frontend engineers in the team, some of them were frontendy—good at UI—and some of them were backendy. I was a backendy one and started looking into the topic. I found it interesting. It was a nice way to contribute to the team and the business.

I glimpsed SRE initiatives and Cyber Week preparation being set up and evolving. How Zalando prepares for Cyber Week is a great overview of the evolution. I had a good chance to take part in it as a member of a product team. The people who formed the SRE team taught us monitoring, alerting, and reliability patterns (retry, circuit breaker, fallback, etc.). Incident response and post mortems were standardized. Then distributed tracing and adaptive paging were introduced.

Some of my contributions were reliability improvements of Node.js services. I researched timeout mechanisms of Node.js HTTP client and added a timeout feature to an HTTP client library. Built a mitigation strategy for DNS timeouts, improved histogram metrics aggregation, performed profiling and found interesting findings—I had a chance to talk about it in front of a big audience including TC39 folks... I was nervous!

I was late to the Kubernetes train. The migration from STUPS to Kubernetes didn’t get enough priority in my team. On the other hand, Zalando was an early adapter of Kubernetes and has been a strong contributor to the ecosystem. I missed a good learning opportunity to dive into it and learn from the in-house experts.

Web performance

Another topic that I enjoyed was web performance optimization. It was especially rewarding because it directly contributes to customer experience and the e-commerce business. After my team worked on it, I had an opportunity to write a part of a blog post about the improvements.

This topic keeps evolving. New metrics like Web Vitals and more measurement/optimization techniques came out. It is one of the topics that I would want to pursue if I remained at Zalando.

Cross-team collaboration

I had a chance to work with many other teams in the Fashion Store and other departments. I met and worked with literally hundreds of colleagues. I had never worked with so many people before joining Zalando.

That meant more meetings and alignments. I learned decision making with writing. I still don’t say that I’m good at it, but Google Docs became my favorite editor next to Vim.

I learned that it can be fun to work with many teams. Sometimes it was frustrating because of the time consumed. But it was rewarding to meet with many colleagues and work together.

Career

I saw good examples of career paths. Before joining Zalando, I imagined only two paths for software engineers. Staying as a senior engineer (or a lead engineer) or becoming a manager. It was great to see another path, being a senior individual contributor who takes technical leadership. At Zalando, it’s called Principal Engineer. In addition to technically leading projects, they shape the tech landscape of the company beyond the scope of a team.

I was fortunate enough to be promoted to a principal engineer this year. A new role gave me new tasks and a new point of view. It’s one of my regrets to leave this role prematurely.

Fun

I had a lot of fun.

Lunch tours to Schlesisches Tor. Countless drinks at the office. After-drink burgers at Burgermeister. A team event on canoes. Summer BBQs in a park. Company parties with thousands of people and getting lost. Mett —German traditional breakfast of minced raw pork—with some beer in the office at 11 am. Ordering Maß at lunch and learning what it meant when 1L of beer arrived...

Next

It’s been a fun journey. I’m grateful for all the opportunities and learnings. If I went back to 2016, I would do it again.

I’m going to start a new job tomorrow. I hope it will be fun as well!

Switching color schemes of Vim and Alacritty

Feb 14, 2020 - Vim

I like fountain pens and good notebooks. They spark joy when I write on paper. Computer terminals are like stationery. A good terminal setup makes it fun to work with computers. Here is how I improved colors on my terminal and made it easy to switch them depending on the time and the mood.

Ayu Light for Vim and Alacritty

Using official color schemes

I have been using Dracula color scheme on Vim and Alacritty for a while. I liked the colors, but I had a small problem with it on Vim. The pop-up of coc.nvim had the same color as the background color, and it was hard to distinguish a pop-up and the background.

dracula from flazz/vim-colorschemes

I was using Dracula from vim-colorschemes, which hadn’t been updated for three years. I tried the official Dracula color scheme for Vim. It had a different background color for pop-ups! Yes, it’s subtle, but now I can distinguish pop-ups from the background.

dracula from dracula/vim

vim-colorschemes is a great way to try out different color schemes. You can get a random color scheme by :colorscheme random. But once you pick a few favorite ones, it’s worth checking if they have official color schemes that are likely to be more maintained.

The same goes for Alacritty. I was using the Dracula color scheme that I converted with my tool from iTerm2-Color-Schemes for Alacritty. Dracula has its official Alacritty theme, and it looks better!

termguicolors

I started trying other color schemes and found Vim’s termguicolors option in ayu-vim’s README. It enables true colors (24-bit colors) instead of 256 colors (8-bit).

if has('termguicolors')
  set termguicolors
endif

I turned it on, and the colors looked gorgeous! Before learning about termguicolors, I had tried light color schemes like Ayu Light and given up because of too low contrast (left in the following image). With termguicolors, light color schemes became finally usable!

ayu light in 256 colors and true colors

Switching color schemes

After trying dozens of color schemes, I picked the following:

  • Ayu Light: Good in the morning or at a place with natural light.
  • Pink Moon
  • Nord: Low-contrast theme. Good in the night.

I started switching color schemes depending on the time and the mood and bumped into a couple of issues. It was tedious to update the color schemes of Vim and Alacritty together. Also, I manage my .alacritty.yml and .vimrc in a git repository. It was annoying that the repository had unstaged changes every time I switched color schemes.

Solution

Alacritty

I decided to remove .alacritty.yml from the git repository and generate it out of a base template and color scheme files. Once I prepared a YAML file for each color scheme, it was quite easy with a one-liner.

cat alacritty/base.yml alacritty/${color}.yml > .alacritty.yml

Vim

I could have generated .vimrc, but it felt weird because VimScript is a programming language. Instead of generating the whole .vimrc, I decided to generate a color scheme file .vim/color.vim, which is in .gitignore

echo 'let ayucolor="light"\ncolorscheme ayu' > ~/.vim/color.vim

and load it from .vimrc.

let color_path = expand('~/.vim/color.vim')
if filereadable(color_path)
  exec 'source' color_path
else
  " Default color scheme
  colorscheme pink-moon
endif

Putting them together

Then, I created a shell script named colorscheme to switch color schemes of Vim and Alacritty together.

#!/bin/sh

color=$1
dotfiles=~/dotfiles
alacritty=${dotfiles}/alacritty

configure_alacritty() {
  cat ${alacritty}/base.yml ${alacritty}/${color}.yml > ${dotfiles}/.alacritty.yml
}

configure_vim() {
  echo $1 > ${dotfiles}/.vim/color.vim
}

case $color in
  dracula)
    configure_alacritty
    configure_vim 'colorscheme dracula'
    ;;
  nord)
    configure_alacritty
    configure_vim 'colorscheme nord'
    ;;
  pink-moon)
    configure_alacritty
    configure_vim 'colorscheme pink-moon'
    ;;
  ayu-light)
    configure_alacritty
    configure_vim 'let ayucolor="light"\ncolorscheme ayu'
    ;;
  *)
    echo "Supported colorschemes: dracula, nord, pink-moon, ayu-light"
    exit 1
    ;;
esac

Now I can switch color schemes with only one command! (I still need to restart/reload open Vim sessions, but I can live with it.)

colorscheme ayu-light
colorscheme nord

If you are curious about the full setup, check out my dotfiles repo.

Summary

  • Official color schemes may have more features than color scheme bundles
  • Enable termguicolors on Vim
  • Switch color schemes with a command!