Programming Fundamentals

As students dive deeper into the heart of programming, I bring you another set of questions that I will try to answer. Feel free to correct me and make comments. Thanks!

  • What is the difference between an Arduino and a Raspberry Pi? (Hint)

From a user’s perspective, the Arduino is more designed for “hackers” to be used in embedded systems. For instance, the example often presented is if you want to turn on an LED in code. Using the Arudino, you just wire up an LED and a resistor to one of the IO pins on the arduino and do a little bit of coding.

With the Raspberry Pi on the otherhand though, because it is a full on microprocessor, one first needs to load an operating system (however system) before doing any kind of cool things (like turning on an LED). But because it is essentially a full on computer, the Raspberry Pi can do much more complex tasks that would be impossible (or just too difficult to do natively) with the Arduino (i.e. output videos to your television).

  • What is a function and what is a parameter? Give an example from one of your projects and identify what part is the function name and what parts are the parameters.

In programming lingo, a function is just a piece of code that performs some action. In performing that action though, a function may or may not need some information from the outside. The information would be consider parameters, extra pieces of information given to the function in order for the well function. For example, in Processing, “background()” is a function that sets the paints over the drawing surface with a color. Of course, in order to paint, it needs to “know” what color to paint and that is the parameter you would give it. To specify a gray scale value for instance, you can call background(GRAY_SCALE_INT) where GRAY_SCALE_INT is an integer between 0 and 255 inclusive.

  • What is the difference among: int, float, bool, and char. What do each of them mean?

Int, float, bool, and char are all native data types used in Java. They represent different types of data.

  • The int is used to represents a integer number (-2,147,483,648…-2,-1,0,1,2…2,147,483,647)
  • The float is used to repesent decimal numbers.
  • The bool represents one of two values: true or false.
  • The char is used to represent characters (e.g. ‘A’, ‘g’, ‘\u123’) (Note the single quotes)
  • What is the difference between ”=” and ”==”?

So the single equal sign (“=”) is used in assignment such as int x=7 which assigns the value of 7 to the variable x.

The double equal sign (“==”) on the other hand is used in comparisons and evaluates to true or false depending on whether the two operands are equal or not, respectively. (e.g. 5==7 would evaluate to false)

  • Why do we use variables in programming?

From a functional standpoint, the use of variables allows the coder to manipulate piece of data without knowing the value of the data apriori thus leading to more general code. (For instance, if you were asked to calculate the sum of the integers from 1 to 100 inclusive, you can use a for loop that sums up the numbers 1, 2, 3…, 99, 100. But if generalized the problem to summing up integers from integer startInt to endInt, then you can reuse the same code for calculating the sume of integers from any number to any other higher number.)

Of course using variables often make code more readable by giving pieces of data more meaning names. For instance, if we were using Processing to create a sketch window of width 300 and height 300, we can say “size(300, 300)”. But if we came back to this piece of code months later and forgot about what size accepts but need to change the window to have width 300 and height 200, then we need to do a little research to figure how to do so. On the other hand, if we from the start defined variables width and height and instead had code that said “size(width, height)”, we would easily be able to just change the variables to meet our needs.


  • Why do we use loops in programming?

The use of loops is all about creating more manageable code. Having to mimic the functionality of loops without the loop structure often leads to repeated code which leads to code that is harder to change/and even understand. Some functionality is even impossible to perform without loops.

For instance, say you wanted to go through an integer array and print out the contents of the array without knowing the size of the array at the time of coding. Well, then the coder, without loops, has no way to actually perform the task. That is because, without loops, the coder essentially has to hardcode reading each part of the array and print out the contents but without knowing the size of the array, the coder doesn’t even know how many lines to hardcode.


  • Explain what this means.

The image above is just a schematic representing generally how code high-level code that many coders write (using Java, C, etc.) actually gets translated into something that can be processed and run by a computers. As you can see, the code that we write in a high-level language first gets compiled into assembly (often less human-readable code that represents the exact functionality of the high-level code but in terms of instructions that the computer chip understands). From there, the assembler then translates the assembly into computer code,  a series of 0’s and 1’s which the computer actually operates on.


