In which I consider farm life

by sawadin

I have a plan. A very short term one, but a potentially very important and fulfilling one. If I do get into Hack Reactor, there will be at least a month-long gap (and more likely 3-6 months since I dragged my feet scheduling my second interview, and classes fill up fast) between now and when I actually begin classes above the pawn shop on Market Street. [There also used to be a mental health counseling and advocacy center on the floor below, but they moved out.] I hope to fill it with a stint at a farm on workaway.info. I’ve actually always wanted to live on a farm and learn about animal husbandry (and I’ll admit that spending time near livestock, herding dogs, and rural landscapes is deeply appealing). Food and lodging are free on workaways, and you can negotiate your hours and responsibilities, so I figure I can kill two birds with one stone while I take care of my HR prep-work. I love the idea of physical tasks by day and mental tasks by night. I love the idea of seeing stars and grass everyday after 3 years of their near total absence in Beijing. I want to experience actual exhaustion and hard work. Enforced, elegant simplicity.

 

I like simplicity, and this has helped me understand anonymous functions better recently. They make a lot of sense when you only intend to use a function once, especially when you intend to use it as a callback function. Why would you go to the trouble of coming up with and then remembering a name of a function that you are going to treat like a disposable plate? It makes no sense–especially when you are more of a words person and agonize over what to name each function. 

Here’s a short example of what I mean. Below is the long way to do it, without utilizing an anonymous function:

var wastefulFunction = function (x,y) {
console.log(“Like so many farts in the wind.”);
}

setInterval(wastefulFunction, 3000);
Above, I made a function just so that I could use it with setInterval. But let’s assume I didn’t use wastefulFunction anywhere else in my code. It would be better to just create an anonymous function directly inside of setInterval do this:
setInterval(function (x,y) {console.log(“Like so many farts in the wind.”)}, 5000);
The functionality is the same, but it’s shorter and uses up less memory on my part (if not the computer’s).

 

Advertisements