What is the most efficient practice to learn computer science and programming?

Hello guys.I have applied various techniques for learning programming and computer science from books.
I am wondering about what is the best practice to learn code.

Technique 1:
1-)Learn theory from book [%5 of the time]
2-) copy paste codes from books(pdf) and debug and change it to learn how code works [%5 of the time]
3-)Apply this theory and technique on my real world programs [%90 of the time]

Technique 2:
1-)Learn theory from book [%5 of the time]
2-)Type and run code to learn how code works [%47.5 of the time]
3-)Apply this theory and technique on my real world programs [%47.5 of the time]

For example, I want to learn Java with the second method:
1-)I learned theory from a book [%5 of the time]
2-)I type and run code to learn how the code works [%47.5 of the time]
3-)Apply this theory and technique to my real world programs [%47.5 of the time]

Never copy paste. That is skipping your brain completely.

“Computer science” and “programming” aren’t the same subject, and you should decide which one you want to learn first. And you’re certainly not going to learn computer science by programming either, because that’s not how it works—learning computer science is a lot like learning math, and you can learn it by doing problems with a pen & paper. No actual computer is necessary in order to learn computer science (it may sound paradoxical but it’s true).

There are many resources on the Internet devoted to learning how to program, so I won’t bother going into that.

If you want to learn computer science, you then have to decide which sub-topic you want to learn first. Data structures and algorithms? I wrote an old post on that here which might help: What is your strategy for learning data structures and algorithms?

Before you jump into data structures and algorithms, you should have a solid background in discrete math if you don’t already. This book seems like it could be good based on the customer reviews: https://www.amazon.com/Discrete-Mathematics-Introduction-Oscar-Levin/dp/1534970746/

Once you have the necessary math background, it will be a lot easier to learn data structures and algorithms, and you can refer to that post I linked above for resources that I recommend.

1 Like

Thanks astv99.I will learn branches of computer science for learning the deep concept of the programming.I don’t want to learn just syntax.
For example:
Operating Systems for Understanding of Java Threads
Data Structures and Algorithms for Productivity
Algorithm Design for Productivity
Design Patterns
Java Tools (Spring, Hibernate) for Java Development