What is the best way to learn programming?

  • Thread starter Thread starter jd12345
  • Start date Start date
  • Tags Tags
    Programming
AI Thread Summary
The discussion centers on the practice of programming by translating human problem-solving methods into computer instructions. A beginner programmer questions whether this approach is correct, noting the difficulty in some programming tasks. Participants affirm that programming involves creating algorithms, which are step-by-step solutions to problems, and that the challenge often lies in the complexity of logic and edge cases that humans might overlook. The conversation highlights the difference between human and computer problem-solving methods, using the example of finding the greatest common divisor (GCD). While humans might factor numbers, the more efficient Euclidean algorithm is preferred in programming due to its elegance and simplicity. The discussion suggests that while emulating human logic is a valid starting point, programmers should strive for more precise and efficient coding practices. Additionally, there is a call for sharing specific coding examples to better understand individual learning methods and challenges.
jd12345
Messages
251
Reaction score
2
I started programming like 1-2 months ago - In most of the questions I actually try to tell the computer what I would actually do to solve the problem. I am just telling the computer what humans would do to solve that problem.

Is that the right practice?
 
Technology news on Phys.org
jd12345 said:
I started programming like 1-2 months ago - In most of the questions I actually try to tell the computer what I would actually do to solve the problem. I am just telling the computer what humans would do to solve that problem.

Is that the right practice?
That's what programming is. You write the instructions that the computer performs. One of the steps in writing a program is to figure out an algorithm, which is the set of steps you would do in solving the problem. The next step is to write your code in using the programming language of your choice (or the one you are learning).
 
Then why is it tough( some questions ). I just need to tell the computer what I would do in that question but still that is tough, why?

Also some questions like finding gcd of two numbers- humans factorise the two numbers and multiply the common factors but for the computers we use euclid's algorithm. Why the different approaches?
 
jd12345 said:
I started programming like 1-2 months ago - In most of the questions I actually try to tell the computer what I would actually do to solve the problem. I am just telling the computer what humans would do to solve that problem.

Is that the right practice?


Yeah, that is pretty much the idea. Most computer programs are very routine logic, just done much faster than a human can do.

I would add that most humans do a rather sloppy job with logic, this reflected in the poor quality of the average computer program. So try to do better than that, if you can. The main problem is that humans tend not to consider unusual cases and get a program that crashes whenever you do anything out of the ordinary.
 
jd12345 said:
Also some questions like finding gcd of two numbers- humans factorise the two numbers and multiply the common factors but for the computers we use euclid's algorithm. Why the different approaches?

Nobody ever prohibited humans from using Euclid algorithm nor computers from factorizing and multiplying common factors.

Method with common factors is rather difficult to code - way more operations to do (preparing list of prime factors, managing two sets of factors, finding the intersection). Euclid algorithm is much more elegant. No idea why Euclid algorithm is not taught in schools as a method; perhaps for pedagogical reasons.
 
jd12345 said:
... I am just telling the computer what humans would do to solve that problem.
That has some pretty wide-ranging possibilities

Is that the right practice?
Easier to answer if you would provide a sample of your code.

What is your method of learning? (School, on-line courses, "how to" books, ...?)
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I had a Microsoft Technical interview this past Friday, the question I was asked was this : How do you find the middle value for a dataset that is too big to fit in RAM? I was not able to figure this out during the interview, but I have been look in this all weekend and I read something online that said it can be done at O(N) using something called the counting sort histogram algorithm ( I did not learn that in my advanced data structures and algorithms class). I have watched some youtube...
Back
Top