Writing Code while Asleep

While Alive-Eat-Sleep-Code-Repeat

This is a quick post about something I tend to do quite often that has really helped me be more productive and I think has helped the wider developer community in some small way too. It's something that I haven't seen other developers I've worked with do, so I thought I'd call it out here.

The Problem Statement

When I come into work for a day of developing software, I generally get into the zone (if I don't have any distractions...) and am hacking away at something. Sometimes (quite often really but I'm loath to admit it) I get stuck. I'm probably working with some new language, framework or technology and I can't figure out how to do a thing.

At this point I might try a few things that pop into my head, go to definition on some code to read the comments, even read the documentation if there is any. These are all good strategies to solve a problem. At what point though do you throw your hands up in despair and give up? One hour later? Maybe four? Maybe a couple of days? I've done all three in the past!

It might be chance, I don't know but usually when I get to this point, it's lunch time or time to go home and spend time with the family. What do you do now? You're stuck and you're going to have to come back to your desk at some point and bang your head against the problem for a second day. Maybe a clear and fresh mind can solve the problem? It's scary and maybe a bit sad how often I think of a solution to a problem I was having while walking home or lying in bed.

But what if even that does not help? The thought of having to go to work the next day where you will have to try again to solve a seemingly unsolvable problem can be quite depressing sometimes.

The Hive Mind can Help

The solution is to ask the kind people of the internet for help! Then go home and get some sleep. The chances are that come the morning, somebody has solved your problem for you! This is so obvious I feel kind of stupid for even writing this but in my experience when people hit a problem, they don't always ask for help, in fact I have a lot of anecdotal evidence for this:

Stack Overflow

Ask your question on Stack Overflow. The undisputed number one resource for every developer.

I have reviewed a lot of CV's in the last two years and there is a growing trend to list your GitHub and Stack Overflow profiles on there. Even if your profile is not listed, I can sometimes find it anyway (the internet is a stalkers dream).

In all the Stack Overflow profiles I've seen, there is a worrying trend. Very few people actually ask many Stack Overflow questions! The thing is, asking questions is the easiest way to get points and build a very nice Stack Overflow profile too, so it's silly not to do it.

In my three years actively using Stack Overflow (I was a lurker for a while), I've asked 191 questions and answered 143. I'm a bit behind in contributing but even my questions will help people as there will be others who had the same question and got an answer quickly because I had already asked it. In total, this has netted me almost 9,000 imaginary internet reputation, 7 gold badges, 86 silver ones and 152 bronze. Even if I had not answered any questions, and only asked them, I think I would have had a healthy reputation score of a few thousand.

It's amazing how quickly you can sometimes get answers to your questions using Stack Overflow too, the fastest I've seen is literally 30 seconds! It's such an amazing resource, you literally have people sitting there waiting for you to ask a question so they can get imaginary internet points!

I get around 5,000 visitors to this blog every week at the moment, it's surprising to me how many people actually contact me directly asking for help. The emails are always the same, "I read your blog post and I'm working on project X, I need help urgently because I have some deadline". No supporting code, just a vague hint of what the problem might be, as if I can divine the solution through some kind of telekinesis. I help these people where I can but I've started to feel I'm hindering them by doing so, they need to learn to use Stack Overflow just like everybody else, so that's where I've started pointing them lately.

GitHub and Forums

If you're dealing with a project that uses GitHub or a forum of some kind, use it! Find an existing GitHub issue or forum post and add a comment to it or open a new issue if one cannot be found. One or more developers will get a notification of your problem and they might even point you in the right direction. Once again, it's amazing how quickly you can get a reply sometimes.

Once again, I've seen a lot of GitHub profiles and very few people use the issues section to ask questions. You often have the developers who literally wrote the code that you're using, answer your question. What can be better than that?

Conclusions

This post sounds silly but developers don't generally ask for help for some reason. I used to work with a great junior developer who started only with a little VB script knowledge and would ask for help whenever he needed it, which was a dozen or more times a day sometimes. It was hard sometimes to get work done but it was great because after a while he started to get really good and now we had two minds to get work done and come up with ideas instead of one. Ask for help when you need it!

Web Mentions

What's this?

0 Replies

Comment

Initializing...