What am I not understanding about programming?

Started by
36 comments, last by Finalspace 6 years, 7 months ago

I've typed this up several times, and I think this is as good as it's going to get.

For a long time, I've understood programming concepts, but I am unable to write programs that I want. My favorite language is C++, and think I have a pretty good grasp on it. Variables, data types, classes, etc... I know them well, and could explain what they do and how they work. My problem is, when it comes time to actually write functioning code, I just can't fgure out what to do. I don't know if this is a lack of code architecture knowledge, or just sucking at logic skills.

To make things worse, I look at examples of other people's work and become even more confused as to why they did it this way, used that data type or even become genuinely frustrated that I can't read their code(I know it's not always immediately obvious what some code is supposed to be doing, but it gets to me anyways). I stare at other's accomplished works and wonder what it is I'm missing to the point that I throw my hands up and walk away.

I would like to preface the end of this thread by saying that I've completed hundreds of programming challenges, ranging from beginner to advanced. Why I can complete them in a relatively quick time, but struggle for days to write code that'll keep a window open in some graphics library, I don't know. It's been a problem for a long time, and I'm tired of getting stuck in this cycle of Inspiration->Frustration->Quit.

Edit: To sum this up as a TL;DR: Why is it I can write several classes, flesh them out with their working code, but not put all of those things in working order to produce the main loop?

Advertisement

Sounds like lack of practice to me. You say you have solved many programming challenges, so you obviously know how to write certain types of programs. I wouldn't give up, and instead I would try to get specific help with specific problems.

 

I have helped people learn how to write programs before. The method I recommend is starting with a fairly trivial program that you can compile and test. You then make some changes to get the program a bit closer to doing what you really want it to do. Compile. Test. Repeat.

It might take some practice before you even know how to make progress in this manner, so a bit of personal guidance could be useful. I am much too busy these days to promise you any of my time, but perhaps these forums can play the role of the mentor.

 

Programming at is basics is a process of solving a problem, getting to know the problem, break it down into peaces and write a solution for those peaces to chain into each other to solve the problem. Some problems are small, for example the calculating a distance from A to B, so these self-contained actions performed to solve the task are called algorithm.

What might be hard at the beginning is to get the whole problem and declare steps to solve before getting to code. Solutions also could change during development process from cause of new upcomming knowledge, conditions changing (like there is a new fancy library upcomming) or features occuring/disappearing.

What in the end makes a good programmer in my opinion is not to know all your design patterns from memory but be able to see the essence of a task (self) guided to you and evolve a solution to solve it. (Someone may disagree but it is a personal sight of view). Most important is to have fun at what you are doing and talk to people that know it better to become better from understanding there solutions (even if you do not agree with them ;) ) but this will be the only way to be able to understand the problem itself and write your own solution.

And dont let people tell you that there is only one (there) way to solve a problem. Different people, different implementations and the only (right) way is the way you are happy with the solution.

I have had talked to people coding for a very long time and (especially in C++ where the "right" way to code changes with every revision) even they say that looking at old code makes them partially ashamed about what they wrote long time ago where some new technics become popular (like template meta programming)

I definitely agree that I should put more time into it. I also know there are several ways to solve one problem. I think where I'm at right now, I feel like if I can code small parts, I should be capable of getting it all to work at once.

Take for example, my very first post on this website. The gist of it was what I'm explaining above. I wanted to build a super basic version of PONG. I wrote classes to handle the window and Player Paddle and placed it all in a game loop function that I called in main(). Everything at that point ran fine, but it wasn't what it should've been. Nothing else was completed. In this main loop, I was basically calling objects in full. I know now that I shouldn't have done it like that, but at that point, I didn't know how I was supposed to build this game loop that would keep the game running. I don't have the code on hand to show, but I remember well enough to know it was garbage.

Just thinking about that project, I visualize what I want to accomplish, but then it explodes in a million different directions like a scatterbrained bomb. It's like throwing all of your limbs in every direction just to move in some way.

Are there any references, books or youtube series you guys could recommend so that I can work through this?

47 minutes ago, LuridRequiem said:

Are there any references, books or youtube series you guys could recommend so that I can work through this?

If you're referring to the pong attempt, then there is this https://www.pluralsight.com/courses/unreal-engine-4-blueprint-cplusplus-integration where you get to create a working Pong game in the unreal engine by the end of it.

Also that site offers a free trial, so you should be able to watch it for free, unless you've used up your free trial already :P

1 minute ago, MarcusAseth said:

If you're referring to the pong attempt, then there is this https://www.pluralsight.com/courses/unreal-engine-4-blueprint-cplusplus-integration

Also that site offers a free trial, so you should be able to watch it for free, unless you've used up your free trial already

I meant a resource for code structure/architecture. Is there even a difference between them?

2 minutes ago, LuridRequiem said:

I meant a resource for code structure/architecture. Is there even a difference between them?

Well I mean, watching real project working doesn't achieve that as well? :P

I mean you see the structure of his paddle, who is handling the score, who is checking for collision and so on.

I don't think you should keep this all in the theoretical realm by just gathering up the perfect informations about how it should be done properly, because that is a lot of information all at once. I think I was in the same position until recently and just now I'm starting to get out of it, and the way I found to be working is "just do it, do it wrong, doesn't matter" maybe show it on the forum and someone will be kind enough to point out what you can do better, and then you can worry about how to do properly a certain aspect of your game/project later on, over time :)

It just seems like you've never really studied programming. It's easy to think that completing challenges means that you understand how to get things done, but that doesn't mean you know the best ways and the worst ways, or the differences between them.

It's not meant to be something you can just work out by being intelligent and thinking about it. It's something we spend years trying to teach people in colleges and universities. So don't be surprised if it's not obvious. There are various different concepts that we follow to try and write 'good' code, and maybe picking up a book or doing a course on them will help.

Alternatively, you can pick up more as you go along, by perhaps posting some code here and asking for specific critique.

Try reading some design books such as the classic "Design Patterns: Elements of Reusable Object-Oriented Software".

It is possible that you have a lack of practice, in which case: try to make some small programs (until they are finished: don't stop along the way). It is very important that you make enough progress, otherwise you will get frustrated and lose interest. So don't start with a multi-year project, but keep it (simple and) small first.

It is also possible that the code you are referring to is just bad and incomprehensible code. There is a difference between writing code that works and writing code that works, is maintainable and extensible.

🧙

These replies are much appreciated. I'll definitely be giving the resources mentioned and posted a good looking at. I'm going to look for beginner OOP projects(not challenges) to see if I can sharpen my skills.

This topic is closed to new replies.

Advertisement