Advice for Difficulty with Programming

Hey, guys. I really need some advice. I apologize in advance for the length, you can probably just skip to the near bottom of this post.

 

I am a junior in college, my major is computer science. My problem is that I don't consider myself very good at programming (with Java). I’m trying to figure out why I’m not good at it and how to become better.

 

Last semester, I took Software Design 3 – Algorithms in Java. I did pretty poorly, just barely managed to get a ‘D’ in the class. I thought for sure I would get an ‘F,’ but I think my professor helped me out since he knew that I put a lot of effort into the class, I had an extremely difficult time with the programming assignments.

 

I feel like I know absolutely nothing about programming, is this a red-flag? How could I be in Design 3 and still not really know a whole lot? There are a few factors that come to mind for my difficulties in the class, let me know if you think these are reasonable.

 

I find algorithms and math-related stuff to be pretty boring which was not good since that is pretty much all we did all semester. I also wasn’t a huge fan of the professor, he gave just a few small code examples and posted very few lecture presentations; the majority of learning in the class was just listening to him talk at us. Also I was taking Calculus 2, which was a very difficult class for me, math has never come easy to me. Needless to say, Calc 2 consumed a lot of my time.

 

I wonder if maybe the biggest factor of my programming difficulties was my approach? From talking to the professor and some of my peers who helped me out along the way, they seemed to indicate (I felt like this too) that I just jumped into programming without really thinking it through (by writing pseudo-code/steps for instructions out on a piece of paper). I would tend to get “done” with a program, and then get really stuck trying to debug and figure out what was wrong with my program.

 

Is it really as simple as just making sure to think through the programming steps more thoroughly/slowly and test it out along the way? This was also something that I found difficult; testing my program along the way.

 

Sorry for the novel! Any advice, suggestions, comments, referrals to other threads/resources whatsoever will be extremely appreciated!

 

Thanks a lot!!

TL:DR?

What?

Too Long; didn't read i.e. he wants a shorter version

If you have the sentiment of "I should learn through the school to make sure that I learn right," you should throw that out, because it's often an irrelevant argument, not to mention it doesn't seem to be working for you. Don't be afraid to look to the Internet for solutions for small problems, though obviously don't copy/paste code. Most importantly, make sure you know why it works, and how you can use it in other cases.

In this case, practice makes perfect. When I get a coding assignment, I usually look at the program specifications and build the program backwards in my head quickly (data structures, functions, etc. - specs will always change on the fly, so I don't see the need to write anything down) and get into it as quickly as I can.

I usually work on it as much as I can manage until I get results I want, and then do some debugging at the computer and away from the computer, thinking "outside the box," as they say. I usually end up realizing a couple days later, "Oh, I didn't consider scenario 'x...'" That's why I try to do my coding assignments early, so if that happens, I can fix it before the deadline.

(Edit: To be honest, I don't really test it until I think I've finished writing it. Yes, you shouldn't do that. It's horrible practice, and I have no idea why enjoy doing it. Separate the program into logical modules that you can test once you've finished each one.)

The most helpful coding projects I've done have been little side projects that I decided to try to make in my free time. Probably the most influential one was the little side-scroller I tried to make in HTML5 without an engine, with a menu and everything. I didn't get far enough to work on actual gameplay, but I considered some debugging stuff, and learned a lot about keyboard input and interactive elements in the process. I remember little to nothing about the actual code that I wrote, but I remember a lot of stuff about objects, loops, and input that I learned from that project in particular.

While Java is fine for an OOP language, I would suggest trying to expand and learn a scripting language like JavaScript or PHP (if you want to go the web route) or Bash if you want to try the Linux route. C++ is a popular programming language, and there you can learn about pointers (though you should probably learn programming a little better before trying to tackle it) and have a little more flexibility in trying to create something from the bottom up, though there are probably some good libraries for that in Java if you want to build from an API.

1 Like

What I can recommend you is to become proficient in programming language. It doesn't really matter which one you choose, as long as it's not an esoteric language. If you are learning Java in the school anyways then that would be a good choice.

I've given a couple of private lessons to my colleagues and what I've encountered some times is a lack of basic knowledge of what's going on behind the scenes. Make sure that this is not the case with you and if it is, do something about it.

"Wasting" a lot of time for debugging when your application isn't that huge/complex indicates that you should review the whole process of data processing within your application and make sure that you are able to create the "Stack-trace" in your mind.

When the fun is missing then that's an indication of you having lost track, which can happen to everyone. Sometimes it can help to get back to the basics, and work yourself back into the state you should be in already. This method helped some of my colleagues, but it takes time.

Jeol,

 Thank you very much for your thoughtful reply! Similarly to how you debug, I tend to start debugging when I have "finished" my program. Yes, this is not good, and I plan to change this practice this semester. Testing is another thing that I struggle with, since I'm not really sure how to break things apart and test them thoroughly.

Overall, my problem seems to be that I get lost in the details of what I am supposed to be doing in the program.

Yeah, Bash sounds fun. I forgot to mention that I took a MIPS Assembly class and I was much better at that. I suppose the programs in that class were a lot easier though...

memoryleak,

Thanks for your reply!

I took a MIPS Assembly class last semester, and I did very well on the programming assignments in that language, they were pretty easy programs to do though I suppose.

Thanks again for your suggestions!

sir,

Codecademy has a javascript course. I know it might be tedious but, because you have to understand it fully to proceed, it will help you. 

That's all for now from me.

Thx

Testing is really a case of diminishing returns. The best way is to write a driver or input file that can pass information directly to the program so that you don't have to re-input every time (with Bash it's pretty easy: 'cat input.txt | ./foo' where ./foo is the executable of the code you have - I'm not sure about Java; that's more likely a case of changing the actual code in the program to take a file to the scanner instead of System.in, especially if you're working with an IDE). Then you can focus on the information you're getting in return, instead of the setting up. As for what values to test with, it's pretty subjective - test the ends of ranges of values, and test different data types to see how it handles it. Obviously, when you're working with interfaces, it's a little more complicated than that, since there isn't really direct data that tells you if something is working or not, so it's another case of diminishing returns.

That's all from personal experience/know-how, anyways. This page looks like it could offer some insight on that front.

Have you tried codingbat.com I find that to be useful. Ha I'm currently in that class right now. 

I think it's because you're not coding things you're interested in, in school we have to code lame stuff and I failed that class but when you try writing something you want or need? you'll do great dude, even if you don't know anything right now it can all be learned don't worry

Go through a good programming book and do some small project you're interested in.  

After my first, Freshman Java course, which I got a C in, I realized I needed to work.  So, that summer I spent an hour or two working my way through the textbook until I got through it all, doing every exercise, and coding up a text-based RPG and UI.  Since then, I've never had any problems, because the logic of programming became second nature.  It was tedious, but worth it.

The sit-down-and-plan phase would probably help.  And then incremental programming and testing.  If you're getting lost in details, that's usually a good way to go.  Very few people I've met actually stop and test as frequently as professors suggest, but just implementing the chunks of key functionality and then making sure they work before building on top of them is a good idea.

 

Was that pun intentional? :D

That's the by-the-book way, but with small applications it can be more interesting to create skeleton classes and methods and think it trough. That way you can do some sort of coding while planning.

Anyway, those are some things I do/did and helped me and others. Your mileage may vary.