By

October 7, 2015

Go Beyond Code to Become a Better Programmer

Many of us want to become better programmers. But how exactly do you go about doing that? Pete Goodliffe thinks he has the answer. He’s a programmer and software development writer who has authored two books, ‘Code Craft’ and ‘Becoming a Better Programmer’, both of which provide advice to Software Developers on how to hone their skills and become better programmers. We interviewed him, and he told us why you have to go beyond code to become a better programmer.

*Read more interviews with some of the world’s best developers on ** or follow us on *

Image

So where to start? For Goodliffe, it starts with having the right attitude — “The standout difference between the really good coders that I’ve worked with and the ones that aren’t so great, is attitude,” says Goodliffe.

“It’s not a hand-wavey thing. I’ve worked with people who know technology, who know the idioms, and how to do all this stuff. But, if they don’t have the right attitude, they’re just not effective programmers and they’re not great people to work with. The kind of stuff I’m talking about here is humility. You don’t want to work with people who think they know it all but don’t. Being humble is the key thing. It doesn’t mean that’s an excuse to not know stuff, but it’s just not believing that you’re better than you really are”.

You can develop this humility by “being in a state of constant learning… so looking for new stuff, absorbing new knowledge, wanting to learn off of other people,” explains Goodliffe. “It doesn’t necessarily mean be a perfectionist and wanting to make everything perfect before you ship. It’s doing the best you can in the time you have, with the resources you have. But that kind of attitude really drives through to great code”.

Another way he suggests that you can improve your code is to write less of it. “It seems kind of counter-intuitive for a coder… but it’s entirely possible to write thousands of lines of code and achieve nothing in it. Think about it — no unnecessary logic, don’t write stuff that doesn’t need to be said, don’t write verbose code. Sometimes you can stretch out boolean expressions into massive If statements which just hide what is being said”. Ultimately for Goodliffe this means writing “simple but not simplistic code. If you don’t write enough code, it doesn’t do what it’s supposed to do. But by avoiding all points of needless generality, like making abstract interfaces, or deep hierarchies that don’t need to be extended,” then you can write much more effective, concise code.

Goodliffe is also adamant about the need for programmers to communicate well. “Code is communication. You’re communicating not just with the computer, you are communicating to other people writing the code. Even if you are working by yourself, you are communicating with yourself in two years time when you pick up the same section of code”. And this is something that needs to be kept in mind, says Goodliffe. “It’s a skill, and it’s something you learn, and it’s something you need to consciously practice. And yet, I don’t know of courses… that really focus on something that’s really quite an important skill for programmers,” and so it can often be overlooked.

Of course, we aren’t all the same and our aptitude for communication differs. But it’s important to recognise your communication strengths, suggests Goodliffe. “Some people can talk well, some people are shy and retiring, but that doesn’t necessarily mean you are stuck like that. That doesn’t necessarily make you a bad communicator. Some people communicate better in different media and it’s worth bearing that in mind. Some guys are really great on email, they can write concise, clear descriptions, they can follow a line of argument by writing and explaining something really well. Other people struggle to put it together in words”. So he suggests that you should “learn how you communicate well, play to your own strengths and pick the right medium”.

“The reason people pay us to write software, unless we’re doing it for fun, is because there’s a complicated problem that needs to be solved,” says Goodliffe. “There is some necessary level of complexity in software engineering and we have to embrace and understand that”. Yet many of us fall into the trap of writing code that produces unnecessary complexity. So Goodliffe suggests that what we should always aim for is to produce code that “when you look at it, it looks obvious. That is the key hallmark of some excellent code… you know it wasn’t simple to write. But when you look at it, the solution’s simple, the shape is simple. All I can say is, that’s what we should strive for”.

Sometimes though, this is taken out of our hands and we’re landed into the middle of a messy codebase. When this happens, “the most important thing… is to ask people,” advises Goodliffe. “I see so many developers who just won’t sort of swallow their pride and say, ‘I don’t quite know what this is doing, but I know Fred over there does. I’ll just talk to Fred about it.’ It’s often those little bits of insight that can give you a super-fast route through something intractable,” Goodliffe says. What’s more, all too often we “pick up some code, look at it, and think ‘that’s a bit dodgy isn’t it… what were they thinking?” What we forget though is this happens with our code too. “Somebody else picks it up, and they’ll make that same judgement call on my code,” says Goodliffe. So what we need to remember is that “what I might think is some terrible hack, is probably some pragmatic thing they did for a very good reason.” After all, “nobody goes out of their way to write messy code… I can’t say that I’ve found anyone that really tried to ruin a project. So approach code with that attitude,” cautions Goodliffe.

Regardless of our own skills though, Goodliffe says that “the biggest thing for me… is to sit at the feet of great coders. I have learned the most in my career when I have been around excellent people who I can learn off of. Whose skills can rub off on me and I have moved jobs. I have moved physically to be able to work with those people”. This can be motivating, and it’s important to keep stoking our passion for programming. “I’m enthusiastic. I love this stuff,” says Goodliffe, and “if you have an enthusiasm, that passion for programming, it tells out in the code that you write”.

*Read more interviews with some of the world’s best developers on ** or follow us on *