RWDevCon 2017 Inspiration Talk: I’m an Idiot by Richard Turton

Rich is a professional idiot. In this talk from RWDevCon 2017, he talks about how to leverage your inner idiot to make you a better coder, writer and communicator. By Richard Turton.

Leave a rating/review
Save for later
Share
You are currently viewing page 3 of 4 of this article. Click here to view the first page.

You’re Probably Doing It Wrong

There’s another thing I bear in mind when treating my code as prose: I’m probably doing it wrong.

Like prose, there are limitless ways to write anything. If there are limitless ways to write anything, then statistically speaking, the way you’re writing it is wrong. If it’s not wrong, it’s still not perfect, and it might not be the best way of doing it. But that’s not so important. It’s more important that what you’ve written works and that it’s easy to change than that it’s perfect. Because remember: it will never be perfect.

I’ve learned to get comfortable with that idea. It doesn’t matter if what I’m writing isn’t the best or the cleverest or the most elegant or the most beautiful way of writing it. If it’s understandable and someone else can understand it, and if you’re really feeling good about it, it’s got tests, that’s great. It’s much easier to refactor that working code later on than it is to spend a day agonizing over your design pattern, because your customers and your users don’t care. They just want an app that works.

And if you have this idea that you’re probably doing it wrong, that any part of this app could be rewritten at any point in the future, then that app evolves a more sensible and decoupled architecture. You ask yourself, “Is this bit too big? How hard would it be to dump this bit and put something else in instead?” You continue to ask yourself these questions while you’re writing, and you end up with a very sensible structure.

Don’t Be Clever

There’s another question you must ask yourself when you’re writing. “Am I getting too clever?”

I’ve got more quotes about this. Here’s a famous one:

Clever code is unfixable.

Clever code is like eating an entire blooming onion from Outback, which I intend to do on this trip, by the way. You feel quite proud of yourself at the time, but you pay a price later on.

A classic from Outback Steakhouse (Image from outback.com)

Clever code is not good code. Cleverness in code is not a virtue. I spent last summer working on educational materials teaching people how to use Swift, people that had no computer knowledge whatsoever. It was absolutely fascinating to go back to the first principles, to take away all the knowledge I’d accumulated in my own head. What is a variable, what is a constant? How do you tell a computer what to do? And Swift allows you to express those ideas really, really clearly.

Unfortunately, it also allows you to write incomprehensible nonsense. And writing incomprehensible nonsense in Swift is kind of the emperor’s new clothes of our community at the moment.

There are entire blogs filled with stuff like this. Can you tell what this code is doing without moving your lips? Would you be able to tell again in three months’ time? Even the code’s confused about itself—it’s got a face in the middle.

Don’t be that blogger. Don’t write code like that. Don’t let code like that through code review. Don’t encourage people to do code like that. Idiots can’t understand code like that.

Yes, you can do things like this. You can use custom operators, you can wrap things in things that process things and give you a thing all in one line of code. But are you actually helping anyone, or are you just masturbating in public about how clever you are? How many hipster language features you can cram into this one little snippet? Who are you helping with code like this? And don’t tell me that this is easy to “reason about”. It’s not.

Brevity is not clarity. Write for reading. Write for idiots.

That was a small rant. I can now move on to slightly more positive things you can do as an idiot, like: You can ask for help.

Ask for Help

People are afraid to ask for help. They don’t want to look stupid. They don’t want to look like they don’t know what they’re doing. They don’t want to expose themselves as not being an expert.

This is ridiculous; people shouldn’t feel like that.

If you’re afraid to ask questions, how do you think the people that you’re scared to ask good questions of got to know the things that they know? Asking for help is simply how it’s done. It’s not a situation where it’s you, who knows nothing, and someone else, who knows everything. You simply have overlapping areas of knowledge.

In these two diagrams, if you stood in the middle of that blue circle and look around, you’re surrounded by yellow. But the truth is closer to the right diagram than the left. If you make asking questions and answering questions part of your team’s culture, you’ll be happier and more productive.

If you work alone or your colleagues aren’t helpful, you can ask questions on Stack Overflow. Here, you can ask questions about the things you don’t know in front of every developer on the planet.

Let me do a quick show of hands: who uses Stack Overflow? Could you imagine doing this job without Stack Overflow? Keep your hand up if you’ve asked a question on Stack Overflow. Keep your hand up if you’ve answered a question on Stack Overflow. Keep your hand up if you’ve searched Stack Overflow, found an answer, and it was yours from a year ago because apparently you keep forgetting how to do this thing.

Yep, my hand is still raised.

When you’re asking a question on a site like Stack Overflow, you need to use your idiocy. You have to explain things clearly and avoid adding confusing extra details. Imagine that your question is going to be read by idiots, because it will. And a lot of those idiots are going to try and answer your question.

Give Help

How does an idiot answer a question successfully? You use your idiocy.

Ask clarifying questions if you don’t understand. This is a great trick, because sometimes you just say, “Oh, what’s this bit here doing?” And then that person suddenly realizes that that bit there is their entire problem, and they get to feel great, because they’ve actually solved their own problem. You get to feel great because you’ve helped them solve their own problem without needing to know anything.

Remember how it feels when you don’t know something and how hard it can be to ask for help. Don’t act surprised that somebody doesn’t know something that you know. You didn’t know once. Don’t belittle someone for having the self-awareness to know what they don’t know.

This duckling only learned how to swim (and code) by asking helpful idiots on Stack Overflow. (Image via pixabay.com)

Give simple answers, but give clear answers with reasons behind them. Don’t just dump a load of code on people and say, “Try this!”

And of course, you might not know the answer to the question. This is fine. You can move on, or you can do a bit of research and try to find the answer yourself. I learned a lot by doing that on Stack Overflow. I’d see questions and have no idea what the answer was, so I’d go and find out all about the thing. You can learn a lot more that way; it gives you a broader range of things to get involved in than simply making a project, because a project is usually constrained to a few areas.