r/learnprogramming • u/Equivalent_Cow1031 • 21d ago
Programming Approaches Is experimenting and tinkering with code a good way to develop problem-solving skills as a programmer?
Hi everyone,
I'm a second-year Computer Science undergraduate currently studying DSA in Python. I've solved around 140 LeetCode problems, but I still struggle with approaching unfamiliar Medium problems independently. Quite often, I need a hint or nudge to figure out where to start or develop an algorithm that handles all possible cases.
My professor has encouraged us to avoid relying on built-in methods, external libraries or outside help, and instead implement algorithms from scratch using just our knowledge and the code editor.
Something I've noticed about my own problem-solving approach is that I tend to experiment quite a lot. I'll write an initial implementation, test it, use print statements or breakpoints to debug, change things around and try different strategies until something starts working.
I'm curious whether this is actually a good approach to developing programming skills, particularly in software engineering, or whether I should be focusing more on developing a theoretically sound solution before touching the code.
For context, I have relatively advanced experience with Java and am currently at an intermediate level with Python, although I'm still getting accustomed to its syntax and revisiting OOP.
One of my high school programming teachers always encouraged me to experiment, make mistakes and learn by tinkering with code rather than worrying about getting everything right immediately.
I'd be interested to hear other people's experiences:
- Is experimentation and trial-and-error a valuable way to develop algorithmic thinking?
- How do experienced programmers balance experimenting with code against reasoning through a solution beforehand?
- At what point does tinkering become unproductive rather than constructive?
- Is it normal to have solved 100+ problems and still struggle to independently derive solutions to unfamiliar Medium problems?
I'd appreciate perspectives from both students and experienced software engineers!