Victor Savkin — Angular, the Router, and Publishing
Victor Savkin works at Google as an Angular core team member and the main contributor to the Angular router. He is the author of the Leanpub book Angular 2 Router: The Complete Authoritative Reference. In this interview with Len Epp, he talks about his path from Vladivostok to San Francisco, his interest in productivity, Angular and the router, and his experience writing and publishing.
Len Epp: I usually like to start interviews by asking people for their origin story. How did you first become interested in doing the kind of work you’re doing now, and how did you come to work for Google on Angular?
Victor Savkin: So originally I’m from Russia, from a city called Vladivostok. I went to college there and I studied math. As a teenager I was really interested in two things, programming and productivity. I was playing with computers, building games and small apps as everyone does, around 15, right before I went to college. At the same time I was reading a lot about productivity, a lot of books, articles, podcasts. The reason I was really interested in productivity is that I grew up in a small village near Vladivostok and I went to a very mediocre school, so I thought if I apply myself and manage my time well, I will be able to perform well with kids from better schools, from excellent schools.
So in a year I wrote my first professional app, which was a productivity tool, the most convoluted and over-designed to-do list you can ever imagine. It didn’t sell really well, so it wasn’t very successful. Then I had my own startup which failed super quickly. I went through a bunch of companies working as a programmer doing lots of different things like back-end, front-end, middleware. Then I moved from Vladivostok to Toronto, Canada, and after a few years I got this opportunity to join the Angular team at Google. Angular is an extremely successful open source project. I think over a million developers right now are actively using it. It’s a framework developers can use to build rich apps in JavaScript.
This opportunity was really exciting to me because I knew that I can get back to what I liked as a teenager, which is making people more productive. But here instead of helping them manage their time efficiently, I can help them build their apps more efficiently. So I jumped on this opportunity and moved to San Francisco, where I currently live and work on Angular, trying to make devs more productive, trying to make their life easier, less painful.
Len: I’ve looked into this space a little bit myself, and I was wondering if you could explain a little about what your to-do app was all about.
Victor: Oh boy. I actually like this space a lot. I think I had a few core ideas. The first one is, instead of having just a regular list, I had different views to look at the list, so you can have different perspectives. One would be a tree-like structure where you can organize complex projects and complex ideas, link connections between them, then you can project that complex tree-like structure into a bunch of flat lists so you can actually execute it and check it off one by one. I also had an idea of eating frogs, doing unpleasant things, so in the app you could mark certain things as unpleasant, and the app will force you to do unpleasant things first, like in the morning, so the rest of your day is not as painful as the first one or two hours when you did all the unpleasant things.
Len: That’s a really fascinating aspect of productivity. I was interviewing someone recently named Janelle Klein, and part of her approach is measuring pain. She has developers just click one of three buttons about the type of work that they’re doing, and she’s done a lot of really interesting work on how to analyze productivity and maybe change people’s work practices.
Victor: It’s actually one of my main interests even at the moment. I measure my productivity from morning till night. And I schedule my work based on where during the day it fits. For example, the first couple of hours in the morning I find I’m the most productive, after I wake up, have a cup of coffee, usually like four or five shots of coffee. For three hours I’m like a machine, I can do a lot of coding, I can think through complex problems, and then the productivity goes down and I do more mundane, simple, routine tasks. It’s interesting, if you organize your work in this way, how much more you can accomplish having the same amount of time.
Len: And what was your first startup, the one you mentioned briefly?
Victor: I was a teenager, a lonely guy, a little bit nerdy. So it was a startup for lonely people who want to talk to each other. It was called Let’s Talk. The idea was that you go to a page and you type in something like, “oh, I want to talk about this.” Let’s say I read Hemingway, I want to talk about this book a lot to someone who is around my age, someone I can relate to. And the app would match you with someone who has this interest at the moment, either is active online right now or was recently active with this interest, so hopefully you can connect within a day with a person to discuss the subject you deeply care about. It failed mostly because Russia is just crazy and super hard to get money. And I was very young too, so I didn’t play my cards right.
Len: What’s the culture like around startups in Russia? Is it part of the popular awareness, or is it niche, or is it something that’s growing?
Victor: I think it’s very niche even at the moment. A few companies appear and disappear from time to time, but at no point you can get money as easily as you can get here. I think here if you have a good idea and have a bunch of engineers who are talented, most likely you can get some amount of money to work, let’s say, for half a year. There it’s almost impossible. You need to have friends or very personal connections with someone who has money. And I think it’s a little bit frowned upon. In general Russians don’t take risks as much as, let’s say, Americans or Canadians, so it’s not part of the culture. Russians value safety a little bit more and as a result startups are not as common.
Len: And is there what you might call a STEM culture in Russia? If you’re interested in computers, is there a cultural pull towards certain types of things rather than others, especially given there isn’t maybe so much of a startup culture there?
Victor: I don’t think in general the IT culture or engineering culture is as dominant in Russia as it’s here, especially in California. There are obviously a lot of programmers who are talented and successful there too, but at least I didn’t feel I was part of the engineering culture at any point. I was just a programmer who managed to do some programming at a company I worked for, like a bunch of companies actually, but at no point I felt that’s connected to my peers in a broader sense as I do for example here, or I felt in Canada.
Len: And how did you make your way to Canada? Why Canada?
Victor: In general Canada has a very straightforward immigration system, that’s part of it. You can fill in a form, there is no lottery, once you get enough points, you have good education and good experience, you’re very likely to get a PR card, which is basically a green card. And I like Canada a lot. I’m a little left-wing in terms of my political views, so I think the way Canada functions and runs as a country is a lot closer to me than for example the States. So Canada is still my favorite country. I just happen to be in California.
Len: And I have to ask, how was your first Canadian winter? Was it totally familiar?
Victor: It was basically the same as the Russian winter, so I wasn’t surprised at all. It actually felt good, hey, it’s about the same, it’s super cold, your phone doesn’t work outside because it’s deadly super cold. There is an element of, I’m against the nature, it’s so cold, the wind. So the snow, for a couple of days it actually feels really good, then you get tired of it.
Len: So you eventually made your way to the West Coast. Did you apply to Google or did they approach you?
Victor: Google approached me, so I joined Google because they approached me.
Len: And just very generally, what’s it like working at Google?
Victor: I really like Google as an employer. I think it’s a great company to work at. It’s very comfortable. A lot of day-to-day stuff I had to take care of prior to joining Google, I don’t have to worry about at Google at all. It’s taken care of by someone else, so I can focus on engineering and chatting with my co-workers and friends. I think it’s a great company if you want to do engineering and you want to delegate all this extra stuff to someone else. There are a lot of interesting projects, food is free, what not. But I don’t think the food is free is the main thing. It’s just an example when something is taken care of so you don’t need to worry about it, so you can only worry about your project.
Len: That sounds like a fantastic environment. For an employer to deliberately take away that stuff for the psychological reasons is a really interesting move, and I think something that’s often misinterpreted, especially by perhaps grumpy people from generations who didn’t enjoy what they see as perks, but sometimes can’t see as the hardcore productivity moves that they are.
Victor: Yep, I think it actually affected productivity a lot. Even though sometimes I miss going to restaurants. Previously, when I lived in Canada, I would go to a restaurant for lunch or a fancy coffee shop, and here, well, it’s still cool but sometimes not exactly the same. Slightly less hipster.
Len: So on the subject of Angular, let’s imagine not everyone who listens to this is in tech. Could you give the two-minute description of what Angular is?
Victor: Sure. Angular is a set of tools and libraries you can use to build a client-side application, like let’s say Gmail or Inbox, a rich application with a lot of interactivity. You can build it using Angular fairly efficiently. I think it’s probably one of the best tools if you want to get started and build something quickly, like within a few weeks. If you have some programming experience, most likely you’ll succeed at building something that actually works. It gives you the sense of, I do it right now, in a day something actually runs and I can click around and the application functions, which is a very rewarding experience, especially for a lot of developers who are new to the industry. They want to feel this immediate feedback, that I tried it and it works. Angular provides that.
With Angular 2, the newest implementation of the framework, we try to keep that feel of, it just works, but adapt it so it works for larger projects and larger teams. Because Angular 1 was known to work excellent for smaller projects, but when your project grows, let’s say 50,000 lines, 100,000 lines, you have like 20 developers working at the same time, suddenly there are a few things that weren’t designed exactly right for that situation, and I think Angular 2 solves this problem a lot better.
Len: You write about something called dead code elimination, which I gather is to help efficiency. Could you explain what that is?
Victor: So the idea is that if you consume a lot of JavaScript libraries, let’s say you consume Angular itself and a lot of other components from different libraries, if you don’t use dead code elimination, you’ll have to ship all this code to the client, to the browser, for the application to run, to bootstrap, and it can be a lot of code. So if you’re on mobile and you have a not very good connection, it may take a lot of time just to deliver the code and then to run it, to scan it, to parse it. Dead code elimination looks at your code and sees which parts of your code cannot be reached in principle. Let’s say it looks at a component or an ES6 module, which is a JavaScript module, and this module is not used at all in your app. It happens to be a part of the same library, but we can analyze the code and statically decide that it’s not used. So we can remove it from the production bundle. We can drastically reduce the size of your application so you can ship it quicker to the phone of your user.
Len: And is this something that’s happening continuously or something you do periodically?
Victor: It depends on your dev side. It happens before you ship to production, essentially. During development you can still do it, for all sorts of reasons, maybe for performance analysis, but before you ship to production you run a special tool that will remove code that we know for sure is not going to be used, and will minify the rest of the code, optimize it, so the deliverable is smaller and we can ship it quicker to your customers.
Len: Could you explain a little about the router that you work on?
Victor: The router is the latest project I worked on. And I can talk a little about what routers do in general, because the word router is so generic, it may mean a lot of things. I think that a big part of any application development right now is trying to manage state and manage state transitions. And doing this is actually very hard, especially on the web, because on the web we want to ensure that the state of your application, at least a substantial part of it, is reflected in a URL. So you can copy and paste it, the back button works. If you want to provide a good web experience, the URL has to match the state of your application. This synchronization is non-trivial.
In addition we often want to split your application into multiple chunks that we call bundles, so we can ship only the first bundle to your customer and bootstrap, and then we can load lazily the rest of your application. So the bootstrap time to the first interaction is a lot quicker. Doing all this transparently is actually fairly hard, and that’s what the router is doing. Using the router you can declaratively specify the states in which your application can be, you can manage state transitions, and the router will take care of synchronizing your transitions with the URL so the URL will always match, and the router will load other bundles on demand in a transparent way, so you as an application developer don’t need to worry about it too much. While the user is navigating through your app, more and more code will be fetched from the server, and only the needed parts of your application will be bootstrapped.
Len: And specifically you write about the concept of a route state. Could you explain that as well?
Victor: So a route state is somewhat nuanced. Application state can include a lot of things. You can for example have the state of your UI component, something can be highlighted, something can be scrolled, a particular button can be in a particular state, and that’s one part of the state. The other part is what’s actually being shown. Let’s say if you go to an inbox or mail app, you can see the particular message being opened. Or if you open contacts, you are chatting with a particular person, and what exactly you are typing, transiently, doesn’t really matter. But what matters is what message is open, who you’re chatting with.
That persistent state is what I refer to as the route state, because it’s captured in the URL. It’s part of what the router deals with. You should be able to copy it, paste it and send it to your friend, and the friend should see the same message being open and the same chat window being open. Even though some details of where it’s been scrolled to or what was selected is not represented, that’s good enough.
Len: And Angular 2 has a particular focus on mobile, if I’m not mistaken — you should optimize for mobile first. What’s the argument for designing something like this to be mobile first?
Victor: I think that mobile puts a lot of constraints onto what you can do. The main constraint is, it’s hard to fetch large resources from the server because your connection usually is spotty. So as a result, things like tree shaking matter a lot, or things like lazy loading, when you can ship only like 20% of your app right away and it boots and you can interact with it on your phone already, while we’re getting more and more stuff from the server. Whereas on desktop right now we have very powerful connections, you can ship megabytes within like half a second. So the size of the first chunk of your app we need to ship is what makes a lot of stuff mobile friendly. And the second part is the ability to work when there is no connection at all, when you’re on the subway or whatever. But the router doesn’t deal with that. Other parts of Angular and other parts of the infrastructure take care of that.
Len: That’s a really powerful argument. Was there pushback from the community when this mobile first focus was first launched?
Victor: I don’t think so. I think most people realize at this point that most consumer apps or consumer websites have to work on your phone. And it happens it’s much harder to make it work on your phone very well. The good experience on your phone is a lot harder to achieve. So if you can do that, then making it work on desktop is usually fairly straightforward.
Len: I was wondering if you wouldn’t mind talking a little about the future of Angular 2. Is there anything you can tell us that people can expect to see in the short term?
Victor: Alright, so the first thing we are focused on right now is shipping final. We’re very close, and hopefully within a few weeks we’ll be able to ship the final version of Angular 2. At which point we will freeze the API. The API will be stable for at least half a year. We’re going to of course make adjustments, fix bugs and whatnot, but you will be able to rely on the framework and build your apps knowing that nothing under you will change. Everything should be only better during this period. The framework should be faster, we are going to work on our compiler to make the deliverable smaller, we’re going to improve the router to handle use cases we do not handle right now very well, but overall it will be stable. It will be a good platform on which you can build your applications.
Len: You mentioned in the introduction to your book that you’re going to keep it up to date with future releases of Angular 2 and changes to the router. Is this one of the reasons you chose to publish your book on Leanpub in the first place?
Victor: It’s a good question. There are actually three reasons why I picked Leanpub over a traditional publisher, and that was one of them. One of them is that, because I work on open source, I got fond of the idea of publishing early and publishing often. Getting something out there which is 80-90% ready, almost ready, already can provide a lot of value to many people. And then you can get feedback from those people and improve it. It’s a good way to make your product or your book a lot better. It probably won’t work well for fiction, but it works great for tech books, it’s just perfect for tech books.
The other reason is, I read a lot of books that are published by Leanpub and many of them were very focused, they were about one thing, so you buy a book and it’s just about one topic which you care about. Because often if you buy a book from a traditional publisher, maybe 30 percent of the book is filler. And I respect my readers’ time a lot. I want them to spend the least amount of time they can reading my book and extract everything they need, because I know they’re not reading it to enjoy the language, they need to extract value from my book. And if I publish on Leanpub I can make the book as short as I want and just cover one subject, which is the router. I don’t want to have some nonsense chapters about how to set up npm or whatnot, you can find it online already.
And the last reason is that as a programmer I’m very happy with the tech side of things on Leanpub. I have my own GitHub repo, which I push my updates to. My friends and my co-workers can comment on those. We don’t need to send each other any documents. Basically the best practices I’m accustomed to as a programmer I can use while working on my book, which is version control, different tools, those kind of stuff.
Len: That’s really a fantastic point about filler. One thing a lot of people who aren’t so familiar with the publishing industry don’t know is that a bookstore is basically a physical competition for space, and for visual space in particular. One of the reasons books can sometimes be so fat is that they’re squeezing out other books from the bookshelf, displaying their spine, or even their front if they pay for that privilege. Books literally get bigger because the book itself is an advertisement prior to its being purchased. It’s a sort of weapon against the other books. I wanted to ask you about the process of publishing in progress like that. Your book is currently marked at 95% complete, I think. What percent complete was it in your mind when you first published it?
Victor: I think it was about 80%. I was planning to write about 12 chapters and I had about 10, a few screenshots were missing and the examples were somewhat correct but weren’t exactly right. So I would say you could still read it and learn almost everything about the router at that moment. I could still provide a lot of value to many people, that’s why I published it so early. But it wasn’t done, and right now it’s 95% because I’m finishing the last chapter. I just want to make a few things here and there slightly better, then it will be 100% and fully complete. But after that I can still improve it, I can still publish new versions, adapt the book to the new versions of the framework or the router.
Len: How did you incorporate feedback? You had people doing comments on your GitHub repo — did you invite people to do that, or did people just find it through your book?
Victor: Because I’m part of the Angular core team, a few people were very interested in making the router successful, so I asked them to look at my book, to look at my pull requests and make sure that they are coherent, that I convey my information succinctly and somewhat correctly. But a few people approached me from my readers and said, “hey, I found a few issues with your book, how can I give you feedback?” And I just gave them access to my repo so they can comment.
Len: I mentioned in the introduction that you’re into keyboards and fonts, so you’re in your own way picky about writing tools and things like that. Was there anything in our process at Leanpub you think we could improve, or something new we could build?
Victor: It’s hard to come up with a suggestion on the spot, because I think the process was actually very good. It was fairly easy to get started. It took maybe half an hour to set it up, super quick. I think it’s actually pretty good already, much better than I expected, because I heard so many horrific stories about publishing, how hard it is, how much pain you have to go through, and it’s probably the case with traditional publishers, I don’t know, but my experience with Leanpub was very pleasant.
Len: It’s not to disparage anyone, but there are just structural things about the conventional publishing process, which is still historically all around print, and lots of timelines, and people on a team who might not necessarily seem all that necessary — I’m going to say it, in 2016 there’s lots of legacy in the process. In particular I think people who are used to writing about technical things don’t want to have to get in a fight to get a typo changed, they just want to be able to make the change and get it out to people. I wanted to ask you one more question, looping back around to the beginning of our discussion. As someone who’s into productivity, what’s your opinion of Slack?
Victor: I actually use Slack and I think it is a good tool comparing to other tools in the market. I use it a lot to chat with my teammates and to interact with people from different teams who use Angular. In general I find asynchronous communication very hard to get right. I think it’s obviously useful, but it has to be a part of your team’s culture more than of any particular tool. And in our case a huge part of our culture is actually being in the same room, because most of Angular core, like 20 of us, is in the same room, so it’s very hard to ignore that and always use Slack, when you can just turn around and chat with a person. So I think Slack can be more useful for other teams. It’s useful for the Angular team, but may not be the most important tool for us.
Len: Thanks very much, Victor. I really enjoyed hearing your story about Vladivostok to San Francisco via Toronto, and thank you for being a Leanpub author.
Victor: Thank you. Thank you for having me.