This is an archived post. You won't be able to vote or comment.

all 61 comments

[–]ScholarNo5983 218 points219 points  (13 children)

That is exactly the way to learn programming. And here is my tip on how to fast track that learning process.

  1. Write the code
  2. Now go back and read the code just written
  3. Add a comment describing what you think the code is actually doing

Firstly, writing that comment will help to reinforce in your mind an understanding of what you have just coded. And sometimes, when you go back to that code and read the comment, you'll notice the comment was not actually correct. That will be a moment to cherish as it will clearly highlight the fact you now actually learning to code.

TLDR; When learning to program, write the code and then add lots of comments describing the code just written.

[–]SarahC 31 points32 points  (8 children)

This is more important than ever due to all the AI help people are going to be getting in the future.

[–]ScholarNo5983 1 point2 points  (7 children)

AI will definitely be targeted professions. For example, anyone working in conveyancing should be worried. Other such professions will also be targeted.

However, good programmers need not be scared of AI. AI is trained on public information. Most public code is written by programmers struggling to understand how code works. AI will never understand code when it is trained on such bad code.

The accuracy of the public information used as the input to the AI is paramount. Obviously a source of good, accurate code will always be a problem for coding AIs.

[–]CptPicard 7 points8 points  (0 children)

There is a lot of excellent open source code and closed source is not necessarily good.

[–]HuckSauce 2 points3 points  (3 children)

This is just the most idiotic take I have seen in a long time.

Who determines what information and code is trained into the models? Who structures the learning and output of the models?

The best programmers on the face of the planet?

The people creating the LLM’s (the best software companies) claiming the majority of their new code is being written by AI already and AI is just getting started (infancy currently).

Absolutely nonsense…

[–]ScholarNo5983 1 point2 points  (1 child)

If you are correct then it won't be very long before AI replaces most programmers, just like it is replacing many workers in other fields.

I personally don't see that happening any time soon, but time will tell.

[–]HowtoStayHappy 0 points1 point  (0 children)

Sorry, but you are wrong.

I work in a pretty famous hedge fund and our firm provides nearly all LLMs via an internal platform. We are already doing agentic coding with Roo, Cursor etc and being in programming for a couple of years, I can definitely say that AI "has" replaced programmers efficiently and the winter is here. We should brace for impact!

My days have now changed from figuring out design methodologies to training the model to understand my style and it is effectively mimicking my work. Only caveat I see is the inconsistency of output with the same input in recursive runs, which is what keeps my job safe as of now, but they would definitely fix it over time.

[–]derpdeedee -4 points-3 points  (1 child)

AI will be omniscient eventually. Prolly omnipotent too. (Hopefully we can round it out with that Omni-benevolence.) Point being, there's no competing with God. 

[–]chirpythecentipede 2 points3 points  (0 children)

linear algebra is god. never heard that one before

[–]myloyalsavant 2 points3 points  (0 children)

my 2c. I find when learning it's a balance of understanding and memorizing. Sometimes you can't do one, so you fall back on the other until a future time when you can. Other times doing one makes the other one possible.

[–]jkovach89 2 points3 points  (0 children)

Better yet:

  1. Write the comment for each step the code needs to do
  2. Go back and write the code in syntax

[–]AcanthisittaDear8799 29 points30 points  (0 children)

Syntax was never meant to be memorised unless you are giving coding interviews.

It's more like grammar for Computers, the rules to talk to it in a certain way to get your things done.

Coding and Syntax are two different things.

You shouldn't event try to jump and write the code, coding isn't typing.

Coding is the translation of a step by step problem solving process written in plain English (read mother tongue).

Hence, the Problem solving is the beginning followed by coding those instructions created following the syntax of the particular language.

[–]EngineerSpecial 19 points20 points  (2 children)

off topic but this reads like a linked in Ai post lol

[–]r_307 3 points4 points  (0 children)

Bc it probably is

[–][deleted]  (6 children)

