basics of higher-level software programming languages

basics of higher-level software programming languages

Notes:

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:

  1. comments

  2. data

  3. functions

  4. variables/names

comments

  • 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.)

data

  • 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

functions

  • 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)

variables

  • 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.

Advertisements
more more more

more more more

Getting right back to it:

Phishing is when someone masquerades as someone else (often with a fake website) to trick people into sharing their personal information.

Malware = malicious software (usually installed without your knowledge). Malware can be in the form of software masquerading as good (like an anti-virus program that’s really a virus) or it can install itself without asking because of some site you visited. Once on your computer, malware can access your data and files and do whatever with them. Eek!

URL = uniform resource locator, consisting of the protocol (like “http://&#8221;), the domain (like “google.com”) and the path (like “/internet.html”)

◊ The web = the part of the Internet that uses HTTP (hypertext transfer protocol). Which leads me to ask – what are the other parts of the Internet and what are they used for?

◊ A website = a collection of webpages (documents written in HTML) on the same domain.

◊ A browser = a program that can open webpages and display them (by interpreting the source code).

◊ Basically, everything that an everyday user interacts with is a program. 知らなかったよ。

◊ Again, take this as you will (it’s coming from a complete beginner), but I did not previously know that you can “inspect”, aka see the HTML code, of basically any website you’re on. That’s cray-cray!

◊ And one point from actual coding I did (ha): In CSS, classes are marked with a “.” and ids are marked with a “#”. Both of them are more specific than the generic element styling (body, p, h1, h2, li, etc.). However, the rule is only 1 id per page – unlike classes, which you can add to as many elements as you like.

Today’s resources:

https://bento.io/topic/web

https://www.youtube.com/channel/UCVTlvUkGslCV_h-nSAId8Sw (LearnCode.academy’s YouTube channel)

While I’m by no means making crazy leaps and bounds here in my understanding of HTML and CSS, I am starting to wonder why I don’t just try building my own blog layout. Like, from scratch. Instead of this template.

HTML Thoughts

HTML Thoughts

I have to say – the thing I’m learning about computers in all this “let’s coding” business is that if you know what you’re doing, you can really make them work for you. It’s like having a fancy washing machine but not really knowing how to use it. Sure, you’ll put in loads rather than doing them by hand, but you make do with the basics and never get to enjoy all the options that are at your disposal. Maybe you have a bunch of delicates that get put on the same spin cycle as everything else because you just didn’t know that there’s a button to push that changes the settings especially for delicates. (I’m this person, metaphorically with regards to computers and also literally – but that’s because my washing machine’s buttons are all in Japanese. Who knows what I’m missing there…)

As I continue to journey on this mission of mine to learn how to code, I look forward to understanding more of what’s available to me. So many people have gone before me, and there’s so much to learn.

Screen Shot 2017-06-21 at 10.05.12 PM
A silly thing I coded today, using Gimp for the first time to create this glorious background image