this post was submitted on 07 Mar 2024
491 points (93.9% liked)

Programmer Humor

19660 readers
310 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] Corbin 2 points 8 months ago (1 children)

Yeah, some folks have trouble with pointers, and computer-engineering curricula are designed to discourage folks from taking third-year courses if pointers don't make sense. It's a stereotype for a reason. I'd love to know if there's an underlying psychological explanation, or if pointers are just...hard.

[–] [email protected] 6 points 8 months ago* (last edited 6 months ago) (2 children)

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 2 points 8 months ago (1 children)

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.

[–] [email protected] 2 points 8 months ago* (last edited 8 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.

[–] [email protected] 1 points 8 months ago (1 children)

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

[–] [email protected] 1 points 8 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.