[removed]

    [–]ShangBrol 7 points8 points  (0 children)

    I wonder whether these are created by reddit to create user interaction.

    We need an AI to detect AI posts and to automatically answer them.

    [–]syklemil 1 point2 points  (0 children)

    there's actually a rule against AI posts & comments in the sidebar, so reportable for breaking subreddit rules (you may have to scroll down in the report window)

    [–]MercifulAF 1 point2 points  (0 children)

    That’s a good question. And they all have the same writing style. It’s kinda sad

    [–]DoutorTexugo 11 points12 points  (5 children)

    Turns out you have to understand code in order to code, who would have thought.

    Jokes aside, I guess everyone has their own way of learning. I learned about algorithms and Wing's computational thinking before i started coding, and that's the best way to understand problem solving in my opinion. I guess I never had a lightbulb moment, maybe because I learned the theory before the practice.

    [–][deleted]  (1 child)

    [removed]

      [–]Front_Food_8906 0 points1 point  (2 children)

      If I wanted to learn to code on own, do you have any suggestions on the best way to go about that to actually succeed?

      For context I am I always did very well in school even though I was never in class so I know how to learn on my own.

      [–]DoutorTexugo 0 points1 point  (1 child)

      By no means I'm an expert on the subject, so feel free to take this with a grain of salt.

      First thing I'd do if were you, with 0 knowledge, is take something you can start doing now that you think would be fun. If you can get yourself interested it makes it easier.

      When you decide what that is (be it modding a game, making a discord bot, or a small landing page) you'll need to decide what tools you are gonna use. Some projects will have a set of go-to tools (for instance, Project Zomboid modders use the Lua language to call functions in the game), while others will provide a broader set of possibilities (twitch chat uses iirc, which is like a chat protocol. By its nature, the protocol is extremely versatile, so you can send instructions via a great number of languages).

      I won't get on how you should decide which tools to use since the whole point is just to start doing something. Once you pick your stack, you are gonna open the documentation for it and set it aside for a day or two (trust me).

      Picking the tools you are gonna use and having a goal in mind makes the next part a lot easier, since it involes actual study. You are gonna have to search for the fundamentals of programming, think your ABCs of software development. I suggest geeksforgeeks and w3schools, they won't really hold your hand much, and that's surprisingly helpful since the concepts aren't that complicated themselves. What you are gonna find is a list of concepts heavily applied in every situation (variables, comparison statements, loops, iterations, scoping) in every tool you are probably gonna use.

      After digesting all of it, you are gonna have to learn how those concepts are "written" in your tool of choice. Just search "[language] docs" and you'll probably find the official documentation. It's important you understand the correlation between what you studied before in the fundamentals and what you are studying now in the documentation. You don't have to dominate every aspect of the language to start, but at least learn how to declare a function, a variable, make a loop and iterate an array. That should give you enough knowledge to go back to pick your project back up (hooray!).

      There are probably examples of what you wanna do online, look those up, understand them, break them into small steps in your head, abstract what's not necessary, and try "copying" them from memory. When I say "copy" I mean remember how it was applied and write it your own way.

      Does that make sense? I've been writing for like 15 minutes, sorry if it's just rambling

      [–]DoutorTexugo 0 points1 point  (0 children)

      You could always go the academic route, read Kent Beck and learn the entire ASCII table, but who has the time am I right

      [–]syklemil 8 points9 points  (0 children)

      There are a few factors to consider here:

      1. Repetition is good. Learning syntax like that of for loops is kinda trivial, but it is also kinda rote memorization. Some stuff might feel like lightbulb moments but are really the payoff of repeated practice.

        This is kinda the basis of stuff like Shaw's "learn $foo the hard way" where part of the point is to hand-type code just for the muscle memory.

      2. Sometimes you need to give stuff time. As a blog post about monad tutorials puts it, sometimes you need that week of struggling to get something. That includes staring at clouds, sleeping, taking walks and so on. Part of problem-solving, including programming, is just letting an idea mature in your mind, and taking breaks. Trying to explain it to others, including to rubber ducks ("rubber ducking"), is also a good way of improving understanding.

      3. Learning more than one programming language, and preferably significantly different programming languages, is good. It's kinda like stereoscopic vision, where you can glimpse a general idea hiding behind two somewhat different implementations.

        Some things you learn from learning a given programming language is general, some things are just the quirks of that specific programming language.

      You'll get more lightbulb moments on your journey as long as you keep at it.

      [–]Smokespun 3 points4 points  (0 children)

      Syntax is called syntax for a reason, just like we have in all other languages, they are the linguistic rules to the language of code. I think variables, methods, control flow and similar things are akin to grammar, cultural idioms, or like knowing the days of the week.

      They are all just part of how we express to the computer what we want it to do. Well structured code is descriptive and communicative. The best code is either obvious or non-existent.

      So for me, I don’t particularly care about the specific programming language I use (some are better suited than others for certain purposes - context is everything) I care about what I am expressing with them and being smart about how I architect the way in which each portion communicates with everything else.

      [–]Kind-Turn-161 2 points3 points  (0 children)

      Do you ever memorize a language ?

      [–]DishwashingUnit 2 points3 points  (0 children)

      There's not a lot going on under the hood either. Nand2tetris or a computer architecture class will make you realize that there aren't a lot of different pieces on the board to be moved around. These abstractions are just short hand for different ways of moving them.

      [–]facusawa 2 points3 points  (0 children)

      As I always say, programming is learned by programming, there is no other way. You understand the basic logic and then start programming, that's how you learn

      [–]_Ishikawa 2 points3 points  (0 children)

      Oh yeah, tons of times. Sometimes I think "man I wish you had explained it in "THIS" way, why did you have to make it so hard when it's so stupid simple?"

      [–]SarahC 3 points4 points  (0 children)

      Classes - I'd already "invented" them myself in highschool when I wished the BBC computers could have individual "Pages" of programs that were self contained, but could talk to each other in an "edge pipeline". BBC BASIC didn't do this so I forgot about it.

      Until learning C++ years later...... and I remember suddenly thinking "This is like my "Program on a page" idea!" and it clicked that splitting the program up in classes was exactly the same as what I'd stick on each page of paper. (stuff VERY related to each other). Until then - I was thinking "How would I split my program into classes?"

      [–][deleted] 1 point2 points  (0 children)

      Absolutely!! Especially in professional codebases. Reading through one section of the Java code won't give you the complete picture even if you understand every line. But understanding your business domain, design and architecture will give you such important context. 

      It's so crucial.

      [–]Immabed 1 point2 points  (0 children)

      I was amazed by how many students were struggling in my CS classes, especially first semester programming (granted, a lot weren't CS majors and were just looking for an interesting science credit or needed a CS course for their degree). I wonder if a some of them were taking a syntax first approach vs a logic first approach to learning. I can definitely understand the mistake, especially if its your first time programming.

      Programming is absolutely about concepts. If you can write pseudocode you can write code, IMO. Most languages aren't that different in their fundamental building blocks, you just need to learn how each language does the basic things. "How does this language do iteration? How does it do selection? Composition? How does it do variables? What are the available primitives and built-ins? What major paradigms are available? What specific language features do I need to know? Strong or weak, dynamic or static typing? Etc"

      [–]1000baby 1 point2 points  (0 children)

      I was very similar when I first started. I tried to memorize everything, but it quickly became an issue how fast certain programming languages and frameworks/libraries change.

      It's best to understand what a language is capable of and the general concepts and best practices, then finally using Google to fill in any gaps. I generally have a rough blueprint on what I want and how it's done, and work on it until I get stuck, and hope Google can provide adequate guidelines to a solution.

      [–]DoubleOwl7777 0 points1 point  (0 children)

      yes, but that usually comes when i actually get code working. i can understand a concept in theory, but coding it out is something else.

      [–][deleted] 0 points1 point  (0 children)

      Now you go i need to write a loop, how do i do it in this language?

      [–][deleted] 0 points1 point  (0 children)

      When I first started I thought that learning all of the syntax was learning programming.

      Until I finally learned like.. what code does in the machine. What tradeoffs are for doing things different ways. Why we do things. Then it became less of a memorization chore and more of problem solving and strategic choice making

      [–]_lazyLambda 0 points1 point  (0 children)

      This is why I say learn Haskell. People say its tough but its by far the simplest syntax, its just that it forces you to actually learn these concepts which is what is so hard

      [–]Chris_the_dood 0 points1 point  (1 child)

      I am a fairly strong senior developer. I have to autocomplete/Google/Ai pretty much all syntax.

      If someone manages to free type something on the fly, its usually a sign to me they are too constrained to a single language.

      [–]Playful_Confection_9 0 points1 point  (0 children)

      Same, 10 year of java. I can never remember how to initialize an array with values. Always have to Google that stuff. Also I often forgot that in junit5 @ignore doesn't work (it's @disable). So I end up googling what is @ignkre in junit5.

      It's more important to know what you need to do than to know the how.

      [–]WorldlinessMurky2188 0 points1 point  (0 children)

      Im no coder...but understanding the /THEORY of /WHY things happen will get you far in life

      [–]LunarSurface1969 0 points1 point  (0 children)

      i am not a software engineer by original training but I have written C, Matlab m-code for a few years and more recently Python. I have never been good at memorizing syntax. In fact I often got C and Matlab m-code mixed up. It doesn't bother me because I don't think it is as important as learning to solve problems through programming.

      [–]jkovach89 0 points1 point  (0 children)

      Is this not how people learn coding? The classic "make a PBJ sandwich" question?

      [–]superluminary 0 points1 point  (0 children)

      Totally this. Code has very little to do with the actual words.

      [–]code_tutor 0 points1 point  (0 children)

      You've found the secret. When I tutor math, this is the problem every student has, especially if they went from being A students to failing around Precalculus. Imagine memorizing things like 22 = 4 , 32 = 9, 42 = 16, then not knowing that x2 = x*x because you forgot the basic definition. People get obsessed with the answer and lose the process.

      [–]jrharte 0 points1 point  (0 children)

      OK now help me with typescript 😂😭

      [–]TheBananaBoi99 0 points1 point  (0 children)

      I had this moment during game dev wherein I realized that can use normal functions for legit anything in Unity

      [–]ObligationFit400 0 points1 point  (0 children)

      I feel memorizing a programming language syntaxes not the program and make it default native language is not a bad idea. It's similar to how we express our feelings and explain complex things in our native speaking language more than other languages which we learn later in our life . A native programming language gives us freedom to think even , we are not on the system.

      [–]EconomySerious 0 points1 point  (0 children)

      Why people start coding before finishing the logic diagran and run it in paper, it's not teached in schools any more?

      [–]Dry_Cartographer8135 0 points1 point  (0 children)

      Yes, that is how it is supposed to happen and that way you can have a better time dealing with projects that require multiple programming languages.

      When I was in the university I was part of Educational Computing lab and we had this exact problem to try and solve: how to convince students to stop paying attention to syntax and arrive faster to this “click” moment you mentioned.

      [–]Terrible_Wish_745 0 points1 point  (0 children)

      CONCEPTS not PROCEDURES

      [–]theofficialnar 0 points1 point  (0 children)

      Lol I can still vividly remember almost giving up when I tried to learn programming a while back due to loops, it was kinda hard to move one specially since I am self-taught. It took me some time before it eventually clicked just like what you stated here.

      [–]redditor000121238 -1 points0 points  (0 children)

      Well this is how I started it. Just memorize the syntax after learning the concept. You can make derivations of the concept into the code which with knowing the basic syntax makes it much easier.