Intro to Programming

My friend, Chris Stead, has been introducing me into programming. I have tried to pick up programming before but usually struggle with the concepts as I cannot visualize what the code is doing. Chris explained the basics of programming as such:

Imagine they (control structures) are like a police officer directing traffic around an accident, a really big accident. An accident that just about deleted the internets. They say turn, you turn. They say stop, you do it.


For is a control structure. It says ‘repeat this until Simon says stop.”‘


While is the same way.


If says ‘ONLY do this WHEN Simon says.’


That’s programming.


Oh, and else is the weird cling-on that follows If around and cleans up the leftover mess with a pooper-scooper.”


Using visual imagery to help me better understand how programming works, Chris has illustrated programming for me.


One Response to Intro to Programming

    • Adam
    • Learning how to program basically requires the user to bend their brain around something totally new. This isn’t a trivial action. The hardest thing to wrap your brain around isn’t really the latter stuff, but your first few weeks/months of coding.

      The way I got over that barrier to entry was to consider each line of code as conversation. That is, I treated each line of code as a specific line in a conversation.

      A lot of languages have a lot of bloat involved that only makes sense after you’re a beginner. That’s unfortunate, because it only makes it harder.

      As such, I found that talking out what I want the program to do made it much easier for me to conceptualize what I needed to do.

      if (something) then do thisThing;
      else doSomethingElse;

      while(thisThingIsTrue) doSomething;

      Function/Method calls are a little tricky at first, but really they are short hand for a bunch of code. So, you could have:

      boolean someFunction() {
      if (something) return true;
      else return false;
      }

      if (someFunction()) doSomething;
      else doSomethingElse;

      Method calls within objects are just an extension of that. Let’s say we have a Pirate class that has the function someFunction().

      Pirate{
      boolean someFunction() {
      if(something) return true;
      else return false;
      }
      }

      Then we could say something like:
      Pirate p = new Pirate(); //I just created a new Pirate.

      if (p.someFunction()) doSomething;
      else doSomethingElse;
      }

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>