I’ll leave the following for another time…

  • Write a sentence about 3 things you’ve learned that you haven’t written about on your website yet.

Game Review #3: Achievement Unlocked

For the third game review of the summer, I bring you Achievement Unlocked. If you played This is the Only Level, the game review in our last review, then the main character of Achievement Unlocked will seem quite familiar. That’s right, the little blue elephant is back, this time stuck in the same closed off world for 20+ minutes as you try to figure out how to unlock 100 achievements.

As such, there isn’t much guidance as to what to do (outside of the name of the achievements) in order to unlock those achievements. At least with This is the Only Level, you know that you need to get the elephant to the tunnel at the end. With Achievement Unlocked though, you can spend countless minutes trying to figure out how to unlock the achievement (until you give up and look at the hint).


So, I have a love hate relationship with Achievement Unlocked. I enjoyed unlocking those achievements but the lull time leading up to those unlocks got old quickly.

Getting Started with Processing

Today, with the students diving deeper in the world of Java using Eclipse, I say farewell to the language of Processing (temporary anyway).

Having been deeply ingrained in C, I found that working through the book was a great refresher on Java. I can only imagine what fun it would have been to start learning Java with this program. Sure it hid away many of the ideas of classes but the graphic/sketch emphasis really motivated me to code and experiment. So I didn’t learn much content from the book per-say given my background in coding, but seeing how involved the students got in their projects with processing, I got a glimpse into how to really motivate such students to code.

Day 3 – No Storm Yet

Day 3 (yesterday) revealed to me these kid’s creativity. Many knew what they want and were willing to experiment. Unfortunately, I felt many still need to work on really understanding their code. Too often was I asked “How do I do <insert action>?” which was immediately followed by “Can you show me how to do <insert action??” Perhaps I need to try a different strategy of getting them to figure out how to do things for themselves. Perhaps entering the world of Eclipse will force them to do so. Day 4, here I come.

Day 2 – Calm Before the Storm?

The second day was rather easy. I get the feeling that the students are really understanding how to get the work done and gaining a great deal of experience with blogging and gaming. Some may need to work on how to debug/interrupt errors but hopefully they will get plenty of experience with that as they move on to a more mainstream IDE like Eclipse. With all that said, the second day was less hectic and so I got to work on the Lego Mindstorm instead (got bluetooth working!).  I fear though that with the introduction of real Java and Eclipse, will I get to experience the rush of Day 1 again? Either way, I can’t wait for day 3.

Game Review #2: There is Only One Level

For the second game review this summer, the class (including myself) played “There is Only One Level” which can be found here:


I was intrigued by the various controls (and the cleverly labelled stages of the “one level”) and really appreciated the creativity that the creators put into getting an elephant to the end of the tunnel. At points it got kind of repetitive, at others I was lost, and yet still at others you wanted to throw your keyboard ON THE GROUND because you just can’t get the elephant to stop getting impaled on the deadly spikes. In the end though, I found myself enjoying the game (and the stats at the end almost made me play it again just to see if I could do better).

How We Talk To Computers

Now that the students had a chance at tackling these questions, let’s see what I can come up with. (If you are reading this, feel free to chime in with corrections/comments. Thanks!)


  • What do computers do better than humans?

Well, computers were designed to…compute. So computers are definitely better (faster/more accurate) at computing then most humans. This translates into rendering images faster, storing data more reliably, communicating at longer distances…the list is endless.

  • What do humans do better than computers?

That is not to say that computers are better then humans at everything especially since humans created computers. So humans can design…can think outside of the box. Sure, there are advanced in AI but have yet to really match humans in our ability to make sense of our sensors (eyes, tongue, nose, ears, skin) and judge the quality of something. Above all else, computers have yet to achieve true consciousness…we think.

  • What is the difference between a Microprocessor and a Microcontroller?

Generally, the two are the same. It is just that microcontrollers (like the Arduino) are typically purposed into embedded systems/smart products and so  are designed to perform “simple” actions quickly and made to be more hacker/hobbyist friendly . On the otherhand, the microprocessor is typically purposed into computers and so are designed as such.

  • What does the Assembler do?

