Wednesday, April 30, 2014

How to Solve Programming Problems if you're learning Programming

Things can and will go wrong when you first start dabbling in programming. As with all new skills, you are going to get frustrated. Here are a few tips that may help you work through the frustration and solve many of your own problems.

 

Language Learning

Do not forget you are effectively learning a new language, or even languages. You will not be fluent in twenty minutes. But you can expect to start building your skills to the point where you can complete simple tasks, progressing into more difficult situations. When you are presented with new code, it's important that you take the time to really understand it. If you whip through a tutorial or cut and paste code snippets you find online, you may end up with a program that runs, but you will not understand it, nor will you be able to generalize the skills and write your own programs. Once you've got something that works, try making a backup copy and then changing things in your code one at a time. If you can predict the effect that your changes will have, you have a good understanding of what is going on. When you are surprised by the effect of a change, you have an opportunity to learn something new. When you've got something that doesn't work, make a backup copy and then try eliminating things that you don't understand. What is the simplest version that you can get to work? Once you have that version, you can try adding in new code, one thing at a time.

 

Search Engines

If you run into difficulties when writing computer code the great news is that the answer to almost any problem can be found online. Computer programmers constantly seek and give help on forums and mailing lists, and the questions and subsequent answers are readily available. This means the Internet is usually your best resource for finding help. If you run into a problem, the first thing you should do is type your problem into a search engine. More often than not someone has already asked your exact question, and other people have provided a range of answers. You might even find entire websites dedicated to solving your particular problem. When you are just starting out, it is very unlikely that you will come across a problem that no one has encountered before. Likewise, if you encounter an error message that you don't understand, cut and paste that error message into a search engine and surround it with quotation marks. Typically you will find dozens of explanations for why this error appeared and how to fix it. The more specific that you can be about your problem, the better the results you will find. Don't be discouraged if you don’t find the answer on your first search. Rephrase the search terms and try again.

 

Forums

If you’ve Googled it, Yahoo’d it, and tried various combinations of teas, coffees and energy drinks to no avail, you're going to need to ask for help. There are many Internet forums and mailing lists to which you can turn. At the time of writing, my favourite forum for general programming questions is Stack Overflow. There is also Tutor, a mailing list where people who are learning Python can ask questions, and people who are interested in teaching Python can answer them. At any given time there are swarms of friendly, knowledgeable people just waiting to answer your question. If you post your problem in a courteous manner, with a little bit of luck you will have a solution within a couple of hours. Keep in mind that it is bad form to post a question in more than one place in quick succession. It may not be the instant gratification we’ve come to expect, but don't forget, these people are volunteering to help you, and most probably if you're desperate enough to ask for help, you could use a few hours away from the keyboard anyway. Go for a walk, take a nap, or do something else to clear your mind and some new ideas will come to you.

 

Asking Good Questions

Clarity and specificity are your friends when it comes to asking for help on a forum. The FAQ page on Stack Overflow's website is great reading for anyone looking to ask a question about programming online. Even if you do not use the Stack Overflow forums, the messages here are essential. Remember, the people who read forums and offer their expertise are busy; make it easy for them by carefully thinking out your problem before you ask. Likewise, make sure you are asking a specific question to a narrowly defined problem. For example, don’t post something like: "Why won't my code work?" Instead, try: "Why am I getting a syntax error when I try to Push a value into an Object?" Always post the relevant section of your code (and only the relevant section of your code) along with your question. If possible, remove any unnecessary bits that are not immediately relevant to the question to make it easier for experts to help you solve your problem. If the answer you get does not do the trick and you are still stuck, be polite and try rephrasing the question. Remember, don’t bite the hand that feeds you; these are volunteers and they’re trying to help you!

 

 Debugging

When fixing problem code, systematically change one thing at a time and retry your program after each change. Often if you make three or four changes before retrying the program, you will solve one issue, but cause another one. This is frustrating and confusing. By changing one thing at a time and making sure it works before moving on, you will prevent a lot of confusion. It also helps to make notes of the things that you have tried, and of the solution when you find one. The more time that you spend programming and debugging, the more familiar various kinds of errors will become.

