How to Get Started On Any Programming Exercise

Graphic header for blog "How to start any programing exercise", with photo of Codeup instructor, Ryan Orsinger

Programming is hard. Whether you’re just beginning to learn or you’ve been programming for years, you’re going to run into roadblocks and get stuck. Our Data Science Instructor, Ryan Orsinger, has seen 36 cohorts of students come through Codeup and helped build their problem-solving skills through live, audience-centered lectures. Check out his recipe for success below:

Scenario:

You’re learning to code, learning the syntax for a programming language, and working on thinking programmatically. The lesson or lecture is completed and now you’re now facing a programming problem that is expecting you to understand and apply the new content.

How do you get started?

 

Here’s your algorithm for getting started:

1. With intent, read the curriculum and the code examples.

2. Go back and deliberately read the example code very closely and slowly.

3. Copy any example code into your editor.

    • Identify the pieces of syntax that you recognize.
    • Identify the code for the new concept that you’re working with.
    • Ask yourself how the syntax or concepts you know already support and connect with the new topic or new syntax. Often, the new is relatable in terms of the old.
    • Ask yourself questions about the code example
      • What is this entire code example supposed to do?
      • What piece of the language is this new concept?
      • Is the new code a new piece of syntax? Or is it an existing piece of syntax?

4. Run the example code

5. Observe results. Think about each piece of code. What is it doing, what did you expect it to do?

6. Try modifying the example code so that you change variables to see different results (one at a time…)

If the example code demonstrates how to make a loop from 0 to 9:
– Modify the code to make a loop that starts at 1 and ends at 10.
– Modify the code to make a loop that starts at 10 and counts down to 0.

7. Try removing as many moving pieces from the code for the new concept as possible… try to isolate a unit of work that uses the new concept and test it in isolation

8. Read the first exercise problem. Read it slowly, with attention to detail.

9. Ask yourself questions about the exercise:

  • Can you explain or restate the problem in plain English?
  • Are you able to write down the steps from problem to solution in English, without using any code?
  • Break the exercise down into pieces. Each piece is either something you’ve seen or it’s new.
  • Given the concept for this lesson, identify which part of the exercise uses the new topic
  • For the new piece, what is similar between the exercise code and the example code for the lesson?

10. Work to write code for a smaller problem than the exercise asks.
If the exercise says:
– Prompt the user for a number between 1 and 50
– If the input is not numeric or out of that range, ask them again for a number. Repeat until they give a number between 1 and 50.
– Start by making sure you’re able to prompt a user, then store the result of prompt to a variable for later.
– Go after the low-hanging fruit first. Momentum begets momentum.

11. If you’re still having problems and stuck, go to step 1.

12. If friction, confusion, and “writer’s block” persist, then ask for help from another human being. Explain the steps you’ve already taken, and attempt to ask your question as clearly as possible. Here’s a good resource on how to ask effective questions!

 


Ryan Orsinger is a proud instructor here at Codeup. Check out his personal blog for more insightful information here!

 

 

 


 

If you were inspired by this article and have any questions about our programs, give us a call. We’d love to chat.

Recommended Posts