Skip to content

Instantly share code, notes, and snippets.

@andrewsg
andrewsg / gist:ae9803a625d13016bb96
Last active August 26, 2016 19:55
Add'l notes for Programming as Communication talk

--- For instance, you'd think addition is dead simple, right? a + b = c. But in machine code, there's no platonic idea of a number; it's all just ones and zeroes in fixed-length slots in memory. Let's say your CPU register is 16 bits, of which the largest unsigned integer you can store is 65535 (2^16-1, the "-1" because of zero). If "a" is 60000 and "b" is 10000, then what is "c"? Ruby is smart enough to recognize that c will be too large for the CPU to handle in one 16-bit word, so it will break the problem up behind the scenes. It will correctly answer 70000. The logic to do all of the work behind the scenes to handle the conversion from one-word to multiple-word numbers and display the result as a single number involves the execution of thousands of lines of machine code. ---

--- There are three big downsides to using compilers as vs. writing machine code yourself:

One, compilers themselves tend to be slow to run, because they're so complex. So every time you change anything in your program,

@andrewsg
andrewsg / gist:e6c2298a8a9241a40964
Last active June 1, 2024 20:32
ADA talk on programming languages (notes for first half of lecture)

Programming as communication

Programming is about communication. It's communication between a human and a computer, but it's also communication between humans and other humans, and between humans and their own future selves. To program, you have to fully elucidate your ideas and record them so that both computers and humans can understand you.

Languages facilitate this kind of communication. Programming languages have to be designed with the computer in mind, but they should also be designed to accommodate humans.

Of course, using comments and out-of-code documentation, you can and should communicate to humans independently from your code. But the program code also needs to be its own documentation, both because actual code and its documentation frequently disagree and because sometimes program code is itself the most elegant way to express an idea.

Languages themselves are software, and they're made up of specificiations and implementations. Ideally, the specifications d

@andrewsg
andrewsg / gist:7536050
Last active April 13, 2016 00:53
ADA talk on programming languages (notes for second half of lecture)

Language taxonomy

Static analysis

  • Typed vs. untyped languages (just to introduce the concept of a type)
  • Static vs. dynamic type-checking
  • Implications for how objects are stored in memory (static type-checking implies objects are of a predictable size)
  • Duck typing
  • Implicit type conversions (JS) vs. strong typing (Ruby, Python)