DEV Community

Alex Riviere
Alex Riviere

Posted on • Originally published at alex.party on

If You Give a Function a Function...

So Cassie Evans tweeted this the other day:

Frameworks obfuscate away & front-end dev spans so many specialities.

When there's a 'discussion' on here it's common to see folks say 'learn the web platform'.

Got me thinking.

What's the most useful thing you've learnt about the web platform for YOUR area of expertise?

— CSS Evils 😈 !important (@cassiecodes) October 26, 2022

This got me thinking about a thing that it literally took me YEARS to understand (and frankly severely hampered my coding skills during that period.) And when I say years, I don't mean like 1 or 2 years. I started learning BASIC and HTML/CSS around 2000, and have been on and off developing since then. So by years, i mean about 15+ years.

The thing about functions...

So the thing I never learned is that a function isn't some magic thing. Most languages allow you to pass functions around. As arguments. To other functions. This may seem obvious to others, but seriously, I did not understand this concept. Because I didn't understand this, GUI programming was impossible. JavaScript event handling was not understandable. Certain parts of WordPress were incomprehensible.

I remember trying to learn to use PyGTK, and never being able to do much with it.

One day though, I think I was reading some JavaScript code at my first professional programming job, and I suddenly realized you could pass a function as an argument. SO MANY THINGS CLICKED FOR ME. All at once, the ability to use a bunch of libraries that I could not understand before became open to me and it completely revolutionized how i think about things.

So, for all you new to development, understand this: You can pass a function as an argument to another function.

Thank you.

Originally Posted as If You Give a Function a Function... at alex.party

Top comments (0)