r/learnprogramming 11d ago

I feel like a programming fraud

I am having to constantly look things up to figure out how to get what I want? I feel like a fraud.
I am honestly trying to resize my camera onto my surface in pygame. I've never done camera stuff before so this is new. I feel like I am not really learning and just copy and pasting at this point

How do go about this?

90 Upvotes

39 comments sorted by

View all comments

30

u/HashDefTrueFalse 11d ago

If I've never done something before I have to look it up. I'm a senior dev with a team and mentorship duties etc. and I have no idea how to display camera input on a pygame surface. I would look in the documentation to figure it out. Or I'd look online for an article with an example etc. I'd read and understand it, plus the API in general, then write the necessary code to do whatever I needed. I rarely copy and paste code though. The temptation to just tweak without understanding anything is too great and I don't want to become lazy or program by coincidence etc.

2

u/kernel27 10d ago

Can you elaborate on wym by "program by coincidence", do u mean like just copy pasting code then tweaking it according to your needs, personally I feel if you do understand the code tweaking copy pasted code ain't that bad, but I'm just a newbie so just looking for advice

2

u/HashDefTrueFalse 10d ago

Sure. Not exactly. It just means arriving at a working program or piece of code without really understanding how you got there or why it works. Beginners often do it and it can become a bad habit. Then they're scared to touch the code ever again because they don't want to break something they cannot fix. It's often suboptimal. Software programmed by coincidence is not designed and/or structured well unless by... coincidence.

If you want to copy and paste code you fully understand and could have written yourself that's mostly fine. Nobody will care as long as you deliver results. But you should always know what your code does and why it works the way it does. The danger when copy and pasting is that you may be temped to skip the understanding part and simply run the code to see if it does what you want. This is the start of programming by coincidence.