The “assembly” takes assembly code and converts that into bits that the computer can execute.

  • What does the Compiler do?

The “compiler” takes source code (something say a coder would write in Java or C) and covert that into a much lower level code (e.g. assembly or even machine code).

  • What is an IDE?

IDE typically is an acronym for Integrated Development Environment. IDEs like Eclipse are quite ubiquitous in the programming world because they combine a lot of the functions a coder needs into one piece of software (including a place to edit code, functions to run the code, and functions to debug the code).

  • What is the Processing IDE?

The Processing IDE are partial differential equations…I mean PDE. Find more information here.

  • Why do we program in High Level Languages?

Since we often think at a high level, being able to program at the same level will allow us to get working code up faster and help us to move on to tackling more problems. (At the other extreme, if we instead had to talk in computer language–binary–imagine how long it would take to just tell the computer to print out “Hello World!”. And even if we did survive to do so, then we had to suddenly switch to a different computer with a different chip, we would have to do it all over again.)

  • What is binary, octal, decimal, and hexidecimal?

Binary, octal, decimal, and hexidecimal are all common forms of representing numeric values, each constrained to using only a certain set of symbols.

Binary is only allowed to use 0 and 1, octal 0 to 7, decimal 0 to 9, and hexidecimal 0 to 9 and to A to F.

For example the equivalent to the numeric value of 29 (which is decimal) is

  • Binary: 11101
  • Octal: 35
  • Decimal: 29
  • Hexidecimal: 1D

Day 1 – No First Day Jitters


  • What can I say but that these middle school children are brilliant. (I should have expected as much from the name of the program.)
  • To Lego Mindstorms: How come I didn’t get to play with you as a kid?

The Pics The GIF That Captured My Emotions (Sort Of):


The “Deets”:

Sure, I had bike trouble. Sure, I got lost trying to get to Theta Delt after being on campus for more than five years. Sure, I had butterflies standing in front of 15 middle school students who probably had no clue why a dorky Asian guy was standing in front of them talking about a game he never played. Let me tell you though, it quickly turned from me just hovering over students to helping answer one brilliant question after another. My everyday worries just melted away with every smile I got back from those beaming middle schoolers…I can’t wait for what’s in store for tomorrow.

Of course my day couldn’t get any better…until I got drafted to help with LEGOs! I will post a picture in the next post once I get the Lego arm (you heard me right…a 3DOF lego arm with a brain!) doing something awesome. I’m just glad I was able to get it to interface with Ubuntu (thanks in large part to

Game Review #1: PressSpaceToWin


  • This game is about a young hero off on a quest to kill a giant who is the king of the village or at least that was what I infer the game to be about.
  • I think this game is rather simple compared to modern computer games what with its pretty linear event sequence, magnified 8-bit graphics, and minimal user-game interaction.
  • My favorite game is Starcraft II: Heart of the Swarm (though I haven’t actually played it…or any of the Starcraft games…yet).
  • I like that game because I am immediately get sucked in by the beautifully rendered environment but then stay for the constant real-time battle of strategy and wits up till the very bitter end.
  • The difference between these two games are many. Graphics is the most prominent with the former rendering easily on the web while the later requiring some rather beefy graphics card to experience HD quality. Next most prominent for me is the level of user interaction. Compared to the former with its set story line and the gamer mere merely pressing/tapping the space bar, Starcraft demands a thousand fold more amount of mental concentration to merely even see the game through to the end be it win or lose.
  • Thanks for reading and stay tuned for more of my thoughts!

The Pics:

PressSpaceToWin_Cropped vs Screenshot from 2013-06-22 23:14:50

The “Deets”:

In comparing the “game” Super Press Space to Win with one of my favorite games, we really start to get a sense of what we (or at least I) have come to expect a game to have. I’ve come to expect a certain level of graphics (from computer games at least). I’ve come to expect non-trivial tasks. Above all else though, I’ve come to expect a great deal of user-game interaction. And I think as we move towards thinking at a higher and higher level with games, game designers have actually started to focus more on these aspects. They want to figure out what aspects of a game given games a good experience, because ultimately, that is what games are all about…right?