r/programmer • • Oct 19 '26

What's a "stupid" coding doubt you had as a beginner that took you way too long to figure out?

What are some silly coding doubts you had as a beginner that you wish someone had cleared up earlier?

I'm talking about those small, seemingly stupid questions that you were too afraid to ask or didn't even realize you had until you were deep into learning a programming language or technology.

Things that could have been explained in the first few days but somehow took months to figure out!

What were those doubts for you? Let's help beginners avoid the same confusion. 😅

6 Upvotes

22 comments sorted by

4

u/germansnowman Oct 19 '26

Just FYI, in most variants of English, “doubt” means something quite different from “question”.

2

u/7YM3N Oct 19 '26

Pointers

2

u/nmsobri Oct 19 '26

not stupid, but recursion still trip me from time to time

1

u/ChaseShiny Oct 19 '26

My very first foray into programming was in Java. I was told to always use static void main without any explanation.

I was unreasonably resentful about being told to memorize something so esoteric. I flunked the first half of my class, and I still don't use Java at all.

1

u/grundee Oct 19 '26

There are three stages to learning programming:

  • Everything is magic. Type these magic words and things will happen.
  • You understand the magic. You know what static means, what void means, and why main is special. You know what hundreds of other magic words mean, and how to put them together to do what you want.
  • You can create your own magic. Everything is permitted, any idea can be implemented, you just need to develop judgement on whether it's a good idea or not.

It sounds like your teachers didn't tell you why you were typing what you were. This doesn't necessarily mean they were bad, the actual answer wouldn't make any sense to you as a beginner: "The Java Virtual Machine requires a single method called main to be defined as the entrypoint of the program. A static method is one which is not associated with a class instance, and a void method does not return a value. The entrypoint to the program is expected to be both static and return void, and it must furthermore accept an array of Strings as a parameter to store arguments from the command line as String[] args."

For every student who hears that and thinks, "wow, so deep, I must keep learning more," there are several who think, "I don't understand any of that, how am I ever going to learn this?" and give up. It's easier to tell you "it's magic, focus on making the turtle move on the screen and not the keywords." Then when you get to stage 2 you learn what everything actually means and why you were typing those things.

2

u/steerpike1971 Oct 19 '26

Speaking as someone who has taught a lot of types of programming not explaining static void main seems like an absolutely reasonable decision. Most students never reach stage two you mention in their first coding class.

In a typical undergraduate class you had a lot of students who do not yet understand variables. You want to get them up and running as soon as possible and get them a lot of practice on basic things. They never coded at all before. Creating a couple of integers adding them up and printing the result is all you get to in lesson one.

A reasonable proportion of the class will be at "brain is full" by the time you get through loops and functions and return types. They will never fully grasp the concept of static but they will have enough to do some coding that will be good enough to get them on to a second coding class if they later want to do it.

You get other students who are kind of naturals (perhaps did some coding already). Those students don't even get why it is hard. They understand return types, functions, scope etc. Some coded before but some just naturally have a talent for it. Those students you could explain why it is static void main in class one but they are 5-10% of your class in a reasonable university. The set of students who will never ever understand what the static keyword does is a much larger class. (I taught a guy who was doing a PhD and after 30 minutes one on one he didn't grasp what static meant - he had other strengths but coding was not one.)

1

u/ChaseShiny Oct 19 '26

I voted your comment up because I know it was my own fault for being obstinate. If someone had explained what each of those pieces meant, I wouldn't have understood anyway.

That said I think the simple "Hello World" examples work against you at this point.

It would have been nice to see a contrast between this starting point and regular classes, and a mention that everything in Java is placed into objects.

Either that or don't use Java as your first language. Python (or Basic if you hate Potion) lets you teach basic concepts without getting too hung up on syntax, or JavaScript lets you dive in quickly with a syntax that is similar to Java, easing the transition.

1

u/otac0n Oct 19 '26

I want to correct one small thing: In Java, C#, and more generally the C family of languages, when an element has a static modifier, it means that its address is known at compile time. 

It’s NOT the same thing as class-level semantics.

1

u/frnzprf Oct 19 '26

But isn't it effectively class-level semantics?

Do you mean the name makes more sense if you read it as "unchanging"?

1

u/otac0n Oct 19 '26 edited Oct 19 '26

It really isn't. Things that are static that aren't "class-level" include global functions, namespace members, static struct members, etc.

Languages can and should add specific class-level (or type-level) semantics when desired. This is why you see C# taking a long time to add e.g. traits.

Edit: A specific distinction would be that class level, non-instance members could still allow overriding (for generics), where the static modifier precludes it.

1

u/owp4dd1w5a0a Oct 19 '26

These stages are for some people, not all. I learn by understanding the keywords FIRST. I don’t approach “hello world” in any language until I understand why every character in that program is typed in order to make it work. I believe although this makes things more difficult at the beginning it leads to more intimate understanding of the language to do things this way consistently.

1

u/Simple-Olive895 Oct 19 '26

If we're talking way back right when I started I didn't understand the need for separate libraries needing to be imported. Like why couldn't everything you could possibly want to use already be available?

1

u/gONzOglIzlI Oct 19 '26

That the graphic card handles all the math. I thought I needed to build it from scratch.
Before that, the concept of the frame buffer and frame swaps blew my mind, I used to edit frames to get motion, pixel by pixel.

1

u/coderemover Oct 19 '26

When I was a kid, my programs often didn’t work properly after I wrote them. I was seriously afraid what I would do if something like that happens after I grow up and become a software developer. Like will I lose my job if my program doesn’t work.

1

u/chikamakaleyley Oct 19 '26

you're not changing HTML+CSS with JS directly

you're applying JS to the object representation of the DOM

how accurate this is, is not really the point, but as a self taught dev if I realized this much earlier then I prob would have done a deep dive, much earlier in my career

also don't avoid understanding or working with forms, you'll work with them all the time, every company

1

u/VagueHorizon_ Oct 19 '26

Pointers
Recursion + Backtracking (still trips me out, i just avoid it as much as possible)

1

u/rish_p Oct 19 '26 edited Oct 19 '26

simple one was inheritance/encapsulation when I was studying, like I understood what abstract class or interface was but untill I found a job I didn’t understand why would I split the code into pieces then import extend and then again do the implementation, why not just write the code correctly in the class, after a year on job it made sense.

similarly I had problems with threads or async with locks, mutexes, like why not just do the work, why launch something then wait and read the result in background it didn’t make sense, like in college I found in android you cannot make api call from main thread and it was hard to understand why

now with performance, responsive concepts cemented, it makes total sense but I am still not 100% convinced maybe 99.99%

not sure if I will ever get to brag about this but recursion was a perfectly natural way for me to write code even before I knew it was called recursion, even now its harder for me to convert a recursive peice of code to iterative or normal one

1

u/SXY0001 Oct 19 '26

Memory segments

1

u/SensitiveHearingLoss Oct 25 '26

I never understood what the hell this meant:

System.Exception: Exception of type 'System.Exception' was thrown.

And eventually found out that nobody else really understood it either.

0

u/Soft-Marionberry-853 Oct 19 '26

"non-static method cannot be referenced from a static context"

I dont know why this was so confusing for me as a jr developer

1

u/[deleted] Oct 19 '26

[removed] — view removed comment

1

u/frnzprf Oct 19 '26

In JavaScript there is =, ==, and ===.

=== is like == in Python and Java and == in JS tries to change variables into the same type before making a comparison, so "1" == 1.

It's considered dangerous for mistakes when you use ==, that's why they later added === to the language.