Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Learning how to code?
17 points by codinglearner on Aug 18, 2023 | hide | past | favorite | 26 comments
Hey everyone, I need your help!

I am beginning to learn how to code. I was wondering what peoples secret weapon resources here are and what you all can recommend.

E.g. I know about freecodecamp and other more mainstream sources, but was wondering if people have other recommendations as well.

As I am unable to rank the quality of the content I normally find online, it would really help to hear some suggestions.

E.g. someone recommended https://fullstackopen.com/en/, is that any good?

All the best and thanks in advance!




I'd like to focus on the "secret weapon" part of your question :)

I teach students, and I've seen all manner of people, and one thing that distinguishes those who get better vs those who don't is: consistency.

Show up every day to practice, to improve. Put in the effort. Try to do, try to be active. Listen to more experienced/accomplished people.

In the early days, it matters less exactly what you do. Most things will help, tutorials, courses, building your own thing. The difficult part is sticking with the process.

If you do these things *consistently*, you'll grow quickly.

PS: The second most important thing in my opinion is, managing discomfort/negative feedback.


This is super helpful, thanks! It also takes a bit the fear away that I learn the wrong language / use the wrong tutorials. Thank you!!


Three ways to learn to code:

"I want to mod Minecraft, write Quakescript, automate my Blender 3D models, make my job processing spreadsheets easier, make a check which alerts me when my internet drops out or my aquarium overheats, etc.". Task based. Desire for a solution. Google tutorials for the things you need to work with and move step by step forward. Learn as you go. Doesn't want to be a rockstar, wants to build something, solve a problem, play with tech. Will learn something practical.

"I want lots of money / a new career". Search for high paying jobs in your area, find what skills they need, target tutorials on those skills. Study hard, maybe bootcamp, grind leetcode, build showcase demonstrations of your ability, as necessary. Repeat until jobs start wanting to hire you. Will learn something marketable, may learn something practical, may not enjoy it. Accountant model.

"I heard about AI ML crypto bitcoin l33tcode red teaming cybersecurity I want to be a l33t hacker omg how do I make dark mode can I do this in a week what's the best bootcamp I have a great idea for an iPhone app which will be like Facebook but without the ads, I watched 30 YouTube videos on coding last night but today I can't write FizzBuzz in React am I not cut out for this??". ADHD. Not interested in code or tech, wants to be a rockstar without interest in music or wanting to learn an instrument. Probably won't learn anything.

Even though 3 is a parody of a panicked desperate teenager looking for an ego and your question is a lot calmer, the fact that you aren't using any of the zillions of existing tutorials, or any of the zillions of existing "how do I learn to code?" questions and answers on the internet, and haven't specified anything that you actually want to build or want to work with or want to achieve, puts you most likely in group 3.

You almost can't go wrong. If you're plotting a rocket course to orbit the moon, it matters which direction it goes in down to quite fine tolerances. If you're standing still and refuse to move 5 steps in any direction until you have the 'best' direction and 'secret weapon direction finder' that's just ... well, what it needs is a psychologist not an expert direction finder.


Thanks for the reply! It is fair that you indicate that my questions seems like group three.

I can assure you, I am not. I was simply a little overwhelmed and wanted to use swarm intelligence to find good approaches as there are, as indicated by you, so many sources out there.

I am more between 1 and 2. I have built software before, but with really scrappy Ruby on Rails to solve some basic problems. Now I am considering a career switch as I do not want to stick with my current job forever.

To specify: - I am interested in learning react / typescript / vue.js --> I am, at least from what I read / tried so far, a JavaScript fan and want to get more into that to start.

"You almost can't go wrong" is quite motivating as I was as mentioned a bit overwhelmed with the opportunities.


> To specify: - I am interested in learning react / typescript / vue.js --> I am, at least from what I read / tried so far, a JavaScript fan and want to get more into that to start.

Hello! I've been down this road before.

I personally would avoid TypeScript for now and just learn JavaScript well. Compiled TypeScript is just JavaScript anyway, so if you don't know JS, you don't know TS.

I would start with trying to make an app just using vanilla JavaScript. Start with a `index.html` page + a `<script>` tag, and see how far you can get. I was always more motivated to finish these projects when I was building something I wanted to use for myself. MDN is the go-to resource[1] for JS. I would go through the "beginner" tutorials on that page first, and then try to come up with an app. javascript.info[2] is also great if you need extra reference.

