Give me a sheet of paper and something to write with, and I'll turn the world upside down — NietzscheProgrammingJul 2021
I’ve had a somewhat liberating epiphany recently: The methods built-in to a programming language can also be written using simple procedures like if-else statements and loops. Built-in methods exist to bundle complicated procedures into one simple function — this makes programming easier. But they are also simply solutions to common problems, so a programmer doesn’t have to program them over and over again.
In design, there are thousands of nuts and bolts to every tool. Sketch and Figma are full of smart details meant to make a designer’s life easier. But I also know, by virtue of my experience, that all I need is a blank canvas, the rectangle tool, type and color. Not to be overly simplistic, but even that could be reduced to a sheet of paper and a pen.
Tools are helpful, but the work happens in thinking about and experimenting on a problem enough that eventually a solution starts to emerge — despite the tool. My crazy insight is that programming seems to be the same.
Splice is a robust method. With one single line of code, I can shorten an array, remove items at specific index positions, or even insert multiple new items at a location. It works in place and therefore on the array itself.
In my own version of splice, I built a couple of smaller methods that perform all the major procedures like shorten an array, delete an item(s) at a particular location, and insert as many elements as passed onto the function sequentially into the array.
A method to shorten the array
Methods to delete an item(s)
A method to insert an item(s)
All in all, lot’s to learn – but that was fun.