Vocabs and Stuffs

Vocabs and Stuffs


  • use when you have a big chunk of data (text, cryptography, phone numbers, etc.)
    • phone number – parse first 3 digits to get the area code
    • text – parse into words/sentences, etc.
  • to parse is to go thru, chop up data into smaller pieces to identify and compare – going thru piece by piece
  • breaking data into meaningful pieces
  • unit of meaning


  • go thru a loop and do the exact same thing over and over again
  • an iteration – a frame in a loop
  • “iterate over” – pass thru each part one frame at a time
  • unit of math
  • can iterate thru words, but not until you’ve parsed some text into words


  • to identify a break in the meaning – to separate, to outline
    • ex: spaces delineate words so I can parse text into words

Organization When Coding

  • start with an outline, big picture
  • then fill in functions with their definitions
  • start with brain’s way of understanding, then translate into code
    • English -> psuedo-code -> code


  • when you take in some input, get output, and put that output back thru (however many times)

F(x) = 2x

F(F(x)) = 2(2x) = 4x

  • in this example, both xs are local – they are not the same but are distinct from each other
  • a recursion example: a function taking in itself (tricky b/c of scope and accidental infinite loop)

Today’s Resources:

My older brother.

CS50 — Week Two Notes

CS50 — Week Two Notes


Pset Grading <Perhaps class-specific, but not without value in a general sense.>

  • scope – right piece of the problem bitten off
  • correctness – program works as it’s supposed to?
  • design – subjective, will take the longest to learn… how well written is the code? how efficient?
  • style – how pretty is the code? well-named, indentations, readability
  • 1-5 (3 = good)


  • sending secret messages
  • inputs: the secret key + “plaintext”
  • outputs: ciphertext (to de-encrypt, just plug in ciphertext + key to get the original plaintext)
  • there’s no such thing as a string in C, just a series of characters stored in memory (RAM) back-to-back


  • allows you to switch from one data type to another
  • remember, it’s all 1s and 0s
  • for example, ASCII maps letters to numbers (capital “A” = 65, etc.)
  • after establishing some int i, can change types by putting in parenthesis the desired type and the current type next to it:
    • (char) i

Strings in C

  • when storing strings, C delineates the end with a \0 (8 0 bits in a row) that serves as a line in the sand of sorts marking out the end
  • strings by design have a dynamic number of characters, so there’s no way for the computer to know in advance how many character slots it’ll need

