Ask HN: How can I learn to code in a practical environment?

7 points by PaperclipTaken ↗ HN
University has so far taught me how to write algorithms, how to document code, and plenty of valuable abstract concepts. When I graduate, I'm estimated to be worth 80k.

But I don't know how to code. Sure, I can go into C++ and write a graph algorithm to do x or y, but as soon as I start trying to write a program that might be useful to someone, I find myself switching between Google and a blank screen for several hours, maybe writing a few lines here or there but eventually giving up entirely.

I want to learn, but I have no idea where to start. All of my experience is formal and all of my theoretical knowledge feels wasted because the only way I can implement it is to have someone else do it for me. I've tried internet tutorials but so far I've just felt stuck.

What are some steps I can take to reverse the situation?

10 comments

[ 3.2 ms ] story [ 34.1 ms ] thread
You say you can write a graph algorithm. All you need to do is follow through and stick to a project long enough to research the necessary stuff and finish.

You might start with small projects. You may be able to find some online course which walks you through making small projects (rather than the typical algorithm stuff).

Make small projects that you want/need, e.g. a utility that changes volume based on current time. That way, there's some drive to complete projects. You could also freelance, as money is a good incentive for getting things done.
As others mentioned, you need to start with small projects and work your way up. Remember that Google is your teacher, there is no other way to learn how to code practically. If you're not Googling, you're not learning.

There are many, many areas of programming and no course will cover them all, or even one wholly. You just work on new stuff and you will retain what you use frequently. This knowledge gets more vast the more you code.

"If you're not Googling, you're not learning."

Exactly.

That's funny, when I do that (too often in my taste), I feel like I am just hacking without really understanding anything. Also, I sometimes wonder how people did without google and SO.
When you are sitting and looking at a blank screen, why are you stuck? Is it a problem with comprehending the problem, or a problem with breaking it down?

This is what works for me: 1) get general understanding of problem to solve 2) break it into steps or pieces 3) code pieces

Now, 2) might (hell, might? probably will!) reveal step 1) wasn't complete, so go back and improve your understanding, then move back to 2)

Over time you develop the ability to do a 'top down' approach like this, while also having a parallel 'brain space' that considers application architecture, customer requirements, good programming practices and so on.

Besides this 'concept of programming' (which is very personal, I'm just sharing how it works for me after ~20 years), don't give up and don't feel overwhelmed. In my experience, except for very rare 'super-programmers', good software is developed slowly, steadily, and built up one solid piece at a time. Break your 'useful program' down into pieces, and celebrate the achievement of developing (and testing!) each piece.

It gets easier (and then harder, but it gets easier first). :^)

"I find myself switching between Google and a blank screen for several hours"

This is normal for anyone who codes, even the pros and experts. So do not sweat over this thing.

Now, on the question of how to code/learn, I suggest you start with a small target/end goal. For example, "Build User management system" or anything like that. Then, pick a language of your choice and start coding. While you do that, you will google 100s of things, read stackoverflow plenty of times and bang your head on the screen as well. But at the end, you will be happy when that code finally compiles and run successfully or you don't get a 500 error in the web app. Stick to that project, finish it off no matter how small it seems like. You will learn a lot in the process. I am doing exactly that right now with web programming/dev. using Python/Flask framework. Last night, I learnt the best way to generate user activation links and how to use them. Simple stuff but I learnt like 10 things doing this alone.

Find a job coding - even if it is part time or as a intern. Nothing will get you up to speed faster than having to push code live on a functioning app.
Start right now. Don't waste time deciding. Write a short list of applications that you would like to build. Then pick the one you like best. You might not finish it entirely, but you will find something that will look more attractive. Keep moving. Start a new application every week. Do differents things. Focus on learning the flow of code and dont worry about optimizing too much. Also, forget what you were taught in school about speed. In the real world, people focus on how stable the program is, how safe it is, how easy it is to use, and how fast it is. I also reccomend that you find a local startups/tech group and join them. Start talking. Tell them that you are studying and want to get your feet wet. I'm sure someone will give you a chance to learn.