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.
1 Comment to Intro to Programming
Leave a comment
Categories
Archive
- March 2010
- February 2010
- January 2010
- December 2009
- October 2009
- August 2009
- July 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- December 2007
- September 2007
- March 2007
- February 2007
- January 2007
- December 2006
- October 2006
- September 2006
- June 2006
- May 2006
- February 2006
- January 2006
- October 2005
- September 2005
- July 2005
Links
- Adaptive Path
- Alan Cooper
- BayCHI
- Boxes and Arrows
- Business Model Innovation
- Chris Stead
- Delicious
- Doc Baty
- IA Institute
- Jakob Nielsen
- James Robertson
- Jesse James Garrett
- Lihn Pham
- London IA Network
- Louis Rosenfeld
- Mario Bourque
- Matt Hobbs
- Michael Wesch
- Miki Pierre
- NYC IA Network
- Peter Morville
- Usability Book of Knowledge
- UX Pioneers
- UX Podcast
- UX Workshop
- Wireframe Brief [PDF]
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;
}