CODE 1161, Week 5-First assignment down, second to come and recursion is a thing

Great , there is another project coming up…(╯°□°)╯︵ ┻━┻
(I just joke) ┬──┬ ノ( ゜-゜ノ)

Open Data Project

  1. Pick a data set
  2. Document it
  3. Explore it-analyse what it’s saying
  4. Describe it-histograms and what not you know
  5. Join them to one another-compare
  6. Find amazing insights
  7. Visualise the data-communication, maplot.lib

so we all have that to look forward to…more on that as things progress

IO-in and out and in and out

funny story in the lecture all I wrote down was:
“r”-reading mode, “w”-writing mode, this is for when you are appending documents in your coding.

but alas there is far more to it than that

writing and reading (sorry Ben hope you don’t mind me ripping this from the lecture)

^?????
Correct me if i’m wrong but in the first image Ben is getting a “history book” (separate document) and much like a git push takes it, appends it, closes it and returns it to be used with the addition in future.

The second shows Ben gets a specific section of the document to be taken and merely read to then be placed to print along with a response (which in itself is originally written in the code)


Refactoring

As programmers we want to avoid technical debt (great first uni debt to worry about, now this), that is we want to make our code easy understandable and efficient as not to cause confusion, time wastage and all around angry stares and unflattering remarks towards the state of your personal character in the future.

But what are these technical debts you speak of and how to we avoid the technical debt collector?

Great thing you asked imaginary text, if you wright a poor piece of code that is shot out due to laziness in the short term but will be basically useless to you in the long term, well kiddo you just created technical debt, do this enough you will accumulate a huge interest that will explode in your face when you ever dare need that code again

technical debt, dates as far back to the first humans, probably even before them as well!

look out for these simple refactoring methods when writing your code:

  1. repetition (there’s probably a function for that)
  2. inappropriate naming (i’m looking at you “variable 1", “variable 2” etc.)
  3. bloated functions (hit the treadmill, do one or a clear logical set of things)
  4. unnecessarily complicated code (guys it doesn’t take Einstein to print out text)
  5. avoid large pages (maybe try putting a little line break here and there)
  6. lack of useful comments (just CTRL / that thing or “”” “””)

DRY-don’t forget it
but whats that even mean? you ask
Well have no fear, all you gotta do is:

D: don’t
R: repeat 
Y: yourself

again, if you forgot, that’s:

D: don’t
R: repeat 
Y: yourself

one more time just to make sure it’s:

D: don’t
R: repeat 
Y: yourself

hey you know what why don’t we just say it one more time…oh what no :( alright DON’TREPEATYOURSELF, HA got yah, bet you didn’t see that coming

but aside from my genius humour, always strive to be succinct in your writing, DRY is such a simple and easy to ensure your not adding up your tech debt


Recursion Recursion Recursion

___ → __^__ →__^__<^>__^__ etc.

don’t get this muddled up with repetition

I highly recommend watching the squiggle video on recursion Ben linked us in notion parallax lecture 5.

Recursion repeats upon a function but with each successive go, more is added in way like multiplying itself then multiplying its new self, achieving exponential growth

Think 1, 2, 4, 8, 16, 32, 64, 128, 256 as an example of what recursion can do

or how about something that goes within something that goes within something……………………………

my favourite xkcd on recursion
this is something cool Ben showed us

from starting point grows if surrounding pixels are similar/same in colour so that black spaces have far larger circles, recursion is each step the function takes from the starting point not quite repeating but growing

right now I’m still a little unsure of what recursion really is and it’s full potential outside of memes and weird gifs but I’ll look into it more and hopefully get back to you on that.

And here are some crudely drawn recursion doodles I did, in my old math textbook of course: