Eduardo Barbosa was one of my colleagues from university and work, and a top coder I greatly respect and admire. Of course I had to interview him as well! He offered some very valuable insights that I’m pleased to share.
WLAD: Tell us a bit about your work and professional experience. How did you become a programmer, and why did you choose that?
EDUARDO: I started to program before I even got to college. My mother wanted to build a website. She asked me for help, and I had no idea, so I searched at Google, and discovered HTML. So I build a website with just HTML; it wasn't even programming yet. But with HTML, I discovered PHP. It gave me tons of possibilities, and I got very interested; that was a new world for me. I went deeper and deeper, eventually learning MySQL too. I learned it in the worst possible way, by doing it without any project pattern. At that point, I decided I would do computer science. Then I started to learn other languages, design patterns. I got serious about coding when I did an internship with a top coder, Rafael Viotti, a very experienced programmer. He taught me tons of stuff, how things work in practice. He taught me everything I didn't learn at the university about software engineering. At that point, I was already a web programmer. After I graduated, I became a programmer for good.
WLAD: In terms of college education, do you think it's worth it, that it helps the student to become a top coder?
EDUARDO: I think the person can manage to become a top coder without having any college education, if he or she is dedicated and intelligent. In school I learned a lot of things that today, in my day-to-day activities as a web programmer, in both front-end and back-end, I don't use. But I think it's good to know it. If I could go back in time I would do the course again, because I think we learn concepts that are interesting to know. For instance, compilers. You’ll hardly ever get your hands in anything related to compilers after college in your life. But understanding how it all works might help you project software that is unrelated to compilers during your career.
WLAD: What do you think makes the most difference? The influence of a mentor like Rafa, or the formal teaching in the university?
EDUARDO: Considering the teaching we get from UFMG [Universidade Federal de Minas Gerais], I would definitively say that a mentor is the easiest way to reach a good level of programming. There are other universities, like Fumec or PUC [Pontifícia Universidade Católica], that have their computer science courses much more focused on technologies and less on concepts. They teach in practice modern stuff. Maybe that's even more interesting than a mentor, because the mentor will help you to do something specific in that moment. But if you take a course that focuses on technology, you'll have a broader vision, and you'll be ready to apply it in many scenarios. Either way, I think having a mentor is essential. Instead of choosing one or the other, the ideal is to learn in both ways.
WLAD: And about coding standards, what would that be? How does the person learn that?
EDUARDO: I think that when you code, especially in the beginning, you can easily see yourself having to give maintenance to your own code, sometimes having to refactor everything, sometimes having a hard time understanding the code you wrote earlier. So with the experience that you obtain after a lot of coding, when you write the code for the first time and you follow a structure that is rigorous–for instance, not cramping tons of words in the same line–you realize that this helps you to understand your own code later on. And if you are working in a team where each coder writes differently, the code will quickly become a mess. In contrast, when everyone follows the same standard, it gets easier for a new programmer that joins the team to read the code and understand it clearly.
I think coupling and cohesion of code are the most important software concepts. Sometimes you code two modules that were supposed to be independent. If they are really independent you would be able to reuse them, but many times you create dependencies between the modules, maybe having a variable that both modules write to, so you'll never able to reuse that. That would be a coupled code: code that depends on other code to work. The ideal world would be one without coupling, but in the real world there is a tradeoff. If you were to decouple your code completely, it would involve many more lines of code, and the result would be much more complex. So in practice, you must balance when to be more decoupled and complex, and when to do something simpler but not reusable.
WLAD: And what can you do in order to know how to evaluate this tradeoff properly?
EDUARDO: For me, that came with experience, doing a lot of programming. Having to add a new feature to the source, and seeing how the way I did things initially resulted in a complicated process for me. For someone who is just starting, I think there is no other way other than reading the theory about this, and trying to apply it in practice. Even though the coder will need experience in order to "get it"; just knowing all the theory isn't enough.
WLAD: You got your undergraduate degree in computer science, and then you went on to pursue a master's degree. But you ended up quitting university before… So what made you want to start doing your master's, and what made you quit it later on?
EDUARDO: I joined because I was already in motion. I was an intern in a research lab and I had written some scientific papers, so my entering was relatively assured. And my advisor also motivated me to join; she had plans for me, and I thought it was cool, to have this additional title. I focused not on the research I was going to do, but on this degree I was going to obtain that would differentiate me in the workplace. When I started my research, I wasn't really motivated; I didn't think that the area I was researching was interesting, and I didn't think that this research would be significant enough to be used by anyone. I thought about changing my research area, but I couldn't think of anything interesting to do. Something that would make a difference to someone. In addition to that, during the master's degree studies, you have to write a lot, and I had difficulty writing. I would sit down, and would write about something that wasn't interesting to me, making me gradually lose my motivation. Besides that, I was working while doing my master's, and I didn't have much time to dedicate to it. So I balanced facts: I considered the time the university was taking to do something that wasn't pleasing me… I'm not saying that doing a master's is bad. In my case, I had a research goal that didn't interest me. The time I was allocating to this, struggling with it just to get a title… Then after some time I had the will to be more autonomous, or continuing to do the work I was doing at the time. The title makes a difference if you want to get a public job in a governmental entity, or in a big company. None of these were in my plans, so it would make no difference to have a master's title. It would all be a huge effort just to get a title I didn't even need, just so that someone would call me "master." I thought it wasn't worth it, so I got out.
Music and Code
WLAD: About music, do you like to program while listening to music? Why, and what kind of music do you listen to?
EDUARDO: I really like to program with music. Mainly when you are at a place with other people, sometimes a small noise other people make or a conversation you overhear will steal away your concentration. When you are with music, you are completely focused, either on the music or on the code. Sometimes you might get a bit carried away by the music, but it's a rare event. So I think music helps me to concentrate, not worrying about external noise. I like to listen to lighter rock. There is a Pearl Jam album I listen to a lot; whenever I have a programming problem that is pushing me back, I put it on and everything is fine.
WLAD: Which album?
EDUARDO: There are two albums: Ten and Into the Wild, that is from Pearl Jam's vocalist. With these two, I focus completely; it helps me a lot. If I let the music roll while I code, I can work for a whole night without even noticing. I even forget to eat.
Becoming a Top Coder
WLAD: What do you consider to be the most important skill for a top coder, in terms of a complete professional? How do you think this person can get this skill in the easiest or most effective way?
EDUARDO: Whoa, a hard question… Taking a bit of the specificity out of the question, and being more generic, the main skill a top coder must have is the willingness and capacity to do things alone. Not that the person needs to not consult anything, but if he gets challenged by a problem, having a notion of what the problem is, researching, and reading more about the problem, that enables the coder to fix it alone. There are many programmers I've seen that are very dependent on things. Dependent on a helper module targeted at the problem, or dependent on the help of someone who already knows how to do it. But this way, when reaching a problem that's a bit different, you'll get stuck. I think that the main quality for hiring someone to my team would be autonomy. The top coder doesn't need to know everything, but he or she needs to have a general knowledge. Knowing a little bit about everything, and having the willingness and motivation to do things alone, researching. How to get these skills? I think the computer science course gives you a very good background for you to look into a problem and have an idea of how to solve it. You might not know exactly how, but you have a hint, a gut feeling, about how it's going to be. Any problem that arises, I might not have the slightest idea of how to solve it, exactly. But I always know what the problem is about, and I have a research strategy on how to find a solution. I don't get lost; I know it's possible to solve it.
WLAD: Another thing related to programming education… What was the last thing you studied that made a lot of difference and that you can share with us? Such as a book, a blog post…
Good Programming Practice
WLAD: Do you like pair programming? Have you ever done it? What's your opinion on it?
EDUARDO: We did it together already (laughs).
WLAD: I know! (laughs)
EDUARDO: I think it was really cool. It was a great experience for learning things related to Vim; I think we both learned. I remember I saw you issuing weird commands to make complex motions, that I couldn't follow at first. I learned a lot of these. And about code, about language, it was definitively productive. I don't remember exactly what we learned with one another – maybe better ways to debug the code. I'm sure it's a valuable experience. You absorb whatever your pair knows and you don't and vice-versa. Sometimes you spend your whole life doing a simple thing in one way, but there is a much faster and better way you didn't realize before, and you see your pair doing it.
WLAD: What about code review? Tell me more about that.
EDUARDO: I think it's also important. It's a very good practice for you to review your own code. If you are using Git it's very easy. So always before completing a commit, I review my own code changes. But definitely, having another person is important. I've reviewed a lot of code, and you always find something, ranging from errors caused by lack of attention, to major issues. Maybe the coder forgot something quite obvious, something that wasn't necessary in the code that is very easy to fix. Sometimes the author is so focused on the problem that he just cannot see such a detail. Sometimes there is a huge procedure there that is totally unnecessary. So ideally every code should be reviewed by a second or third coder. I think pair programming can even include code review too.
WLAD: About major failures in programming, have you ever made one of these epic fails? And what was it? Tell us!
EDUARDO: Yeah! I'm trying to remember now, I definitely did something like that. I know I made a few epic mistakes, but I'm not remembering them…
WLAD: Sometimes it's better to forget some things… (laughs)
EDUARDO: Oh, there was a major fail I did, and it was recent. I was working on an ecommerce website. Its DNS was administered by some company, and it would now be administered by me. So I did all the DNS adjustments. I changed the A records to point to the new web server; the new server was perfectly configured, buuut…. I forgot to change the "www" records. So the site kept pointing at the old server, and I didn't realize why. I was even arguing with the people from the hosting company, saying that I had performed the right changes, that it could only be their problem… And just two days later I realized this epic fail I made. It's not exactly about programming, but it's related.
WLAD: A related question, how important do you think it is that the programmer learns about servers, networks and general sysadmin skills?
EDUARDO: I think it's not essential, but the professional is much more complete once he has experience with that. That is a lot of work, creating a master/slave structure, setting up high availability, even simpler things, putting a simple server to run, I think that's a differential. If you work in a very big company, there will be specific people just to handle that. But for autonomous, freelance or employees of small companies, you have to know these things to get stuff done.
WLAD: Any last words and experience you think will be valuable for our readers?
EDUARDO: Yeah, lately I'm choosing the YAGNI (You Ain't Gonna Need It), rather than the BDUF (Big Design Up Front). I prefer to keep the code simple when first implementing it, even though I know I'll have to refactor the code if new functionalities must be added later on. The other option, to implement code in the most extensible or generic way so that the code is ready to receive more functionality, most times isn't worth it. I’ve realized that by experience.
Another interesting thing is that I'm adapting my coding, trying to use the try/except more instead of the if/else conditional expressions when handling special cases. My whole life I coded following the LBYL (Look Before You Leap) principle, and now I'm changing it to EAFP (Easier to Ask Forgiveness than Permission), because I think the code becomes more elegant, and also slightly more efficient too.