why adults who are not very cracked (like me) should learn to code (and how)

I've never written anything remotely deployable. I have been writing random half-assed codes for about all of my life mostly for math/sci interests (sometimes even for research or data vis, don't know why they let me do that stuff). Needless to say I've never systematically learned to code and I'm not coder-brained (this is sort of a lie but all I'm trying to say is that I didn't study CS, never leetcoded, etc). Whenever I need to code something I look up 10 tutorials and follow them at once. Whenever things break I get really scared. I am 22 years old and I have a math degree and I just learned to seriously use Github from IDE last week.

Skill issue? Not quite. You'll be surprised at how many people, even people in quantitative/scientific disciplines, have the same sort of grumpy reservation I have to coding that mostly goes something like: I don't code, there's no point in learning because I'll never catch up to people who are CS majors / people who think in code, I prefer the pure stuff anyways and I'll never be asked to code anything in my life, there are too many languages and I don't know what they do, it's all fluff, things break all the time, plus there are so many other people who code they don't need me. If I ever need anything coded I'll just hit up my buddy.

This is all wrong, of course. Unfortunately you'll have to learn to code. After I started working I realized that learning to code is like just like learning to talk. You can learn a piece of cool math or theory and think that it's really great for solving a problem, or you can dream up all these great tools you'd like to have or guesses that you'd like to test. But you'll only really be able to show other people, step by step, why your idea is goated if you code it up into a picture or a function that actually does the thing you thought it would do. And it'll fail like probably 60% of the time. If any of the above sounds roughly like the work you do, unfortunately you'll have to learn to code.

And compared to other idea-showing tools like Tableau or Excel or any other tool that bypasses coding, learning to code is the only way you won't be limited by the tools of the platform. (Granted you still depend on packages and stuff but the whole point is that people have written a lot more code than people have made fancy apps with easy-to-use interfaces.) If you do data stuff, there will be a point where you come up with a sophisticated idea beyond Tableau's features. If you have qualitative theories you might as well test them with some elementary statistics. If you're an Excel wizard you already know half of coding. Just learn to code.

This is not a tutorial for people who want to become software engineers, but for people who should learn to code to help them solve problems they already solve for a living/etc. I have been coding every single day for a month now and here are some things I've found helpful. (Also when I said learn to code here I meant mostly Python but obv YMMV and you should probably learn the best language for your purposes. But most of the times it's Python)

  1. Start with a series of questions and projects.

For anybody who didn't start coding every day since they were like 12 or something (myself included), you need to start with a series of questions you want to do and projects you'd like to make. You won't be able to do them now but it's good to have a big goal. This will also help you focus your learning towards those projects. It's important to have this because whenever you feel like coding is gratuitous you can remind yourself that these are YOUR questions that only YOU are thinking about and projects only YOU want to make.

  1. Start small then pick an IDE.

When you first start you probably just want to learn how to make a table or write a simple function so you can use in-browser environments in W3schools or Google Colab (for Python) or whatever coding environment an online tutorial gives you. But very soon you should pick an IDE, which you should think of as am app where you do all of your coding, like Word/Excel. You will download everything you need and follow tutorials to set up the IDE. Then you should learn the features of that IDE by heart, like shortcuts and buttons and everything, because it will make things so much faster down the line. Most people use VSCode but obviously it depends on your language. It's definitely going to be a rough start, but you'll realize that you can download degen anime themes for your IDE and very soon it'll feel like a home to you.

  1. Make a personal website

If you're learning to code you can learn a lot from making a personal website. When you make a personal website it forces you to start thinking in terms of a project. I'd have to find a host then a theme then the engine first. I'll think about what information I want to put and what the layout would be. People also usually become very particular about their personal websites and it motivates them to learn a specific thing, for example they'll be like oh I want this button to spin and then they look up how to make a button spin.

  1. Learn github

At this point of the process you should learn how git works and how to store everything you write on Github so you can access them anywhere. A lot of people say you should learn version control earlier which is true on some levels, but I didn't need version control till after my first project and I never even had the intuition for how to use git until I've actually made a website and project. (You'll need to learn command line related stuff, for example; and you'll need to see how all the packages and tutorials you use lives on Github organically) And then you can upload everything you've ever done to Github and work on them anywhere.

  1. Read tutorials and REWRITE THEM

You learned to code because you had specific things you wanted to do. Those things can be broken up into sub-things that people already know how to do and have written about. You will read 10 billion tutorials and blog posts and forget most of the things in them (this post being one of them). And then you'll be like me asking ChatGPT how to rename columns in a dataframe after writing about 2k line of pandas. You will forget syntax because it's easy to forget. And you will forget the logic behind a chunk of code after you paste the chunk from tutorial to your file. This is why you should rewrite all your tutorials when you're first starting out. This could be as easy as writing the sub-problem you're trying to solve in this session, then adding extra detailed comments to your code, then saving that as a file or something. You-in-a-week will thank you for doing this.

  1. Code with a notebook open

People always say "write clean code!" which is true and good, you should clean up your code to make it easier for future you and your collaborators, but I think it's more important to code with a notebook open. What I mean by that is beyond rewriting tutorials, you should summarize each new output / each new function with a few notes like why you made it, what it does, and how it fits into the project. It's time-consuming to decipher unclean code you wrote a week ago, but it's even more time-consuming to decipher why you wrote all this a week ago. Over time, this also helps you develop intuition on what things you should spend time on and polish and what things are one-off, which will help you decide whether to write something into a function/package. This is why keeping a journal is so important: you record progresses and failures and prevent yourself from going down the same dead end twice. Then, if you're confused, just read the journal. If you feel lazy about it think of a cringe analogy like pirate keeping a ship log or something. I still forget to do this sometimes and find myself spending time going over old code having no idea what's going on. I really wish I started doing this sooner.

  1. Reap what the dead have conquered

James Baldwin, talking about art's importance to the world, had once said: "You read something which you thought only happened to you, and you discover that it happened 100 years ago to Dostoyevsky. This is a very great liberation for the suffering, struggling person, who always thinks that he is alone." The same thing is true for coding. When you start to code you'll never be alone again. On StackOverflow, Github, various personal websites, Y2K style forums, obscure forums in other languages, you will find someone who's had the exact same problem as you, anywhere from a week or two decades ago. And they will have insights on the problem, perhaps outdated insights, perhaps solutions, perhaps approaches that will lead you to other things. Once you move beyond the basics, much of coding involves reaping what the dead have conquered: knowing where to find answers to your questions, stringing together ChatGPT answers and seven different StackOverflow posts, learning how to move on when one thing you tried doesn't work. While doing this you will find absolutely beautiful things: anons who answer your StackOverflow questions with 1 line of code within 13 minutes of you posting it, open-source libraries maintained by thousands of volunteers, packages that depend on a package that depends on another package, triple-legacy code that's been updated and rewritten for your exact purpose, people who's found a streamlined solution to your sub-problem that allows you to move on with the rest of your project. Only "seeing the world" and having "real life experience" like this will make you better at coding. And you'll make friends along the way!

--

This is not a perfect tutorial, of course, and a lot of this stuff is very elementary. But I speak for the laity when I say that there is too many "learn to code!" fluff out there, but this tutorial doesn't assume you know anything and very solidly lays out the things you should do to take you from 0 to a project. And of course YMMV but this is just the page I wish I had when I haphazardly coded-but-didn't-learn-to-code for the better part of my education. I'm still learning to code. If you have any tips you should drop me a note on Twitter.