HACKER Q&A
📣 LaundroMat

How can I learn to think more like a programmer?


While I was reading "Eloquent JavaScript", I came across this absolute eye-opener (to me at least):

https://eloquentjavascript.net/07_robot.html#p_MtO6TwqB5I

In this chapter the author demonstrates that it is wrong to solve a problem by creating a series of objects that do stuff. He shows that the right way is by abstracting the problem into its most essential elements. Do not try to emulate reality with code, but make it its own, abstract thing that solves the issue instead.

This chapter and its code felt like pure poetry to me.

I very much want to train myself into thinking like this. I've been an amateur coder for more than 20 years, and this chapter has finally shown me a path for growth in abstract thinking (and not in becoming more proficient in a language or framework, which has been the larger part of my programming related learning all these years).

Also, I have always been more of a systems kind of thinker (interconnected things modifying each other's behaviours, emergent behaviour as a result), but I am convinced that what is demonstrated in the chapter I linked to is another type of thinking that would also be very beneficial to me outside of programming.

Sorry for the rambling, but I'm a bit hyped.

So my question is this: is there a name for this kind of thinking and how I can learn to start thinking like that?


  👤 eat_veggies Accepted Answer ✓
It seems like the author is applying some ideas from functional programming -- that is, don't keep objects and mutable state around like you're building an ugly facsimile of reality, but rather think about programs as flows and compositions of pure functions.

Chapter 5, "Higher-Order Functions" in the EJS book used to be called "Functional Programming" in an older edition [0], and it does a great job of highlighting the main attraction of FP without explicitly naming it as such.

I've heard really nice things about the Mostly Adequate Guide to Functional Programming [1], and the Structure and Interpretation of Computer Programs is a classic [2] for teaching you how to think in this new way.

[0] https://eloquentjavascript.net/1st_edition/chapter6.html

[1] https://mostly-adequate.gitbooks.io/mostly-adequate-guide/

[2] https://mitpress.mit.edu/sites/default/files/sicp/index.html