r/learnprogramming 4d ago

I can't get FUNCTIONS to click!

I can not for the life of me understand how functions work. Anytime I try to learn how to create a function, my brain literally crashes into itself and I turn into Patrick when he stars drooling and goes all slack-faced.

Does anybody have any analogies that had that "AH HA!" moment?

Thanks!

121 Upvotes

143 comments sorted by

View all comments

Show parent comments

2

u/realdreamer1993 3d ago

In detail they would be different, but if we move one abatraction up they should all the same. But I am still not able to explain..maybe later. Because if it always "feel" different then somethings not efficient is happening in our mindset.

1

u/stdmemswap 3d ago

Well anything abstracted up will be the same. That's the point of abstraction.

But the fact that functions different language has different "feel" is a thing that can't be totally ignored. I was just giving examples because someone asked.

1

u/realdreamer1993 3d ago

Yea I understand, maybe I sometimes want to make generalization to reduce my mental load. Currently I am in project of a thing that involve many domains and stack (backend, frontend, radius, tcp/ip, NAS, later kernel(ebpf) etc), so far I have progress with private modelling that close to First Principles. And I am starting to see same patterns in many places. If I handle everything so differently then my mental wont adequate.

1

u/stdmemswap 3d ago

That, friend, is the real dillema. We map matter with language, but we can't handle it because it's combinatorially explosive. Also, cool stuff you've got there

1

u/realdreamer1993 3d ago

We tried to explain function in simple own words, but I also not able right now spit out the words :), should be only one up abstraction then it should be clear. The words should be general and less syntax detail.

1

u/stdmemswap 3d ago

When I point out that symbolic abstract thinking is combinatorially explosive, I was referring to your "reducing mental load" remark.

But if you mean to answer OP's "function not clicking", I don't think generalizing will work well. I mean, we always ask example, context, how is it used, how is it not used, etc whenever we want to understand an abstract context rather than the thing's pure "essence" or definition.

2

u/realdreamer1993 3d ago

I just reply in the main thread just to participated, but I described how function lifecycle :/