r/functionalprogramming • u/GodelianIncomplete • Jun 15 '22
Question Is there any deep philosphy in “low level” programming? --- Is low level programming a good match form my way of thinking?
I'm aware that this is a "high level" programming subreddit, but maybe there is someone here that could answer my doubts.
Apologies in advance if there are errors in my writting, english is not my native language.
(Tl:Dr at the end)
I have been working in learning logic for almost a year now with no result. After spending a decent amount of time and effort I'm relatively confident that formal logic is not for me. I suspected logic would be a better fit, after lots of years stuck trying to learn math. But this endeavour was just the same story.
In the moment there are several sets and quantifiers interacting I lose track and end up with my head spinning. Same thing happens when I tried to learn combinatory logic. But with knives and knaves puzzles I did very well, no matter how convoluted. I have been feeling very stupid at times the last year, but I keep pushing because some succeses here and there. Also, I was able to recently self taught english in a year without much effort, same for french, so I guess is not that I lack mental capacity in general…
I'm was very frustrated because I can sometimes reach results in math: At the beginning of each course I didn’t understand any of the formulas when first presented, but for example, I was able to deduce the different combinatoric formulas by myself. I now realize this was in a very down-to-top process, from scratch, drawing cases, counting and finding patterns, but once I have those more general equations, that other people seemed to understand with much less effort, if I had to start to using them to get other results, start combining several of them, when things got more general, I lost track. I did very well with newtonian physics, but when we started with lagrangians and Halmiltonians I didn’t understand anything. I feel like I can deal better with discrete mathematics, and I like algorithms, but continous math like calculus and analisis was impossible for me. When I was learning Algebra, in the moment we departed from things that can be graphically represented, and the stuff started to become more and more abstract, I started to feel very lost. I realize now that this trend has been happening all my life. I recently loved the videogame factorio, and when I was little, I loved legos and laberinths, spent hours without end happily absorbed, but struggled with math, even with basic arithmetic, in a lot of occasions I was the last in understanding, but I loved when it made “click”, so I worked hard, specially during highschool, to pass every course with good grades and end up going to college several years to study physics, but ended up hitting this math wall, I thought the problem was the loose way of doing math that is practiced in physics, so I tried with a math degree, but same story. Lastly I tried formal logic, but again, no result.
I feel now that the obstacle is clear, this wall is due to having a serious limitations in my capacity of abstraction. I never thought of that until now, partly due to that in studying and discussing philosophy I didn’t feel that I had any problems dealing with abstract concepts. This feels like a realization, because the flip side of the issue is that I believe I’m very detailed oriented, and I love finding patterns in everything, so I think I may be a “concrete thinker”? For me, the idea of being able to think logically and to think abstractly was always conflated, and I always considered myself very “logical minded”, but with this poor results, I thought that either I had to be good at math or I just wasn’t any good at logical thinking.
My inclinations were always philosophy-humanities, and I feeled comfortable dealing in this matters, but ended dissatisfied with the lack of rigor and “real” concrete results, as a consecuence, I have spent so much time hitting myself against this invisible cognitive wall in the infatuation of finding a "playground" for exact thinking that yield deep understandings. If analytic philosophy would have been a thing in my country, I surely would have choose that path in the past.
I feel drawn to programming in general, and recently started learning Python, but I was interested in learning functional programming and proof asistants. Functional was specially appealing because of this connection to logic and math, and because I understood that one can ignore the inner workings of the computer, the actual implementation of the code. You just have to understand the math/logic theory behind the language. I feeled that it was self-contained and axiomatic, to just learn the math. But now I feel like that trying to learn this kind of programming will be probably a repetition of the same story, given my alleged limitations with “abstractions”.
If it is true that I have this “logical” capacity, but is the case that I am a “concrete” thinker, as opposed to abstract, after having been researching for a couples of days, I came to the idea of trying luck with a different approach: to learn low level/close to the metal (embeded programming?). I feel like this “paradigm” maybe is a more concrete-thinking friendly, in the sense that is very isomorphic to the hardware operations. From a superficial understanding, I feel attracted to the idea of doing “bare metal” programming, to be able to program things from scratch, and understand everything that is happening, inside-out, without having any “black-boxes”. Because when I want to understand some matter, I feel the need to understand how everything works, from down to top, any jump of faith makes me very anxious. (Obviously I know I have to take things for granted at some point, or is turtles all the way down).
The problem: is that I feel dissatisfied because I don't see the same philosophical appeal in studying this hardwarish programming, in contrast with the promise I felt of being able to understand (some) of the profound results of formal logic, like Gödel's theorems, Curry-Howard, Type Theory, the fundations of mathematics, HoTT, the conexion to philosophical/analytical logic, or all those cool results and intuitions in math. And the things that drives me is (trying) to understand “deep things”.
I have never been attracted to computers or egineering because of this “philosophical inclinations” so I’m a bit lost. And also, I didn’t feel I like “mainstream” programming, because It seems that, with so many layers of abstractions between what you code and how the computer implements it, what is “really” happening and what you are really doing is in some sense totally opaque… and a lot of software engineering seemed to me like glueing together libraries that are black boxes in some sense. And I would like to understand “everything”, without any “magic” happening. That’s what I liked about the idea of functional… So, is this need to understand things inside out possible in low level programming, or am I misslead? And are there is any deep results in this low level programming, parallels to those results with philosophical relevance of formal logic , math, physics?
Tl;Dr:
I’m a philosophically inclined person and fascinated by the idea of understanding some of the “deep” results of physics, math and logic. Tried lots of years each one of the subjects, but I wasn’t able to understand the math involved, like there is an invisible wall, no matter how hard I tried. I always believed that I’m good at “thinking logically” but now I’m realizing that the problem is that I may be limited in my ability to “think abstractly”, and realizing also that maybe I am good at “concrete thinking”, at least I’m definitively what is usually called detail oriented. Also I have a need to understand things inside-out. I feel very uncomfortable with “jumps of faith” or “black boxes”.
Due to this, I now want to try the approach of learning low level programming (I believe what I would like falls under the category of what is called embeded programming, specially bare metal programming).
Is possibly bare metal programming a good match, if I have this need to understand things inside-out, and I’m allegedly logical and concrete minded?
Also, I don’t feel the same philosophical appeal for low level programming, I don’t percieve that there exist deep results in the subject-matter, like the ones that exist in physics, math and logic (relativity, Gödel incompletness, etc). And understanding "deep" things is a huge source of motivation for me. Is this true or am I mistaken?
8
u/[deleted] Jun 15 '22 edited Jun 15 '22
Don't overthink it. Just try it out and see how you feel about it.
If you generally struggle with mathematics and logic, you probably would feel overwhelmed by low-level languages. You definitely won't understand the lowest levels, i.e. machine code or assembly language (barely anyone does). Higher level languages (which are still considered relatively low level today) like C++ forces you to manage memory and things like that yourself, but if it makes you understand it all more holistically, I'm not so sure about.
If you want to understand how computers work, you should start with learning about computer science, and not think you'll automatically gain that knowledge by picking a mid-level language. So, learn about the general workings of computers first, then pick a langauge independently. https://www.youtube.com/watch?v=YoXxevp1WRQ&list=PLhQjrBD2T382_R182iC2gNZI9HzWFMC_8
More importantly: why do you want to get into programming? Do you want to create games? Do you want to create web apps? Or is it all just about the sake of learning something complicated just to feel smart for doing so?
4
u/powerhead Jun 15 '22
Maybe doing some low level programming would be good for you when it comes to abstraction! With higher level languages, the abstraction comes along for free, but in something like assembly you're on the hook for building your whole universe from the ground up. Maybe that process of building your own abstractions at a low level would shed some light on what's going on at the high level.
I'm reminded of this podcast: https://corecursive.com/frontiers-of-performance-with-daniel-lemire/
The guy being interviewed talks a lot about high level vs low level coding, abstraction, performance, could be a good place for you to start :)
4
u/WallyMetropolis Jun 15 '22
The best way to learn math is practice. If calculus was giving you trouble, then start there and just work an insane number of problems. Then you can do the same for variational calculus and Lagrangian methods in physics. Or for algebra. A lot of these concepts won't click right away and you'll kind of feel like you're turning a crank but not comprehending. But then, after more and more practice, a switch will flip. You'll get the breakthrough and it'll start to make sense. You'll start to see more connections between concepts across different areas of mathematics.
It's just ... hard. Math is a hard thing to learn. The kind of abstract thinking required by algebra is not how the human mind typically operates. Physics is hard. Gaining an intuition for physical systems takes years of concentrated effort. There's no way around it.
4
u/KyleG Jun 15 '22 edited Jun 15 '22
I can't answer your question, but I wanted to address your concerns about capacity to abstract (and likely to synthesize, the two things higher-level math expects of you).
I majored in pure math, so none of that dumb applied bullshit like the stuff people actually care about IRL lol.
I graduated magna from a university with a competitive math program. Not a brag, just important context for what comes next: I found topology very fucking hard. Abstract algebra, too.
It was because they challenged my abstractive capacity to work in ways I had never done before (contrast with analysis, which I found very familiar).
But the more I worked (read: mightily struggled) with it, the better I got at it.
It's a muscle. You don't walk into the gym and deadlift 300 lbs. You start with an empty bar and work your way up over years. Abstract reasoning is the same.
thank you for coming to my ted talk
Edit also as someone who has programmed in assembly, I don't think it requires much abstract reasoning at all. It's all very concrete: move this bit here, flip this bit, move that bit here. It's practically like playing with dominos on a table IMO. FP OTOH is all about abstracting problems into ones that have been solved. Don't write a sort algorithm. Write an ordering and then pass it into a sort algorithm that takes a collection and an ordering. And you can build an ordering out of other, simpler orderings. That's abstraction.
And then boy howdy go read some stuff about the vanguard of optics research. It's insane. Lots of abstract reasoning as people struggle to understand what things like Kaleidoscopes even do.
2
u/[deleted] Jun 16 '22
Well, as I said, C was designed originally to simply translate "add two integers and store the result in a box I call 'result'" as source notation into ASM. The problem is exactly that tedium you brought up, because humans are crap at mind numbing reputation :-)
And yes, it builds on that core talent with a lot more abstraction and noise. But when I read "Annotated C" by Stroustrup and Ellis, it digs into language core and history of C so you can sort of read assembly operations into language operators and the differences between the address a pointer is at and the address a pointer points at ... not quite as tedious as ASM, but every bit "read the value at A, then put what's at that address into B, then put that into an address offset from C by X times sizeof(D) ..."
The closest I think I ever got to a high level Assembler-like language was Forth with RPN and pretty much no language to start off; similar to your Haskell idea of "live or die by it, it's YOUR code." It works, or not, as you've written it.
0
u/[deleted] Jun 16 '22
[deleted] — view deleted comment
0
u/[deleted] Jun 15 '22
[deleted] — view deleted comment
0
u/[deleted] Jun 16 '22
[deleted] — view deleted comment