I'm completely new to programming, and I struggle to stay focused during lectures and theory-heavy lessons. I've tried introductory courses in several languages, including CS50, but I find verbal explanations so boring that I lose motivation. On the other hand, I enjoy looking at working code—especially code generated for small games or simulations—and asking questions about what each line does. I recently used hints to understand the Two Sum problem and explored concepts like random seeds, the chrono header, and the Mersenne Twister. Can I become good at programming by learning mainly through examples and experimenting with code, or do I need to work through traditional lectures and theory first?
4 Answers
Learning from working code can absolutely be a useful starting point, especially if examples keep you engaged. The important part is moving beyond reading code that AI or someone else wrote. Change it, break it, add features, remove parts, and then try writing your own version from scratch. That’s when passive familiarity starts turning into actual programming ability.
Reading code and getting explanations can create the feeling that you understand something, but programming requires you to produce code yourself. Try solving small problems without looking at a complete solution, then use hints when you’re stuck rather than asking for an entire program. You’ll probably still encounter boring material, but practicing actively is unavoidable.
A good approach is to combine both styles: build small projects that interest you, inspect how they work, and study the specific concepts you encounter. For every example, close the reference and recreate as much as you can from memory. If AI is involved, use it as a tutor that gives explanations or small hints—not as the person doing the assignment. Also be prepared to spend time debugging your own mistakes, since that’s one of the most valuable parts of learning.
You don’t have to learn in a traditional lecture-first way. Many people learn by examining examples and experimenting. Still, make sure you gradually cover fundamentals such as variables, control flow, functions, data structures, algorithms, object-oriented concepts, and memory management. You don’t need to master all the theory before coding, but understanding those foundations will matter later.

That makes sense. I’ll try to use hints instead of having complete programs generated, and I’ll spend more time writing the solutions myself.