Skip to main content

Study, Day 2

Just did the MIT course all day today, because my next problem set is due tonight and I did not want to fall behind again.
Got distracted a bit, but a lot less than yesterday with the way Nikola renders headers, and youtube videos of sausage making :P
Now that I am going through the class, I realise programming is not what I imagined.
It is at once, much simpler and a bit more complex than I thought it to be.
More than that, I realise I can do this. :)

The day isn’t over yet. Will attempt to solve the problem set at night.

French

  • Did a review session
  • Made 25 flashcards

MITx, 6.00.1x, Introduction to Computer Science and Programming Using Python

  • Good programming
    • More code is not necessarily a good thing
    • A good measure is the amount of functionality, the utility, your program provides
  • The notion of abstraction
    • like a thing you know how to use.
    • the details of how it is internally are irrelevant to you
    • the box provides utility and you know how to use the controls to get what you want. that is all that matters.
    • like a phone. or a tv. or a scooter.
  • The notion of decomposition
    • i can take all those dumb black boxes that I know how to use
    • and mcgyver them together to do something I want.
    • use independent pieces of codey things that each do something and then glue them all together to get the program I want
    • or to invert, can i break my big problem down into small independent pieces that I can write, or use other folks’, that I can stitch into my own little frankenstein?
  • Decomposable Code, divide code into modules that
    • are self contained
    • are reusable
    • keeps you and the code organised
    • keeps things coherent
    • can be done with functions or classes
  • Abstractable Code, build a black box that
    • cannot see details
    • does not need to see details
    • does not want to see details
    • hides the gory details from you. or just the fact that your magical thing is made of small boring pieces :)
    • can be done with function specifications or docstrings
  • One new aspect of functions I learnt was that they have specifications.
    • Thinking back, it’s a well, duh! point, but I’m glad I learnt it explicitly.
    • there’s a contract between me, the author of the function, and its users
    • there’s a set of assumptions that the function has. this is what I expect, this is what I want, these are the values you need to pass, this is what the environment needs to look like, what is the phase of the moon?, yadda, yadda
    • and if those assumptions are met, there are guarantees I can make about the output.
      • pass these numbers in, in this sequence, and you will always get this output. put the dough in the oven, when the new moon is rising, and you will always get delicious pizza
    • in python, a docstring documents what the function assumes and guarantees. good programmers do this to help other folk using the function and to save their own future dumb selves
  • I learnt recursion
    • from what i understand, this means that i take something i know and then use it to repeatedly tackle a complicated problem, if said problem, lends itself to being broken down that way.
    • break it down until i reach a step where i know i can do all of the operations on my own.
    • multiplication is a good example.
      • I know that if when a*b when b is 1 is just a.
      • so I can write a function that keeps adding a to itself while decrementing b until b reaches one and et voilà, that value of a is my answer
      • I got that backwards. I know that i need to repeatedly add until b is 1. so i just keep adding a to a function that just asks if the value of b is 1. if not just add a to that same function where the else states that I reduce b by 1. when b is 1, i just return a which will be the first of the added as and the function then begins looping outwards and backwards adding a. I realise I have horribly explained it, but it’s somehow more intuitive and more elegant to my mind and fun to watch, so I’ll let Professor Grimson do it much better than I can
      • I still don’t totally get it, but I get that this is cool and makes tackling hard problems easier. Hopfully more understanding will come with time.

P.S. A note to student planet readers, if you miss some posts in that feed, check the site to see if I wrote anything (or manually subscribe to the main feed.) I might be uncomfortable pushing certain language or frustrations of mine to other learners at large.