Ask HN: I can never learn coding

9 points by throwawayt2119 ↗ HN
Hello HNers,

I have been trying to learn coding for over 10 years. Languages I tried to learn include Visual Basis, C#, .NET, C/C++, Java, JavaScript, PHP, HTML, CSS. I cannot code in any language. It is serious attention problem I have been facing.

I tried to abandon the programming. But Again I got curious about web development. And for last 1 year, I am trying to learn Python. Again, I am failing due to lack of focus.

What is wrong with me?

How can I focus and learn coding? Or, should I forget about learning programming for good?

I would appreciate any help.

18 comments

[ 2.4 ms ] story [ 48.9 ms ] thread
You say you can't code and can't focus. But what specifically stops you? How far have you gotten?

Without knowing, here are some general ideas:

1. Stop expecting to understand the program at the "macro level" and the "micro level" at the same time - just accept that there will always be some unknowns. For instance, don't think about how the processor or memory works while just writing a few lines of Python to read a file.

2. Try to understand the code's structure and flow rather than specifics - do you understand how functions call each other, how module systems work, etc?

3. Try to start with an existing open source project and then modify it to your liking. As you dig around figuring out where your changes go, you'll appreciate more about how it all comes together

I think that trying to understand an open source project is excellent advice for someone who already knows how to code and wants to get to the next level, but not for someone who is just starting to learn how to code. When you're starting to code, you need to start with very small programs and work your way up to bigger ones, not by trying to navigate through thousands of files filled with millions of lines of code. Understanding vast extents of other peoples' code is something that even experienced programmers struggle with.
I didn't mean to attempt understanding the whole thing - just to understand one tiny part of it for your improvement, and by that route, come to understand how it's all interconnected.

It would be impossible to "read" and understand the whole of a huge project as an inexperienced coder, of course.

Can you tell us more about how you've been trying to learn?

If you've been reading random articles on the web and going to Stack Overflow whenever you need to figure something out, it might help to do something with more structure, such as working through a book on a particular language, or doing one of the introductory college CS courses that are available online. These will present material in an organized sequence and give you a foundation to build on.

Also, learning this stuff takes time and practice. There are things you won't understand the first time you see them, which you'll eventually understand after having read more and written more code.

Finally, don't jump the conclusion that something is "wrong with you". We live in a world filled with many distractions, and even if you don't have ADHD it can be hard to sit down and focus on something hard. Focusing on hard stuff is difficult, so you may need to gradually build a habit of doing it, starting with short periods of focus and working your way up. And you won't be able to focus if you're being interrupted by your phone beeping every few seconds, so try turning off distracting devices while you're learning.

Coming from someone who's lived and breathed programming, and excelled at it by most standards (topping national competitive programming competitions, graduating among the top 1% in college, having built compilers, OSes, an OpenGL game engine), then worked for about 4 years at a bigcorp and subsequently burnt out, and has been struggling to get back on his feet for the last two years, I can tell you it's not going to be easy. Last year I picked up haskell, seeing that it was very different from what I was used to up to that point, and built some stuff with it, some web apps built on warp+wai, and quite enjoyed it. But it was short lived. I developed an attention problem like the one you mentioned. I've had call ups from places like Google, following codejam results, also invited to interview by MS, Amazon. But I was and still am a wreck, and seeing the hole in my CV, they turn my down if I answer them at all. Funnily enough, I got most jobs I applied for, the last one being just after quitting my first job. They told me I was the best candidate they've interviewed ... But I started having panic attacks, and quit after a few days.