The reason I recommend doing all that before jumping straight to React is you learn how to write JavaScript without a library/framework, which I think gives you more options. It also shows you why something like React is useful to begin with. When you're ready to try a library, I would start with Preact without build tools[3]. Preact has essentially the same API as React, but it's lighter weight, and it's website has a guide to using it without build tools (which React docs no longer have, since they recommend you jump straight to using a big framework like Next now).

Eventually, you may want to use build tools so that you can split up your app into multiple .js files. In that case you'll have to install Node.js on your system. Node.js is just a runtime for JavaScript that you can install on your PC or server (kinda how you install Ruby on your PC). Most JavaScript build tools are written in JavaScript to run on Node.js, hence why you need Node. Node comes with a package manager called `npm`, which you'll see and use a lot. Preact has a good guide for getting started with Vite, which is a build tool. [4]

I think it's also important to know that most of these libraries (React/Vue/Preact/Svelte) are mostly interchangeable. They all have strengths and weaknesses. Pick what you're most productive with. These libraries are also far less opinionated than something like Ruby on Rails. Each of these libraries have equivalent frameworks that fill that niche. (React -> Next.js, Vue -> Nuxt.js, Svelte -> SvelteKit).

Good luck! Let me know if you have more questions.

[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript#for_...

[2] https://javascript.info/

[3] https://preactjs.com/guide/v10/getting-started#no-build-tool...

[4] https://preactjs.com/guide/v10/getting-started#create-a-vite...


Define something you want to build to yourself or to other people.

Learn the tools necessary to rapid prototype it.

Learn the tech needed to implement the prototype. You'll see yourself having to learn a handful of things in parallel, but try to make your project move in a linear fashion, one step after the other. Every time you hit a barrier, learn only the necessary to overcome it. Celebrate every progress you make. Make notes to somewhere public like a personal website/github. Manage your motivation, expectation, anxiety.


I would recommend you learn Python or JavaScript first and use an interactive coding environment like a Jupyter Notebook, because it will allow you to try different inputs and see the outputs (or errors) immediately. Learning/exploring through trial and error is very powerful.

For learning Python, you can check out this blog post I wrote recently, which makes an analogy between Python prompt and a regular calculator you are already familiar with. I go over some basic topics like assignment + for-loops + functions: https://minireference.com/blog/python-for-stats/ There is a lot more to programming than this, but if you learn these three concepts you'll have done a big chunk!

There are A LOT of good resources for Python beginners. I think you should try a few of them out and see which ones you like best. Here is one example https://www.youtube.com/playlist?list=PLbFHh-ZjYFwGeYhQ2yIQF...

Good luck with your learning. Remember that seeing errors every few seconds is normal... this is how everyone learns, and even advanced programmer run into errors all the time. It's part of the game, so don't be discouraged.


I agree with using Jupyter to get a good grasp of everything that’s going on and experimenting. However, while doing so, I think it’s good to keep in mind building something that’s not in a notebook format as I think notebooks tend to foster bad coding practices.

This is from my experience as someone straddling both academia and a data science position in a startup where I have seen it rampant on both ends (slightly more understandable in academia but terrible for anything that actually goes into production).


Yes, totally agree. I was thinking of notebooks strictly as the first contact... get the notion of python commands, variables, syntax, etc.

It would be great to "move out" all the working code that has been REPL-tested into a separate file. Bonus points if it is a standalone command-line-runnable script that does something useful, e.g. after reading inputs from `sys.argv`. The exposure to running programs in the command line is probably a key skill I would include in the ABSOLUTE BEGINNER (because it is a prerequisite for so many other things).

I suppose running a "server" would also be good to learn (even if just localhost), but that's getting into the HTTP/TCP/IP stack, so I would cover that CODING 102, not CODING 101.


Thanks, this is really helpful! I did not know https://jupyter.org/ before!


Besides freecodecamp, here are some additional avenues you can explore:

* W3Schools - https://www.w3schools.com

* MIT's introduction to computer science and programming using Python https://www.edx.org/learn/computer-programming/massachusetts...

* UCLA Extension's Coding Bootcamp - https://bootcamp.uclaextension.edu/coding/landing/

* Harvard’s Introduction to Computer Science course on edX (https://www.edx.org/learn/computer-science/harvard-universit...) and the CS50 YouTube channel (https://www.youtube.com/channel/UCcabW7890RKJzL968QWEykA


Harvard's CS50x on edx is probably the best free and online introduction to CS and programming. It will give you an incredibly strong foundation. [0]

teachyourselfcs has a solid list of canonical resources that are common across many university programs. [1]

The Art of Problem Solving books are great if you want to learn math to a high level, though it isn't strictly necessary. [2]

[0] https://www.edx.org/learn/computer-science/harvard-universit...

[1] https://teachyourselfcs.com/

[2] https://artofproblemsolving.com/store


Thanks! I really liked https://teachyourselfcs.com/! And https://artofproblemsolving.com/store indicates I need some math refreshers haha :D


Again, "need" is a bit strong.

Successfully working through those books will have prepared you for the toughest math undergrad programs in the world, so it's a bit overkill, but the road is there if you wish to take it.

As an aside, something I should have recommended in my original comment is to learn efficient study habits, which will accelerate all of your efforts. This course is short but highly recommended: https://www.coursera.org/learn/learning-how-to-learn


You mentioned freecodecamp, which although I haven't gone through myself I've seen recommended many times. Is there a specific reason why you're looking for more resources?

The reason I ask is that a common newbie mistake I've noticed with people who want to learn to code is bouncing around from learning resource to learning resource without going deep with any one of them. Nothing wrong with getting different perspectives, but at some point, it's going to get hard because you're learning something hard.

It's a little hard to give specific suggestions without more information. If you've tried freecodecamp, was there something about it that didn't work for you? That would help in giving you more actionable advice.


Learn X in Y Minutes[1]. Shows you all of the things you need to know in a programming language in code, with fully commented examples. I use it mostly as a reference, but I used it to learn some languages, such as C++, Rust, and Vala. When I was young, I was given a "Get Coding!"[2] book (the first one), which covers the basics of web development, HTML, CSS, and JavaScript, which really jumpstarted my programming career.

[1]: https://learnxinyminutes.com/

[2]: https://getcodingkids.com/


Just checked out https://learnxinyminutes.com/, awesome tip!! We need more of these sites!


As always, "it depends."

What does "code" mean?

It sounds like you want to code front/backends for HTTP/Internet stuff.

If that's the case, you'll get lots of help, here, and you won't need much, in the way of equipment and software.

If you want to write stuff for devices (Droids, i-devices, computers, IoT, etc.), then there's no substitute for actually having the device, and the development environment (often, one and the same).

Also, "coding" != "software engineering," but that's something that you'll learn, down the road. For now, getting some "hello world" stuff going, is a start.


Web Dev or Software Engineering? For web, I'd recommend starting with some basic youtube tutorials on building a clone of X. The goal here is not to really learn the concepts, but to learn if you enjoy it. There will be alot alot of learning and effort involved throughout this career. You need to learn if you can stay motivated because you genuinely enjoy it or if it will be a slog.

Then I'd recommend FreeCodeCamp. Don't worry about languages/frameworks/etc - you'll get there.

Don't go the codecamp/paid course route until you've tried building a bunch of things.

Software, start with CS50 MIT course.


My advice (based on my own experience) would be to try everything you can find until you find something that clicks with you.

When I’m trying to learn something new having a bunch of different perspectives and explanations is important because for one reason or another, some will click with me right away, and some won’t.

Sometimes one persons explanation won’t make sense to me until I’ve learned the concept from someone else - so it’s not only about trying a lot of sources but also going back and retrying ones you may have bounced off of initially.


Here is my bootcamp https://github.com/Lesabotsy/bootcamp, which if you are serious about learning is the best to learn imo. There is a link to a discord group where people hangout and discuss the courses. Everything is free and open btw.


the invite to discord is invalid


I recommend this: https://cscircles.cemc.uwaterloo.ca to learn Python and the basics of programming. Then Angela Yu's web development bootcamp on Udemy


CS50


Check out the Upwind section of this PG essay (and the rest of the essay). http://www.paulgraham.com/hs.html

What do you want to do with coding? What's going to give you the most leverage in the long term?

That course is going to dump you into the deep end for modern web dev. You'll probably struggle with it because it's taking on a bunch of things all at once. Some of the technology is also temporary. Will MongoDB or GraphQL still exist in 30 years? Will HTML, CSS, and JS exist in 30 years? Focus first on fundamentals that will give you a leg up.

I know professional frontend devs that still struggle with HTML because they went straight into React without learning semantic HTML first. If you can master the basics early on, then learning React and other frontend frameworks later becomes way easier.

Start with building web pages rather than web apps. You can do apps later but there's a lot more stuff going on. It's like trying to ride a unicycle while juggling flaming torches and balancing a spoon on your nose. Maybe you could sort of figure it out but it's better to split up the tasks and handle each in turn. That course is for people that already know the basics and want to try balancing on a new unicycle.

If you want ways to practice frontend, try building copycats of websites. Read the DOM, look stuff up, make lists of HTML elements or JS built-ins and memorize them. Play games to learn CSS flexbox or grid. Do whatever as long as you like it and it's teaching you the way.

There's lots of other stuff like frontend challenge sites that are good too. You'll always be "challenged" going forward for professional projects. Some might be really easy tasks, others will be hard. Get used to being resourceful and learning how to figure things out. It's an infinite game.

This style of learning isn't unique to frontend. If you wanted to be a backend dev, learning Spring Boot before design patterns, networking, etc. would probably be a bad idea. It's better to start as a beginner and embrace learning the basics. Go slow and master things step by step. Eventually it pays off.

You could also zoom out and abstract things to help with programming languages. Popular languages are pretty similar. Familiarize yourself with basic control flow syntax in one language and chances are it carries over into others. The same goes for "paradigms" like imperative, OO, and functional programming (others exist but they're more niche). Learning a paradigm is like rebuilding the thought process for your brain. If you learn different paradigms, then your thinking gets more flexible and you can approach problems differently. You might like the "aha" moments you get when things finally connect too!


Enthusiasm is usually the key, so it's important to aim for some small, achievable goal that you'd like to achieve. For example, making a game; or automating something on your computer; or doing something interactive/visual on a Web page; or analysing some dataset; etc. If you pick a project you care about, it makes the required reading, trial-and-error, etc. much less tedious. Likewise, if you're not at all interested in some sub-field, then no amount of hand-holding, gamification, drag-and-drop tooling, etc. will make up for that!

If your chosen task seems daunting, feel free to break it into something simpler (e.g. for a game, turn-based may be easier than realtime; text interaction may be easier than graphics; 2D easier than 3D; etc.)

Your choice of project will then determine your learning path. For example, Web stuff is all about Javascript; but data analysis may be better in Python; and automation may be easier with Applescript; etc.

I would avoid starting with something "overly ceremonial"; e.g. Java forces everything into a "class hierarchy", Rust requires references to be "borrowed", C requires memory to be manually allocated and freed, etc.

So-called "scripting" languages are a good way to avoid such complications, e.g. Python, Scheme, Javascript, etc. That way you can focus on one thing at a time (you can learn class hierarchies, borrow-checking, memory management, etc. later!).

Avoid languages/systems which have a bad reputation, e.g. Perl, PHP, C, Bash, etc. When learning, it's hard to know what's fundamental and what's just a quirk of that particular system; learning with a particularly-quirky system can make this harder.

When learning a concept, try it in a few different languages (again, to work out what's fundamental)

Don't bother too much about "good practice" or "bad practice" when learning. Make a note if you come across such recommendations, but they can lead to second-guessing oneself and unneeded complexity that obscures what's going on. Focus on "minimum viable projects". Also, following advice that you're not yet able to understand can lead to "cargo culting". Once you're confident/competent enough that you can hack together some solution, you can revisit that advice to see why some approaches may be better than others.

Once you start to feel comfortable, try playing with some big new idea. Sometimes it can help to use a radically different language which forces you to think in that new way; good examples include Prolog (logic programming), Pure (term rewriting), Haskell (pure functional), Smalltalk (message-passing), Forth (stack based). This is good for making you think more deeply, and gain a better understanding of what's going on.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: