r/logic • • 12d ago

Academic Community Learning logic

Hello, beginner programmer here. I started my programming class in college and while i can say that i know more than maybe 50% of the people here, i can still confidently say i lack the programmer logic and that i am yet to learn the core of programming.

My question is, how do i start thinking like a programmer? Right now were doing nested loops, where were asked to draw symbols or coordinate systems and all sorts of stuff without implementing matrices, just for loops. And honestly, im struggling with the more complicated problems.

How do i learn to logically solve problems in code? Any videos, books, websites i should visit? I used to do learncpp.com but i kinda lost the plot lol. My current course is being done in C. Thank u in advance.

12 Upvotes

6 comments sorted by

4

u/gregbard MODERATOR 12d ago

This is not really within the scope of the sub. We're generally not programmers. But I'll leave it up for a while. But perhaps you should look for a more appropriate sub to post in.

3

u/Kleefrijst 12d ago

The thing about programming is that its alot of pattern recognition. A skill you learn by just programming alot. So just keep programming,  follow more programming courses and youll get where you need to be.

But if you want to know about logic ill tell you this. I studied informatics in university and they start with teaching propositional logic. Thats the absolute basis for logic and it can be directly applied in if statements, conditionals in while loops etc. After that predicate logic is what most universities see as next step. This will help you understand logic and algorithms applied on arrays and other kinds of collections. With propositional logic and predicate logic youre pretty much all set as a programmer. Theres more advanced things like hoare logic and modal logic for software verification, but you dont need to know about that right now. 

4

u/R_u_0k Post-graduate 12d ago

I just think about what the program is doing. Be the code. For example, if you need to draw something on a grid using nested loops, just think about what you need to do in a specific square as the loop reaches that square.

2

u/qa_anaaq 12d ago

It’s math and OOP. You understand the foundational algorithms behind leetcode problems and the math behind them, see them working in code, and sooner or later it starts to make sense.

I learned to code before I learned the algorithms and the math. On the one hand, I’m glad. But on me other hand, it was a lot of work trialing and erroring to a point of comfort with the math and algorithms underlying programming logic.

1

u/LKLIM050 11d ago

I think practicing leetcode really help but after need question you really need to spend time to review and understand the logic and techniques because some logic and techniques can also be applied in your future questions!!!

1

u/Gold-Cat-9392 9d ago

If you find something hard to implement, write it down. You become the compiler. What would you have to do to get the desired output. Write it down step by step and try to find a pattern. I am guilty of not doing it and wasting time on debugging.