Command-line Arguments

  • int main(void)
    • no input taken in from the user taken at the command line
  • int main(int argc, string argv[])
    • array = similar data stored contiguously together in memory (generally, the same type/related data (string string string; int int int; etc.)
      • the string “Netanya” is technically just an array of chars
      • argv = an array of strings
  • how about the output/the return? it’s always int
    • in general, if nothing has gone wrong in the program, the convention is that 0 is returned
    • alternatively, if the program returns a negative value (or anything but 0), it generally signifies that something has gone wrong
      • exit codes” that are generally only useful/meaningful to the programmer or to the company shipping the software (I may see error messages with the numbers displayed, but as an end user they’re pretty meaningless to me)
    • if unspecified, main will return 0
  • to check return values, use echo $? in the terminal command line (useful for debugging)


  • when building bigger programs with 1,000s of lines of code, it’s not a good idea to keep everything in main(), b/c it’ll get harder and harder to find things in your code
  • also called: procedures, methods (esp. in object-oriented programming languages), subroutines
  • what is it?
    • a “black box” with a set of 0+ inputs and 1 output
    • “black box” b/c unless we write the function ourselves, we don’t really need to know the underlying implementation as long as the output is what we expect
      • important that when we write functions, they have clear names and documentation (for others’ ease of use)
  • why use?
    • organization – break up complicated problem into smaller parts
    • simplification – easier to write + debug small pieces of a program at a time
    • reusability – recycle + reuse elsewhere
  • step 1 = declaration
    • gives compiler a heads-up that the function is going to appear in code
    • should be before main()
    • return-type name(argument-list)
      • return-type is what kind of variable the function will output
      • name should be meaningful and point to usage
      • argument-list is what kind of input
  • step 2 = definition
    • write instructions for what to do in the “black box”
  • step 3 = call
    • use in the program where you need it
  • no input? void no output? void
Practice Problem! valid_triangle()

Variables and Scope

  • scope = variable characteristic defining from which functions that variable may be accessed
  • 2 primary scopes in C:
    • local variables
      • can only be accessed within the functions in which they are created
    • global variables
      • declared outside all functions (including main())
      • can be accessed by any function in the program
      • flexible, yet could have dangerous consequences if one function changes the variable’s value before you expected it to be changed
  • local variables in C are passed by value in function calls
    • the callee (function taking the variable as input) receives a copy of the passed variable, not the variable itself
    • the variable can’t be changed (really, doesn’t have an ability to have its value varied anymore, being just a copy of a value) unless overwritten in the caller (function that is making the function call – or, in other words, the function that the called function’s inside of)
  • scope isn’t such a problem if all variables are named distinctly, but can get nasty if same variable name appears in multiple functions
    • happens a lot in the real world when a team is working on a project together
    • esp. common xy, etc.
What’s printed?


  • a fundamental data structure to hold a bunch of integers, or a bunch of strings, without having to give each its own variable name (which could become cumbersome)
  • partitioned into identically-sized blocks of memory space called elements
  • each spot in an array can store a certain amount of data
  • elements can be accessed directly by an index
  • in C, elements are indexed starting from 0
    • ex: in an index of n elements, the first element located at index 0, and the last at index (n-1)
    • C won’t prevent me from going “out of bounds” of my array, but it’ll cause major problems, so I have to watch out
  • declarations
    • type name[size];
    • type = what data type the elements will be
    • name = what I want to call my array
    • size = how many elements I want my element to contain
  • if declaring and initializing an array simultaneously, use instantiation syntax or a loop
    • instantiation syntax:
      • bool truthtable[] = { false, true, true };
      • *notice that this syntax does not require me to specify number of elements in [] because the compiler is smart enough to count how many elements are listed in {}
  • can create as many size specifiers as desired, and can think of them as 2- or 3-dimensional, though in the computer’s memory, it will always be a one-dimensional array
    • example:
      • bool battleship[10][10];
      • in my mind: a 10×10 grid of cells on which to play battleship
      • useful abstraction to help the human mind perceive
  • in C, can’t treat entire arrays themselves as variables – can’t assign an array to another using the assignment operator (=)
    • instead, would have to copy over each individual element using a loop
    • other more modern languages do allow you to do this
  • unlike (local) variables, arrays in C are passed by reference in function calls (the callee receives the actual array and not a copy, so all changes made to the array within that function are effective everywhere else in the program that the array is)
  • ** Note to self: in the printf() function, the modifiers %d and %i have the same result – printing an integer (d is for “decimal”)

Command Line Arguments

  • if we want the user to provide data to our program at run time (instead of while the program is running), we want another form for main()
  • int main(int argc, string argv[])
    • these 2 special arguments allow me to know how much and what data the user provided at the command line
    • argc stands for “argument count” and is a conventional name (I could name it anything I want)
      • number of command-line arguments is counted by white spaces between them
    • argv[] stands for “argument vector” (another conventional name)
      • vector is another name for array
      • argv[0] will always be the first string the user typed (aka the program name)
      • argv[argc - 1] holds the last element of argv[]
  • it’s good to remember that whatever data is collected in argv[] is stored under the string data type

Magic Numbers

  • directly writing constants into our code is sometimes referred to as using magic numbers
  • it’s a bad habit and should be generally avoided
  • we want to give symbolic meaning to any constants
  • C provides a preprocessor directive (also called a macro) for creating symbolic constants:
    • #define NAME REPLACEMENT (** no semicolon!! *capitalization is convention and not requirement, but is good practice for clarity purposes)
    • other macros we’ve been using: #include <blahblahblah.h>
    • if #include is like copy/paste, then #define is like find/replace
    • at time of compilation, #define goes through code and replaces NAME with REPLACEMENT
    • #define PI 3.14159265 goes thru and replaces every pi in code with 3.14159265
    • #define COURSE "CS50" goes thru and replaces course with cs50
CS50 — Week One Notes, part 2

CS50 — Week One Notes, part 2

I had to break these up into two different days because it was information overload.

Side note to self: If I’m ever in my workspace and I accidentally made a never-ending program that’s trying to force me into infinite loops of the same banal GetInt() function, use ctrl-z!!!

Conditional Statements

  • conditional branches/expressions/statements allow programs to make decisions depending on variable values or user input

if (boolean expression)



  • (mouse down) (x < 10) etc.
  • boolean expression evaluates to true? all lines of code between curly braces will execute from top to bottom
  • boolean expression false? those lines of code will not execute

if (boolean expression)






  • boolean expression evaluates to true? all lines of code between 1st set of curly braces will be executed, top to bottom
  • false? follow instructions in 2nd set of curly braces
  • I can create chains of mutually exclusive branches by using if, else if (* n), else with as many different boolean expressions
  • I can layer on as many if statements as I like (creating a chain of non-mutually exclusive branches), but the else will only bind to the nearest if


  • allows me to specify distinct cases rather than having to rely on boolean expressions
  • must break between each case, or I’ll “fall thru” each case and execute them all in order (unless that’s what I’m trying to do)

int x = GetInt();
case 5:
case 4:
case 3:
case 2:
case 1:
printf("Blast off!\n");

The ternary operator ?:

  • useful when writing very short if-else statements
these 2 code snippets act identically
int x = GetInt();
if (b == 0)
x = 5;
x = 6;
int x = GetInt();
x = (b == 0) ? 5 : 6;


  • allow programs to execute lines of code repeatedly (saves me from needing to copy/paste or repeat lines of code)

while (true)



  • infinite loop: lines of code between curly braces will execute repeatedly top to bottom forever (because true is always true)

while (boolean expression)



  • if boolean expression evaluates to true, all lines of code within curly braces will execute repeatedly top to bottom, until the boolean expression evaluates false




while (boolean expression);

  • executes all lines of code in curly braces, then checks boolean expression – if true, goes back and repeats code block until boolean exp. evaluates to false

for (int i = 0; i < 10; i++)



  • repeats the body code a specified number of times (above, for example, 10 times)
  • what the parts?!
    • the counter variable(s) (above, i) is set (above, to 0)
    • the boolean expression is checked (above, i < 10)
      • if true, body code executes
      • if false, body code does not execute
    • after getting to the end of the body code, the counter variable i is incremented (above, by 1, using the shorthand var++)
    • the boolean exp. is checked again and either goes thru the body code again or does not
  • more generally: for (start; expr; increment) where there can be more than one statement in start and increment


CS50 — Week One Notes

CS50 — Week One Notes

From Scratch to C.

  • same elements, different language to implement
  • write a bit of code, run/test it, then move on once its debugged (vs trying to write all your code at once and then not really knowing which part is making the whole thing crash, etc.)
  • any time I’m copying and pasting code from one place to another without changing a thing, there’s probably a better way to do it (a cleaner design)
  • source code –> pass as input to a compiler –> compiler turns it into source code that computer can read
    • “compiling” = umbrella term
    • preprocessing
      • find and (re)place
      • ex. “#include”s in C are in this step
    • compiling
      • source code –> assembly code
      • assembly code = arcanely worded sets of instructions that sets of 0s and 1s are mapped to
    • assembling
      • assembly code –> 0s and 1s
    • linking
      • computer gets the 0s and 1s from the code I wrote in my .c file, CS50 staff’s 0s and 1s from what they wrote in the CS50 library, printf()’s 0s and 1s from the standard input/output library, etc. (whatever was used to write my program) and combines together in my program “hello” (or w/e the name is)

The imprecision of number representation due to a computer’s limitations

  • we humans can think of and create an infinite number of numbers
  • computers are limited by how much memory’s available in their RAM
    • think about it – without any tricks or extra code, a byte can only store integers of value 0 thru 255!
  • we humans need to be aware of this limitation
    • ex: when The Patriot anti-air missile system was programmed to count time by 1/3 of a second, and so after running for many hours straight its timing was off and lives were lost
  • by creating a simple program in C, we can see that the computer’s representation of the decimal created by dividing 1 from 10 (should be 0.10) proves itself to be fundamentally imprecise when taken to too many decimal points
    • printf(“n is %.55f”, 1.0 / 10.0); yields “n is 0.1000000000000000055511151231257827021181583404541015625”

The Linux Command Line

  • Mac OS is a descendent of the Unix operating system (“a Unix-based system”); Linux was developed independently but is similar to Unix; Windows was built from ground up in a completely different way
  • the default command line in the CS50 IDE is terminal called “workspace”
  • shell = software interface (often a command line interface) that allows users to interact with the computer
  • bash = “Bourne-Again Shell”, the default shell environment in Linux and Mac OS X

name of command <argument>


  • short for “list”, gives readout of all files and folders in current directory
    • blue = directory (that I can navigate into)
    • black = text or source code file
    • green = executable file

cd <directory>

  • short for “change directory”, changes current directory to (a specified)<directory> in my workspace or on my operating system
    • shorthand for current directory = .
    • shorthand for parent directory of current directory = . .
    • pwd (present working directory) gives name of current directory
    • cd on its own will bring me back to original directory location
  • if the name of a directory has multiple words separated by spaces, must enclose name in quotes when calling it up

mkdir <directory>

  • short for “make directory”, creates a new subdirectory called <directory> located in the current directory
  • analogous to: in GUI operating system, right click and in prompt click “New Folder”

cp <source> <destination>

  • short for “copy”, creates duplicate of file I specify as <source>, which it saves in <destination>
  • cp -r <source directory> <destination directory>
    • copies entire directories (“-r” flag stands for recursive, tells cp to copy everything inside directory, including any subdirectories it may contain)

rm <file>

  • short for “remove”, deletes <file> after asking me to confirm (y/n)
  • rm -f <file>
    • skips the confirmation (but can’t undo so beware)
  • rm -r <directory>
    • deletes entire directory (can combine with -f flag: “rm -rf <directory>”)

mv <source> <destination>

  • short for “move”, renames file, moving it from <source> to <destination>

chmod <options> <permissions> <file>

  • short for “change mode”, changes the permissions of files or directories (aka who can access the file and how they can access it)
  • options are like the -f flag we saw before, plus others
  • permissions can be defined for:
    • user (owner of file)
    • group (members who own the file with you)
    • others (anyone else)
  • permissions can include:
    • read (4), write (2), execute (1), no permission (0)
  • example in symbolic permissions notation:

    chmod u=rwx, g=rx, o=r myfile

  • same example in octal permissions notation:

    chmod 754 myfile

ln <target> <linkname>

  • short for “link”, creates links between files
  • if <linkname> is omitted, link to <target> is created in current directory using the name of <target>
  • different from cp – same data is being pointed to by both file names
    • if go into data and change it from either, the data is changed for both
    • if one of the files is deleted, data is still safe in other file which points to it
  • use the tag -s to create symbolic links (file points to other file/directory where data/files are stored)

touch <file>

  • changes file timestamps (access, modification times) to current system time

rmdir <directory>

  • short for “remove directory”, removes directories that are empty

man <argument>

  • short for “manual”, shows the system’s reference manual for that argument (usually a program, utility or function)

diff <file> <file>

  • short for “different”, analyzes two files and outputs instructions to change 1st file to match the second

sudo <command>

  • short for “superuser do”, allows a permitted user to execute command as another user


  • clears the screen
  • same as ctrl + l in bash


  • short for “TELNET protocol”, used for communication with a remote host or device
    • ex: “telnet hostname” would connect user to a host named hostname
    • unsafe to transfer data in this way because others could grab data as it’s being transmitted

Data Types

  • in C, an older language, we have to specify each data type before we can work with it

Native to C:


  • used for variables that will store integers
  • integers always take up 4 bytes (32 bits) of memory
    • roughly, that means we can store -2 billion to 2 billion
  • unsigned int
    • unsigned = qualifier that doubles positive range at the expense of disallowing negative values
      • other qualifiers = long, short, const
    • if I know my value will never be negative, I can use this to count up to ~4 billion


  • used for variables that will store single characters
  • characters always take up 1 byte (8 bits) of memory
    • thanks to the ASCII system, different numbers have been assigned to characters (ex: “0” = 48)


  • used for variables that will store floating-point values (real numbers)
  • floating point values always take up 4 bytes (32 bits) of memory
    • some of these bits are used for the integer part and some for the decimal portion
    • we are limited to how precise we can be


  • used for variables that store floating-point values
  • double precision -> always take up 8 bytes (64 bits) of memory


  • a type, but not a data type (can’t assign a value to it)
  • void functions don’t return a value
  • a function’s parameter list can also be void if the function takes no parameters
    • like “main”, when we haven’t been passing any arguments into main (we could tho)

Thanks to the CS50 Library:


  • used for variables that store a Boolean value (true or false)
  • booleans are a standard default (native) data type in many modern programming languages, but not in C


  • used for variables that will store a series of characters (a “string”)
  • can be words, sentences, paragraphs or even books!
  • not a native data type in C, so doesn’t come up as purple in the IDE

And later on…


  • used to group ints and strings into one unit


  • “defined types” that allow me to create my own data types


  • to create (“declare”), specify the data type, give it a name, and slap a semicolon to the end
  • to create multiple variables of same type, specify the type once and then list as many variables as desired
    • int height, width;
      • creates two integer type variables with respective names “height” and “width”
  • good practice = create variable right when I need it
  • after a variable’s been declared, no need to specify variable type again
  • simultaneously declaring and setting the value of a variable? (“initializing”)
    • int price = 17; // we’ve specified an integer, named the variable “price” and assigned it a value of 17


  • in C, we can add, subtract, multiply and divide numbers, as well as get the remainder of left number divided by right (modulus)
    • int m = 13 % 4; // m is now 1 (13 / 4 = 3.25 or 3 1/4)
    • the modulus operator is more useful than you’d think (like in a random number generator, whereby you want to limit the range of the random number you generate)
  • shorthands
    • x = x * 5 –> x *= 5; // works with all 5 basic operators
    • x++; // incrementing variable by 1
    • x–; // decrementing variable by 1
      • x = x + 1 == x += 1 == x++

boolean expressions

  • in C, every nonzero value = true and every zero = false
  • don’t always have to use type bool when we are working with boolean expressions
  • logical operators
    • logical AND (&&) is true if and only if both operands are true, otherwise false
      • if x && y {..go down this path..}
      • x is true and y is true? true
      • x is true but y is false? false …etc.
    • logical OR (||) is true if and only if at least one operand is true, otherwise false
      • if x || y {…}
    • logical NOT (!) inverts the value of its operand (called “bang”, “exclamation” and “not”)
      • x is true? !x is false (and vice versa)
  • relational operators
    • less than (x < y)
    • less than or equal to (x <= y)
    • greater than (x > y)
    • greater than or equal to (x >= y)
    • equality (x == y)
    • inequality (x != y)


let’s learn JavaScript! (or melt my brain trying) – Day One

let’s learn JavaScript! (or melt my brain trying) – Day One

JavaScript syntax

  • statements (instructions executed by web browser) separated by semicolons
  • fixed values = literals
    • numbers (with or without decimals)
    • strings (text written within double or single quotes)
  • variable values = variables
    • used to store data values
    • keyword “var” used to declare them
    • assign values to variables with “=”
    • compute values with arithmetic operators (+ – * /)
  • expression = combo of values, variables and operators
    • computes to a value
    • the computation is called an evaluation
    • i.e. 6 * 10 evaluates to 60
    • values can be numbers and strings
      • “John” + ” ” + “Sausage” evaluates to “John Sausage” (string linking called concatenation)
  • keywords identify actions to be performed
    • ex. “var” tells the browser to create variables
  • identifiers = names JavaScript accepts
    • used to name variables, keywords, functions and labels
    • rules:
      • first character = a letter, underscore or dollar sign (no #s!)
      • subsequent characters = letters, digits, underscores or dollar signs
      • case sensitive (i.e. var lastName != var lastname; “VAR” is not interpreted as the keyword “var”)
      • no hyphens (reserved for subtraction operations)
    • programmers in JS tend towards “lower camel case” – camel case that starts with a lowercase letter: lastName, classicJazz, hippoFinger


  • statements are executed in the order they are written (top to bottom, left to right)
  • ending statements with semicolons = not required, just highly recommended
  • white space is ignored by browser when reading your instructions, but using it can increase readability
    • i.e. good practice = put spaces around operators
    • statement doesn’t fit on one line? break after an operator or comma
  • statements can be grouped in code blocks inside curly brackets
    • purpose = define statements that are to be executed together
    • ex: functions
  • often start with a keyword to identify what action is to be performed
    keyword description
    break terminates a switch or loop
    continue jumps out of loop and starts at top
    debugger stops execution of scripts, calls (if available) debugging function
    do … while executes a block of statements & repeats the block, while the condition is true
    for marks a block of statements to be executed, as long as condition is true
    function declares a function
    if … else marks a block of statements to be executed, depending on a condition
    return exits a function
    switch marks a block of statements to be executed, depending on different cases
    try … catch implements error handling to a block of statements
    var declares a variable
  • keywords are reserved words!! (cannot be used as names for variables)


  • used to hold data (data types in JS include numbers & strings)
    • strings = written inside double or single quotes
    • numbers = no quotes (if written in quotes, will be treated as string)
  • similar to algebra, variables are used in expressions (i.e. total = price1 + price2, where “total”, “price1” & “price2” are defined variables)
  • must be identified with unique names (“identifiers”)
  • use the “assignment” operator when declaring variables (=)
    • not to be confused with the “equal to” operator (==)
    • ex: x = x + 5 assigns the value of x + 5 to x
    • good practice = declare all variables at beginning of a script
      • can declare many variables in one statement by using commas
        • var person = “Baby Thumb”, carName = “Wristmobile”, price = “priceless”
  • a variable can be declared without a value (in that case, the value is “undefined“)
    • can be useful if value is something that needs to be calculated or provided later, like user input
    • after the execution of this statement, the variable carName will have its value undefined: var carName; ((if nothing else is added, will show up as ‘undefined’ within page))
  • can re-declare a variable without it losing its previously assigned value
    • var carName = “Wristmobile”; var carName;
  • if declare with a number in quotes, rest of numbers following will be treated as strings and concatenated (added)
    • var x = “5” + 2 + 3 (value will show as “523”)
    • var x = 5 + 2 + “3” (value will show as “73”)

Today’s Resources:

The ever-helpful W3School’s JavaScript tutorial.

basics of higher-level software programming languages

basics of higher-level software programming languages


Computers are linear – they are reading top to bottom, left to right. If you want to make two things happen at once, you are creating the illusion that the computer is doing this. (But it’s not, it’s doing one thing at a time still.)

Everything’s possible with programming, but it takes some cleverness to accomplish it.

Everything has a position – the file, the program, etc.

Frames: everything you want to have happen “at the same time” has to happen within the same frame – calculate a little, show a little, calculate a little, show a little.

Anything that happens first tells the computer what’s coming next. (For example, in CSS the “.” before “.thick-outline” tells me that it’s going to be read by the computer as a class, and not something else.)

Always think about everything possible that people could do. If you have some data they can input, think about all the different data they could give you, even outside your expectations (hackers use data exceptions to break programs, for example).

If you ask the computer, what data is in that position, and that position does not exist, it’ll be “null”.

Array = database without a pointer, instead it just has numerical names to identify the location of various elements. (No “next line”, just “data piece 4” or “data piece 7”.)

Native data types = what’s already there. If it’s not a native data type (like strings in C), it’s going to take an extra cleverness to make it work.

Because the computer reads left to right, there’s precedence. Whatever comes first sets the stage. For example, it quotes tell the computer there’s text coming, and then I type “//”, this will be shown as text and not create a comment.

In C, “;” is not needed at the end of pre-processor directives (#blah input library blah), comments, function definitions, and controllers.

In C, you must start with the function “main” (like how you have to put everything you want the user to see inside the <body> tag in HTML).

4 basics:


  2. data

  3. functions

  4. variables/names


  • text not read by the compiler or the interpreter
  • // – line comment (end comment by going to new line)
  • /* – block comment (end with */)
  • for me, for other people looking at my code, and for remembering things that for the moment aren’t visible (I create some variable but what am I using it for? etc.)


  • number types
    • boolean
      • 0 or 1 – one binary digit
      • for example: “true” returns a boolean 1
      • use it every time you can
    • integers (C: “int”)
      • shorts, longs
      • if you can stick with integers, do! otherwise it’s a big mess
    • floating points/floats
      • decimals are infinite! (and therefore can get very messy)
  • character types (C: “char”)
    • strings = a string of characters/a blip of text
      • in C, there’s support for how you can make your own strings, but it’s not it’s own type like it is in C++
        • one way: make an array of letters
        • a bunch of things stored in your memory, accessed thru pointers telling your computer where in the memory to look for that piece of data
        • can use functions like “printf”
  • pointer types
    • every type of data is really just a position on the memory that your computer is accessing
    • the computer does not hold anything in its hands – it goes line by line and accesses the memory
    • even RAM is used in the same way, where the computer has to call it up from memory to access it, but it’s just a smaller amount and therefore easier/faster for the computer to get through it
    • pointers tell the computer where to look in the memory


  • basic, native functions
    • aka the actual building blocks
      • examples: +, int, return, true, const char, etc. (everything pink in Xcode)
      • “int” locates, sets up memory space that’s the right size to store integers
  • library/included functions
    • a group of other people’s functions (built off native functions)
    • problem could be that I don’t know how it works, since someone else made it
      • documentation (description, examples, source code) or testing can help
  • custom functions
    • my own (also built off native functions)
  • functions work with data
    • functions that work with integers only, for example
  • 3 things functions do:
    • input data into the function from the code (either actual user input I type in and can see or from variables I’ve set up with some stored memory of some data) = parameters
      • a function can have no parameters, many (a lot of things to input), etc.
    • output data into the code = return
      • for example, if I am using the function “+” and I input the data (3, 3) the output will be (6)
        • if I set a variable y = 3+3, then y will have a value of 6 anywhere it appears in my code
      • a function can only have one return -> need many returns? use multiple functions
      • the “return” function helps other functions return
    • do
      • changing a pixel in a game, putting a command prompt on the screen, making a sound
      • many functions could come first and pass data around before you ever come to a “do” that the user can see
      • can be a do function just on its own, for example “delay” that makes the program wait
      • code pointer movement functions, just moving code pointers around, like “if” “then” “loop” etc. are do
      • you can’t program a functionality – every function with a “do” is native
    • some functions will do all 3, many will have parameters and then do something or give a return
    • syntax of a function: name (parameters)
    • most of the time, my functions will call other functions – functions inside functions
      • subdividing functions into smaller little pieces is useful because then I can reuse them other places – allows for flexibility & allows me to work on smaller tasks at a time for more gratification/feeling of progress
    • when you use a function, it’s a “call
    • before you ever use it, you need to define a function (tell the computer what to do)


  • there’ll be many custom things I’ll make – functions, variables, arrays & structs of different types
    • variables = holding data directly
    • arrays = bunch of different data each with a number to identify it
    • structs = multiple pieces of data held in a single location (using different sub-names to access them within that location)
  • start by declaring (its type), then space and the name of the variable
    • ex: “int variable_name”

Today’s resources:

A 4-hour FaceTime with my older brother.


viking school’s “How a Website is Built” notes

An example workflow to make a simple blog for a group of 3 friends.

The workflow =

discuss user needs with the client ->

build a mockup & check with client for satisfaction ->

break the mockup into bite-sized stories

story by story, do the following:

->-> determine, set up data architecture

 ->-> build back end

->-> build front end

-> refactor (restructure existing code w/out changing its external behavior), iterate (repeat) & ship (will learn more about this later) site to production

  • he uses Balsamiq to create mockups
  • when creating a story, think about who, what and why
  • in our example, we have 3 stories:
    • As an [author], I want to [publish posts on the site] so that I can [put my thoughts on the web]
    • As a [reader], I want to [easily view the most recent posts] so that I can [stay up to date]
    • As a [reader], I want to [write a comment on that post] so that I can [offer my thoughts on a post]
  • next step is to prioritize which stories to tackle first
  • he uses PivotalTracker to track stories/his progress
  • once selected the story to work on, determine data needs
    • on a whiteboard, pencil/paper etc. – diagram out what you’re going to have to work thru to start planning how you’ll implement it
  • work thru backend->frontend
  • check site/debug throughout
  • refactor (he says his code isn’t good and should be cleaned up – I’m curious as to what this actually means)
  • present to client