We all know apps. They come in varying shapes, sizes, colors and uses, along with the occasional glitch or bug. But how much do we actually know about apps? If you asked most people how they're favorite app worked, (I'll use Flappy Bird as an example) they would simply say you tap the screen to make the bird jump and avoid various obstacles. If you asked to explain deeper, they would be confused. The basic building blocks of apps are often viewed as confusing and other worldly, but it can be as simple as translating a sentence or command.
Using the MIT app generator and Scratch programs, I have been studying the basics of coding and app building. While these click and drags aren't quite the 0's and 1's of binary, they still get the job done to make a functional app. I have used the MIT generator program to construct a color pallet generator for Android phones.
Before I explain the app, I'm going to explain the different parts--or "roles"--of code. There are 8 different roles commonly referred to while constructing an app:
1. Fixed variable. Fixed variables are things that never change in an app or program. No matter what else is happening, this variable remains as it is set, unless changed by hand. An example of this is colors of the bird; It stays the same color throughout the game.
2. Accumulator. This makes a running total of numbers. This is used in Minecraft when materials are picked up.
3. Aggregator. This creates a running list of numbers, actions, colors, or commands. Instant messaging software runs heavily on aggregators to save the conversation.
4. Walker. The elements of an iterator. This simply means a large list of code (or blocks with the app inventor) that go with a specified action or command.
5. Stepper. A stepper is a predetermined sequence of events. Steppers are used in a lot of horror games. Say you click a button to open the door. That action opens the door, then sends a command for a table to fall, or a monster to appear, or something like that.
6. Best-so-far. This one is pretty self explanatory. This is what makes score boards possible, with the highest number isn't removed until a higher number is reached.
7. One way flag. One way flag is a term for an action or change that will occur in the app or program, and will only be reset by starting over, clearing, or performing another specified action. This can be as simple as hitting the "try again" button on most games.
8. Most recent. This is a variable that contains a number, color, or command that was performed last. The simplest most-recent variable is the copy-paste function.
My app, called PickAPallet, is designed for artists who don't know what colors to use, or are trying to experiment with different colors. Simply click the Generate button, and six random colors will appear on screen. You can save a pallet you like by clicking the Keep Pallet button, and clear both pallets by clicking clear.
My pallet is extremely simple as far as the code. It is basically the same three or four lines repeated with some numbers changed here and there, but it gets the job done. It contains three one-way flags, one for each button. This is because nothing will happen in the program until a button is clicked.
This app contains six different fixed variables for the generated pallet--color1 to color6-- that are each assigned different RGB values whenever the generate button is clicked. The RGB values are three numbers between 0 and 255, one for green, red, and blue. With these three numbers, the computer can generate every color.
The Keep button simply transfers the color codes from the top to the bottom of the screen, The color for ball1 goes to ball7, ball2 to ball8 and so on.
The Clear button simply sets the colors for all 12 of the balls to white--their original setting.
This program shows just how simple some programs are, but also makes it clear how complex others are. If my app contained a large code mostly made from duplicating a few blocks for three buttons, how complex is the coding behind some games like World of Warcraft or Call of Duty?
-written by Meghan Hansen