r/learnjava • • May 13 '19

Is it normal to feel really stupid while learning Java because of constantly not realising what's the best way?

I guess yes but I really need to hear your stories of "everybody say programing is for geniuses so that's why they give up, but I had confidence in me and I ended up being a pro no matter of my genes because I carried on"

85 Upvotes

29 comments sorted by

59

u/-manabreak May 13 '19

For the first few months, I struggled to even remember the syntax of for-loops and really couldn't wrap my head around the zero-based indexes. I stumbled over the most basic stuff and felt like I could never do any better.

But the thing is, I thoroughly enjoyed it all. I was in constant awe when I got something to work (even if it was botched by the next line of code). For my first year of coding courses, I basically did all the exercises and then some coding of my own, trying out stuff and playing with the code. I knew it was my thing, right from the get-go.

The code I wrote was atrocious for the first two years, and then I'd say I was rather mediocre for about five years after that and only started to learn proper ways of doing things about three years ago. I don't think I'm a genius and I still have a lot to learn all the time, but that's part of the fun for me.

My advice is to just be stupid and feel stupid and play around with code.

10

u/[deleted] May 13 '19

So, sucess is the ability to be and feel stupid? xD Do you earn money from this?

6

u/Daedalus9000 May 13 '19

I think the point is that the process of learning any language (and programming in general) involves a lot mistakes and misunderstandings and to be successful you'll have to enjoy the process enough to endure those failures for a while. This was my experience as well.

2

u/[deleted] May 13 '19

Yeah, I enjoy it but sometimes it burns my brain a little.

1

u/GuyWithLag May 13 '19

I remember when I first started programming, I always felt as if I was bashing my head against a doorframe...

Keep at it. Realize that the code does not have inherent meaning, but it does have inherent rules, and that the 2 are different. Also, make a habit of noticing when you are confused; that means that reality and your model of it have diverged, and one or the other will be adjusted.

1

u/-manabreak May 14 '19

Pretty much, yes. In my experience, it's all about iteration. Every time you face the same problem again, you should feel less stupid about it. Once you reach a point where you don't feel stupid anymore, you start to see the forest from the trees and it's easier to think about other ways to solve the same problem.

A simple and common example of this is this kind of anti-pattern:

Foo someObject = getFoo();
if (someObject instanceof FooA) {
    FooA foo = (FooA) someObject;
    // do stuff with foo
} else if (someObject instanceof FooB) {
    FooB foo = (FooB) someObject;
    // do stuff with foo
} else if ... // Continue ad nauseaum

I've seen this "pattern" numerous times, and I've written it numerous times. Hell, even the app I'm working with that has about a million active users has this kind of code! However, I think it's almost essential for everyone to write code like this. You're doing it "the army way", and once you have suffered enough, you'll learn to think differently.

That is, at some point you're bound to ask yourself "is there a better way?" and boom, you'll eventually stumble upon an abstract method written to the base class, which you can override in the subclasses.

Of course, you can and will learn these things without the suffering, but you'll get the most bang for the buck when you've faced the problems that arise when you do things the wrong way.

19

u/DixieWreckt May 13 '19

This guy gets it ๐Ÿ’ฏ

1

u/cjcjcjcjcjcjcjcjcjcj May 14 '19

Iโ€™ve been writing code for 8 years now and I still get the feeling of being lost or not knowing โ€œthe bestโ€ way to handle problems. I think itโ€™s just a constant feeling many developers have because there is and always will be an endless amount of things to learn in this constantly changing environment

1

u/Aturn13 May 14 '19

That was one of the few thoughts that I had before I began to study programming. I always thought that at some point and time you would just "know" everything there is to coding, and that you would be able to just walk to a computer and type out thousands of lines of code. Now that I started coding I know that isn't the case. Cheers!

18

u/[deleted] May 13 '19

You don't need to be a genius, you just need to plan, create, and implement an algorithm. The human mind is not great at dealing with huge complex problems so we create an algorithm and break one big complex problem down into small simple problems and solve each one and piece them back together. So we're only solving a whole bunch of simple problems. You don't need to be a genius for that. As for doing thing the best, most efficient way, well, I guess that comes with experience.

3

u/[deleted] May 13 '19

Yeah, the algorithm thing is what I'm starting to see it's the key to understand it... I'm reading "Data Structures and Algorithms" to see if I can learn how to think in that way...

1

u/gokulegolas420 May 13 '19

Hey I'm literally going through the same book and as approachable as it is, I often feel like I have to go over the material multiple times before I even start to get it.