So the takeaway from all of this? It's not programming. It's mental health. And having spent the last couple of years devouring medical research and throwing my every last ounce of energy at the problem (I started suffering from chronic fatigue, so it wasn't really a lot), discovering autoimmune diseases (celiac) which were causing sleep problems, blood tests indicating significant hormonal imbalances, experimenting with paleo, keto, exercise variations ...

The takeaway is that the state of mental health treatment is horrendous. Most of my recent readings and research has taken me into the direction of childhood trauma as being the most likely cause of most instances of mental health problems and a lot of chronic health conditions. Some pointers would be the ACE study, and start by reading works by Alice Miller, Bessel van der Kolk, Laurence Heller. Now, the medical consensus is quite different from what I've stated here, so I should back this up with some significant evidence, which I won't. The evidence is fractal-like, and there is huge predictive power in understanding this (that unmet developmental needs during childhood lead to coping strategies that are maladaptive in adulthood, and those are the cause of things like ADHD, chronic fatigue etc).

Is there a solution? I don't know, I certainly haven't solved my issues, but I've started to understand them. You'll probably have a hard time doing the research yourself, given the attention problems. In any case, there are risks associated with this path ...

But if it truly is possible to solve this issue, you'll not only be able to focus on coding. YOU'LL START LIVING.

I greatly struggled too, I didn't get it. For a long time, programming was very hard. But eventually I understood, and then was challenged again with new concepts. This keeps on happening and I continually learn and am challenged, but reading your post doesn't make me think you aren't a hard worker.

I think you are struggling with learning a language instead of learning how to think logically. Instead of learning a language, learn how to break up a complex requirement into discrete steps. An example --

I ask you to save inputted text into a text file called "file.txt". What are the steps you need to take (to write this in any language?) This comes with experience but I'll walk through it here:

1. Take in input from the user. 2. Write out input into file.

I don't know everything, so when I forget, I google this stuff. "How to take in input in C++". Okay, I understand what I need to code. Next, how to write a file "how to write a file in C++". Done. By combining these steps, I've accomplished my goal.

Basically, my whole experience has been following this pattern of taking a problem, breaking down it into individual parts, coding these individual parts, and coming up with the solution. However, with each step, you get into deeper detail. How do you take in input in C++? Well that's with cin, what's cin? Google C++ cin, ah okay. etc. As you program more, you start to memorize these steps, which lets you code faster and better quality. Instead of googling things, you remember that you have 2 steps you need to do to write out a file. Of course, working in different languages is basically the same, just different syntax for the same thing. I'd focus less on different languages and just one for the time being.

Take a read on a post I wrote up, I hope it's helpful: https://debugandrelease.blogspot.com/2018/12/how-to-become-b...

(comment deleted)
I’ll be he counterbalance and say quit ... if it’s been 10 years since you’ve started trying I’d imagine it’s not practicalities getting in your way ... whatever way you chose to learn should have gotten you to level 1 by now and if it hasn’t its worth reassessing whether it’s really you in the first place. Anyone can learn to code; it’s not a capacity thing but it takes work and if you don’t really care, wanting to be “the guy that can code” won’t get you there.
I want to build a few web apps. How is it possible if quit?

Is there any other option to build web apps except coding?

Make money doing something else, then use some of that money to hire developer on Upwork to code for you
It doesn't sound like programming is the problem, do you have this problem with learning anything else in life?
No, I am self-taught computer user. I learned English on my own.

Learning is not my problem.

Being a programmer is like being a musician. There are many different levels and some people are more natural at it than others. Some people can learn an instrument for years and never get good enough to play a tune (people who tried to learn programming). Some people get good enough paid to play (9-5 programmers). And some people are so good they go on to create own albums and masterpieces.

I've seen a lot of people who tried to become programmers just fail because they can't think like a programmer. However, I have found those same people are awesome testers, designers, planners, etc. I would suggest looking to see if you somehow are more better at something else in the web development realm. If you do find something then you'll at least be in web development and be part of something you find interesting.

Need more info really to diagnose your problem. For lack of focus you can try the pomodoro technique. Although I would say that if you can't focus on something chances are you also don't enjoy it. If you don't enjoy it why are you doing it? Do you want a high-paid job as a programmer? Because if you don't really enjoy programming then your life will quickly become miserable as a full time programmer. This is often masked as "burnout".

That said, I would suggest to learn coding by building something that you actually want to build. Maybe you have an idea for a project that could make money somehow? Then learn the bare minimum you need to learn in order to build that project.

If you just sit there thinking "I am going to learn how to code" then you will likely dick around learning little bits here and there with no real aim. Coding is a means to an end, not a means in itself.

Here is another idea: take a look at the projects on freelancing sites like Upwork. Try coding some of them yourself. You could make yourself a goal to complete a paid project on Upwork within one years time. Pick a language/platform, find projects in that area on upwork, do them yourself as practice runs, learn the bare minimum you need to complete each practice project. As you do more and more you will learn new things each time and eventually you will be confident enough to do a paid project (though you will likely have to bid a pretty low price to get the job!). But you will have the satisfaction of having earned hard money for your efforts, even if its not much!

I agree with this, particularly the bit about using Upwork. It doesn't pay well, but will give you a concrete task and a paying customer to hold you accountable. Submit a relatively low bid, with a relatively long timeframe, and be honest upfront about why the bid is so low. Then muddle through and figure it out as you go!
I have found out that after 10 years I am still spending more time on choosing which stack to learn, instead of focusing on any one and learning it.

Learn by building is great advice because I learnt basic HTML, CSS, and WordPress when I built a website for Excel tutorials. In fact, whatever I have learnt so far it is out of necessity.

It takes an evening to pick up basics of any framework but it can take weeks or months to build something with it... Learning just for the sake of it sounds a bit weird, pick one and build something, have fun while doing it :)
I have no idea if this is applicable to your particular situation, but I'll share what helped me. Maybe you're similar to me, but YMMV.

I tried on and off to learn programming for years, and I was never able to get any traction until I started doing it as part of an actual job. I just have never been able to get myself to focus on manufactured projects whose only purpose is learning to code. I needed actual business problems to focus on, and an environment where I couldn't just abandon my project with no repercussions.

I started out small, and with tasks that were related to my (non-programming) job -- these made my life easier but weren't on anybody's radar at the business. I was selling mortgages at the time, and built myself a better mortgage calculator, slowing delving into Excel's Visual Basic for Applications when I wanted to do things Excel wouldn't let me do without code.

After getting comfortable with that, I found more opportunities to do light programming that helped make my job easier, in the few hours at a time when I didn't have critical tasks in my day-to-day work. I started using SQL and VBA in Microsoft Access, then moved on to SQL Server and C# by taking a few freelance jobs. They paid terribly, but I took them more because they forced me to solve real problems using "real" programming tools. Eventually I was able to turn that SQL Server and C# toolkit into my full-time job.

TL;DR: what I needed were real-world problems to solve. If you can, find some way to write some simple scripts to simplify your everyday life, and use that to build on.