---
This post was originally published as part of the Programming Historian, and was co-authored by William J. Turkel. It has been reposted here without permission because all work on the Programming Historian is licensed under a CC-BY license. Photo credit: Peter Alfred Hess

31 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete

  2. In my opinion, great content is above all. So focusing on creating good quality of content is the solution.

    regards,

    Melbourne web developer

    ReplyDelete
  3. Often make beginners feel that JavaScript and Java are related. Java is an object-oriented, concurrent, and class-based, general purpose programming language, whereas JavaScript is an interpreted programming language. java programming homework help

    ReplyDelete
  4. Good working i like it Thank you so much for helping me out.Acuity software Provide the services of web development. software development.App development graphic design & digital marketing.
    http://www.aqtsoft.com/

    ReplyDelete
  5. This blog is really helpful regarding all educational knowledge I earned. It covered a great area of subject which can assist a lot of needy people.Easy Accounting Software Everything mentioned here is clear and very useful.

    ReplyDelete
  6. Today’s it is so difficult to find most trusted and useful writing services through via internet. But we are providing Ph.D. writer and up-to-date academic and scientific source for your academic work. You should to visit our summarize an article

    ReplyDelete
  7. outsourcingall.com "Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it.
    This paragraph gives clear idea for the new viewers of blogging, Thanks you. You’re doing a great job Man, Keep it up.
    web hosting service in bangladesh

    ReplyDelete
  8. Thanks for sharing this nice informations.
    python course in coimbatore

    data science course in coimbatore

    android training institutes in coimbatore

    amazon web services training in coimbatore

    big data training in coimbatore

    RPA Course in coimbatore

    artificial intelligence training in coimbatore

    ReplyDelete
  9. I absolutely love your site.. Very nice colors & theme. Did you develop this amazing site yourself? Please reply back as I’m wanting to create my own personal technology website and would love to know where you got this from or what the theme is named. Thanks!

    ReplyDelete
  10. Nice post. thank you so much for sharing this Informations.
    android training institutes in coimbatore

    data science training in coimbatore

    data science course in coimbatore

    python course in coimbatore

    python training institute in coimbatore

    Software Testing Course in Coimbatore

    Java training in coimbatore

    ReplyDelete
  11. It is amazing and wonderful to see your blog. Thanks for sharing this information, this is useful to me.
    ServiceNow Training in Pune

    ReplyDelete
  12. I was recommended this blog by my cousin. I’m not sure whether this post is written by him as nobody else know such detailed about my difficulty. You’re wonderful! Thanks! Feel free to visit my website; 바카라사이트

    ReplyDelete
  13. Well explained, this post has the right information that will be useful to anyone at all time. Thanks for sharing your Ideas.
    Mulesoft training in hyderabad

    ReplyDelete
  14. This post is very simple to read and appreciate without leaving any details out. Great work !
    Mulesoft training in hyderabad

    ReplyDelete
  15. I used to ask to get this information for a long time, I was not getting it, after reading your post, I have got complete information about it.

    ReplyDelete
  16. Plastic corrugated roofing sheets is among the top companies involved in manufacturing and exporting Corrugated Plastic Roofing Sheets under the brand name CorpacInd. Established in 1998, the company has its state-of-the-art facility located at Kaharani, Bhiwadi, in Rajasthan. It manufactures Corrugated plastic roofing sheets, Polypropylene Corrugated Sheets, etc., under a roof. The skilled professionals, modern technology and advanced production facility support it's objective most extraordinarily. CorpacInd’s plastic corrugated roofing sheets combine incredible resistance to chemicals, fire and impact, ensuring an excellent durable roofing solution from the corrugated plastic roofing material which withstands extreme chemical environments.

    ReplyDelete
  17. Great to become visiting your weblog once more, it has been a very long time for me. Pleasantly this article i've been sat tight for such a long time. I will require this post to add up to my task in the school, and it has identical subject along with your review. Much appreciated, great offer.
    Software Testing Tools Training in Hyderabad

    ReplyDelete
  18. Too good Content. Thank you for sharing this Awesome blog with us.

    keep Posting More Updates.
    Salesforce Training in Hyderabad

    ServiceNow Online Course

    ReplyDelete