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
- Pick a data set
- Document it
- Explore it-analyse what it’s saying
- Describe it-histograms and what not you know
- Join them to one another-compare
- Find amazing insights
- 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
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)
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
look out for these simple refactoring methods when writing your code:
- repetition (there’s probably a function for that)
- inappropriate naming (i’m looking at you “variable 1", “variable 2” etc.)
- bloated functions (hit the treadmill, do one or a clear logical set of things)
- unnecessarily complicated code (guys it doesn’t take Einstein to print out text)
- avoid large pages (maybe try putting a little line break here and there)
- 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:
again, if you forgot, that’s:
one more time just to make sure it’s:
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……………………………
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: