I’m trying something different today. I used to live stream web development on twitch. I only managed to get a few viewers during that stint. One of those viewers turned into a lasting friendship. Robin Malfait from Belgium. Robin always impressed me with his coding abilities. This is an interview about his programming experience.
Give me a brief story of who you are.
I am Robin a developer from Belgium. I prefer JavaScript as a programming language and currently am a big React fan. I'm also working at a startup called Skedify.
How’d you get into programming?
I think there are multiple interesting things about JavaScript for me. For starters, you don't need a complex environment, you can run it in your browser and it just works. This was a big one because everyone can contribute and run it without needing a complex system. That being said, these days it is the complete opposite because all JavaScript is compiled / transpiled. Another interesting thing is that JS is the only "programming language" that runs in your browser (without doing anything like Java Applets, ...). I also like the flexibility of JavaScript, because when I had a Java course you had to type everything, and while that is good I sometimes had the feeling that I was fighting a compiler instead of focusing on pure domain logic. Currently I like the fact that JavaScript is progressing. It has nice API's and syntax. For example arrow functions, async, await, and it is also getting very fast, which benefits everyone.
What are your thoughts on react vs vuejs?
I prefer React, I can't really say many things about vue because I never really used it. But it reminds me of the angular 1.0 days where you have to learn this specific DSL. I think that Vue can be perfect for quick prototyping because React is more verbose and you need a lot more code to create a simple counter for example. But now that there is a React Hooks RFC, I think that I'll stay with React because now the verbose code is drastically simplified.
So I remember you telling me about your company’s lint rules. I thought they were pretty intense. Can you describe those and how you feel about them?
Ok so basically in eslint you have 2 kinds of "rules". You have rules that make you a better / faster developer and they are a bit like a compiler for example "variable x is not defined" or "const x is defined twice". Apart from those, you also have linting rules for code style preferences, and these rules are the rules that give you endless nitpicks on Pull Requests. "Could you please put a space there, could you please add a semicolon" and so on. So where I work we had a pretty big / intense eslint file and there are some absurd things in there for example, a colon should have spaces around them: const position = { x : 1, y : 2 };
. I don't like such rules. But, there is a nice solution, there is prettier and basically what prettier does is format your code to a general code style. This allows you to just ignore the styling rules and let prettier take care of it. Since we introduced prettier we never had code style nitpicks anymore. However it is true that prettier sometimes does things that the team doesn't like, but we came to the consensus that we let prettier handle that. So now we dropped all those code style things from eslint and only use the "compiler"-ish rules. Works perfectly.
But wasn’t there rules like “no for/while loops”?
Oh yeah that's true, those are still in there. So we have no for, no while and such so that we are kind of forced to write more functional and declarative code over imperative code. So the "no while" can be replaced with recursion, the "no for" can be replace with array.forEach
or array.map
kind of functions. They sometimes seem hard, but since I write them like that anyway I don't have a problem with them. Oh, and there is always /* eslint-disable-next-line */
😊. I must admit, in the beginning those rules were insane because I always wrote for loops and while loops.
And how do you feel about it now?
I got used to it. Also I am writing a lot of react so you write more declarative code anyway. For example <ul>{items => items.map(item => <li key={item.id}>{item.text}</li>)}</ul>
. You don't create an array first, loop over it with a for loop, and create <li>
elements and then output them. I also think the code is way more readable and easier to grasp because of those rules. Unless you have weird algorithms where you have to use recursion, those make you think hard.
Are there any lesser known tools that you use daily?
Do you know Quokka?
No.
You are going to love this. So quokka is an awesome tool for your editor. Think of it as the devtools console. You can write code and it is executed but you don't even need to save a file, it continuously does this: https://quokkajs.com/. You can write node code in it and it will just run it for you. I use it all the time to prototype little things.
Other tools I like is bat
an alternative to cat
with syntax highlighting, line numbers and git support for your terminal. https://github.com/sharkdp/bat
I’m curious, do you ever use debuggers?
It's funny that you talk about the debugger because I rarely use a debugger. I can understand code quite fast so mostly a simple log will do. There are also other console tools that can help for example console.table to log your objects / arrays in a nice table. However the annoying problems I have can't be debugged or at least not easily. For example, race conditions. Every time I try to use a debugger there, the problem does not occur because the debugger let's you step trough it in sequence even though things are async and in "parallel". That being said, we do need to support ie10 at work, so there I do use the debugger because the console is so bad that I can't inspect objects and what not.
Do you follow TDD or write tests in general?
I don't follow TDD strictly, but I do write tests, otherwise I can't sleep at night. I mean, I've been in codebases without tests and I was so afraid to touch anything.
What's your approach to those tests? Only when something breaks?
No, I do write tests while coding not only when stuff breaks. So, I have multiple approaches just depends on my mood that day I think. So, sometimes I write a bunch of tests so that I can play with the public API of a certain function so that I can play with how I want to use that function / piece of code. Other times I write tests after I just written a piece of code to verify that it actually works. So I do write tests but I don't follow the strict red->green->refactor approach.
For the beginners in web development, what kind of advice would you give them?
Oh there is a lot to learn, okay so let me think. For starters, I think that there is a lot to learn and there are a lot of frameworks, so don't try to learn everything at once, this will get you in an unhappy state really really quickly. Apart from that it is also a good idea to find some mentors, so that you know in real life people that are developers. Also try to create some side projects so that you can play with web tech before actually using it on your job. Also try to master JavaScript really well, because if you know JavaScript quite well then frameworks in node or on the front-end like React and Vue will be way easier to grasp.
Any tips on how you came to master javascript?
I wrote a lot of crap code. Like I said before I just played with it for a very long time so I didn't watch any courses. But I can recommend the courses of Wes Bos https://javascript30.com/ (free) and http://es6.io/ (paid). I also follow a lot of developers on Twitter from the various teams like Chrome team, or React team. They show a lot of code snippets and that way I learn everyday.
Where can people learn more about you? You live stream sometimes as well right?
I plan to stream more on twitch https://twitch.tv/robinmalfait and you can also find me on Twitter https://twitter.com/malfaitrobin.