• BenVimes@lemmy.ca
    link
    fedilink
    arrow-up
    6
    ·
    edit-2
    7 months ago

    I am but one man whose only education in programming was a first year university course in C from almost two decades ago (and thus I am liable to completely botch any explanation of CS concepts and/or may just have faulty memories), but I can offer my own opinion.

    Most basic programming concepts I was taught had easily understood use cases and produced observable effects. There were a lot of analogous concepts to algebra, and functions like printf did things that were concrete and could be immediately evaluated visually.

    Pointers, on the other hand, felt designed purely of and for programming. Instead of directly defining a variable by some real-world concept I was already familiar with, it was a variable defined by a property of another variable, and it took some thinking to even comprehend what that meant. Even reading the Wikipedia page today I’m not sure if I completely understand.

    Pointers also didn’t appear to have an immediate use case. We had been primarily concerned with using the value of a variable to perform basic tasks, but none of those tasks ever required the location of a variable to complete the calculations. We were never offered any functions that used pointers for anything, either before or after, so including them felt like busywork.

    It also didn’t help that my professor basically refused to offer any explanation beyond a basic definition. We were just told to arbitrarily include pointers in our work even though they didn’t seem to contribute to anything, and I really resented that fact. We were assured that we would eventually understand if we continued to take programming courses, but that wasn’t much comfort to first year students who just wanted to pass the introductory class they were already in.

    And if what you said is true, that later courses are built on the assumption that one understands the function and usefulness of pointers despite the poor explanations, then its no wonder so many people bounce off of computer science at such a low level.

    • Corbin
      link
      fedilink
      English
      arrow-up
      2
      ·
      9 months ago

      Thanks for offering your perspective! It’s important that we keep in mind that not everybody who studies computer science becomes a professional programmer, and you’ve offered us good food for thought.

      For what it’s worth, pointers are fundamental for Von Neumann machines, which are very common in the computing world; your current machine and the machine serving this page are both Von Neumann. In such machines, memory doesn’t just store data, but also instructions; the machine has an instruction pointer, which is a pointer referencing the currently-executing instruction in memory. So, if one wants to understand how a computer jumps from one instruction to another, then one must somewhat understand pointers.

      • BenVimes@lemmy.ca
        link
        fedilink
        arrow-up
        2
        ·
        edit-2
        9 months ago

        You are welcome.

        Pointers do make more sense to me now than two decades ago, mostly owing to me being married to a computer scientist. But I always go back the fact that for the purposes of my first year programming course, pointers were (probably) unnecessary and thus confusing. I have a hard time understanding things if not given an immediate and tangible use case, and pointers didn’t really help me when most of my programs used a bare few functions and some globally defined variables to solve simple physics problems.

        EDIT: I’ll also say that pointers alone weren’t what sunk my interested in programming, they’re just an easily identifiable concept that sticks out as “not making sense.” At around the same time we had the lesson on pointers, our programs were also starting to reach a critical mass of complexity, and the amount of mental work I had to do to follow along became more than I was willing to put into it - it wasn’t “fun” anymore. I only did well on my final project because a friend patiently sat in my dorm room for a few hours and talked me through each step of the program, and then fed me enough vocabulary to convince the TA that I knew what I was doing.

    • FractalsInfinite@sh.itjust.works
      link
      fedilink
      arrow-up
      1
      ·
      9 months ago

      Aren’t pointers just an ID given to a verible that currosponds to its “true” position in the array of bytes thay make up a program’s memory? I feel like I’m missing something

      • BenVimes@lemmy.ca
        link
        fedilink
        arrow-up
        1
        ·
        9 months ago

        I doubt that you’re missing anything about pointers themselves. I may not have done a good job articulating why non-programmers have a hard time understanding them.