I don't have any advice other than keep plugging away, eventually it'll stick. With regards to Java I found the excercises in in codegym.io helpful. They have tons if excercises which really helps cement the syntax.

1

u/[deleted] May 13 '19

I guess you can't get it at first time part by part because it's very abstract and you cannot easily link it to natural phenomena so you have to have "faith" and patience...

It's like... "The comprehension of a Java's concept often requires some level of comprehension of other Java's concepts". I don't know how to say it but it seems it's a "holistic" and intuitive knowledge that is builded as a whole, not as a sequence of fully understood pieces. Maybe everything is that way (cooking for example is more than following well learned instruction) but I think programming is especially that way because of what I previously said: computing is very abstract, it's not like real life objects ;)

12

u/ryuzaki49 May 13 '19 edited May 14 '19

I didn't understand the very basics for a very long time. How the main method worked and instance variables were really confusing to me. Objects? The fuck knows what are those. Methods? Why is my static method call not compiling? Who knows.

People mocked me as useless. But I persisted, and now I work as a Software Engineer and Java is my main language. I have a hunger to do what I do better. To learn more about Java and other languages and environments.

Programming is for geniuses but also for people that don't give up.

3

u/[deleted] May 13 '19

So programming is for geniuses but also for people that don't give up.

That's a genius phrase.

2

u/Aturn13 May 14 '19

Honestly, methods, objects, and classes were one of the main things in Java that I didn't understand. Although I know a little bit more about each of them, I still need a lot of practice.

6

u/[deleted] May 13 '19 edited May 13 '19

It is normal to feel a little discouraged when you can't understand concepts in the beginning, but the learning builds upon simple steps. The steps have to be small initially, but the experience of learning Java gets fascinating after a little while. I cannot emphasize PRACTICE enough. Imagine a problem, and solve it with Java as much as possible.

Also, make notes as you learn. Cram.com is a great (free) tool for making notes you can access from anywhere as long you have an Internet connection.

When it comes to programming, it is imperative to think logically and critically. When you run into programming obstacles, remember to keep calm and approach how to solve the issue rationally. Like the others are saying, resources like Stack Overflow, Geeks for Geeks etc. are abound nowadays and there are excellent inputs from folks on these sites who know what they're doing.

Lastly, feeling "stupid" can be a powerful friend in the end. The times I felt "stupid", I felt discouraged, but I also had a stronger resolve to keep pushing and I can honestly say when you break through the issues, the feeling of internal reward is something else...

1

u/[deleted] May 13 '19

True.

2

u/[deleted] May 13 '19

Even the best don't always know how to do things and are asking others, searching stackoverflow, etc.

1

u/[deleted] May 13 '19

I guess if an elegant solution is already created by somebody, you just have to copy it. There will be time to improve or expend energy on unsolved problems...

1

u/[deleted] May 13 '19

Basically ya. No need to reinvent the wheel.

5

u/eyeIl May 13 '19

All of the replies on here are SUPER encouraging. Can't wait to get home from work and practice

2

u/Zarkahs May 14 '19

nobody knows everything, no matter how much they claim to. you should try to have fun coding, because it's actually really fun solving problems and finding better ways to structure/refactor your code so it looks really pretty at the end. you're just learning, so play around, build programs to do random things, and post here and get some tips on how to make them nicer, it's a journey and you should enjoy yourself along the way. you'll learn a lot more like that than you would by trying to achieve some arbitrary point that you need to be at before you can call yourself a developer, you are one right now, albeit an inexperienced one ;)

1

u/DearLawyer May 13 '19

You can be doing this for decades and still feel stupid. Partly because as you get better when you do something stupid you notice whereas a n00b wouldn't see it as such =P

1

u/dextercoffee May 14 '19

Forget a break loop in a switch statement. No error ๐Ÿ˜’ on your code .

1

u/Loumier May 14 '19

Whats the kind of developers most hired by NASA? I would imagine embeded systems developers.

1

u/Droidheat May 14 '19

Haha, I am programming in Java for almost three years now and only realized the complete difference between equals() and == three days ago. It's normal to feel stupid while learning this.

1

u/Aturn13 May 14 '19

I agree with manabreak. I am still a newbie (be doing java for like 2 months now). All of my programs are still under 500 lines and are super basic, despite that I love coding. I haven't decided whether or not to get into Software Engineering or Cybersecurity( as an Ethical Hacking). It is 100% ok to be stupid, so we can be stupid together.๐Ÿ˜€๐Ÿ˜€

0

u/almozayaf May 14 '19

Programing in nutshell