Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How do I improve my programming/computational skills?

  1. Jun 3, 2013 #1
    Hello PF,

    I've been doing some programming problems on Project Euler and Hacker Rank and I find that I struggle with them (not necessarily with the coding/implementation, but rather formulating a solution). I've been able to solve ~50 PE problems (mostly all the easier problems) and only 1-2 HR problems.

    How should I go about improving my skills in solving these types of problems?
  2. jcsd
  3. Jun 3, 2013 #2

    Simon Bridge

    User Avatar
    Science Advisor
    Homework Helper

    Get someone to teach you.
    Practice some more.
  4. Jun 4, 2013 #3
    Thank you for your response.

    Would it be a good idea to just spend a good amount of time on single problem and see if I can form a solution from researching the background of the problem?
  5. Jun 4, 2013 #4

    Simon Bridge

    User Avatar
    Science Advisor
    Homework Helper

    Depends on the problem - are you self-teaching?
    Programming courses spend a lot of time on core skills and concepts so students have the tools to tackle problems set later.

    It's quite difficult to troubleshoot your own learning - the spectator sees more of the game.
    If you are self teaching you should find a tutor to help you over the places where you get stuck.

    Where you get stuck in a course, go back over the core concepts that are presented in the few lessons before the problem was presented. Work backwards until you find something relevant.
  6. Jun 4, 2013 #5
    I think it's a case of the "the more you know the more you know". I struggle with plenty of the PE problems, but sometimes I come back to one a few months later with fresh ideas after working on other things and manage a solution.

    Time invested in a book on algorithms and data structures is well invested.

    There's a lot to be said for banging your head against a single problem for a good long time. My best learning has been a result of just that. Why doesn't it work? Strugglestrugglestrugglestruggle.... OK fixed that bit, now it still doesn't work, why? Strugglestrugglestruggle. OK, getting there, now this thing, etc ... You learn a lot about your programming language of choice that way too, it forces you to really nut out what's happening at a low level.
  7. Jun 4, 2013 #6

    Simon Bridge

    User Avatar
    Science Advisor
    Homework Helper

    Almost forgot... once the basics are down, join a project.
  8. Jun 4, 2013 #7
    Well, the only programming course I have taken is APCS in high school (this year) and I did really well in it. And a little bit before this school year I've been working on these types of problems.

    That's kind of the approach I've been going with, but I haven't been progressing much, but I guess I just need a more variety of things to work on.

    Do you have any recommendations on books?

    I've been thinking about this, but what level of knowledge/skills do you think would suffice (rather wide question but I'm really unsure where I stand)?
  9. Jun 4, 2013 #8
    Project Euler looks very interesting, didn't know it existed. I wish I had a list of such problems when I was 15... But although it is great from a problem solving perspective, they will not teach you good programming, especially when you want to learn about object oriented programming and managing larger projects (PE problems can be solved with small pieces of code). As Simon Bridge already mentioned, join a project on sourceforge, GIT or wherever... or start your own project, creating a small(!!) game or some math/physics project.
  10. Jun 4, 2013 #9


    Staff: Mentor

    Check ot the Open Source Physics website. OSP is a collection of classes written in java designed to facilitate writing physics based computer simulations. They provide eclipse workspaces with many working examples.


    To get good at programming you need to look at good examples, perhaps even improve them or use them as models for your own programs. OO programming is fraught with difficulties mostly stemming from the various design patterns used and tested by programmers. Learn about these design patterns. (the most famous is Model-View-Controller and there are many more)

    OSP uses a couple of design patterns for coding differential equations into the computer simulation and provide display classes to chart and show 2D or 3D rendering of your objects.

    Also get familiar with an IDE like Eclipse(eclipse.org) or NetBeans(netbeans.org) and if these seem too difficult look at BlueJ (bluej.org). An IDE can help check your code as you write it and can help look up methods to call (. after the object methods list pops up) and many of good coding and debug tools.
    Last edited: Jun 4, 2013
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook