6 ms·
Grokking Simplicity: Taming complex software with functional thinking
- turtleyacht 3y agoIt's strange. Most of the site displays fine on mobile except this link. I know we're not supposed to comment on it. However, the left side of the readable content is truncated, so I do not know what word or words start each sentence.
- bagerbach 3y agoGlad you did, thank you! Just pushed a fix. Should look fine on mobile now.
- bagerbach 3y agoThank you for sharing my notes!
- nine_k 3y agoA good headline. It's important to remind that one should keep on improving their thinking to be a good engineer. All the techniques are secondary to the conceptual toolbox of your mind.
- adamkl 3y agoIf you like these notes, you should read the (very good) book: https://www.manning.com/books/grokking-simplicity https://www.manning.com/books/grokking-simplicity
- ngai_aku 3y agoI know this isn’t a very substantive comment, but I’d just like to second the recommendation! I really enjoyed the book too
- Buttons840 3y agoThirded. I also like Grokking Deep Reinforcement Learning a lot. OReilly's Grokking series is 2 for 2 for me. For those who don't know, OReilly stopped selling DRM free PDFs directly, but they still sell DRM free PDFs through other sources like ebooks.com, which I appreciate.
- alexott 3y agoGrokking series is from Manning and do they sell PDF and ePub/mobi directly
- Buttons840 3y agoYou're right. I got mixed up. Manning has turned into a quality publisher as well IMO.
- tomjen3 3y agoAs a book reader, I always value recommendations, but you could choose to improve your comment by stating what made you like the book.
- lincpa 3y ago[dead]
- drunkan 3y agoI too find Reactive Programming appealing and have successfully used RxJS as you mention to build a fully reactive app - every action and data change can be observed and reacted to - its a fantastic library and it makes TS really powerful IMO (not to say other languages don't have this, just a powerful addition to an already versatile language). With TS and RxJS I really like to do all the plumbing and housing a little more classically with some container classes that I call services who house and expose RxJS observables with an init() and a destroy() function where a service needs to manage its own subscriptions. So classes "services" group observables and there functionality, RxJS observables are the "plumbing" of the app, piping data around via events and then all the logic is in pure functions. I find programming like this leads to a clear data/event flow and neat seperation of concerns.
- egberts1 3y agoThat is how I exactly mastered Firefox and Chrome project code base ... from scratch.
- charlieflowers 3y agoHow? Are you saying the Firefox and Chrome code bases are largely based on pure functions?
- amw-zero 3y ago> & aims to avoid side effects by using pure functions I think this has always been an incorrect framing. Functional programming does not _avoid_ side effects purposefully. It simply doesn't have them without explicitly modeling state, because it's based on math and logic which are stateless at their foundation. That's it. We only bring up state because of how closely all of our languages are tied to stateful CPU designs - and for good reason btw, seeing as that's how all of our processors have been designed for all of the history of modern computing. Said another way, functional programming doesn't try to do anything, it simply computes in a different way.
- pharmakom 3y agoImperative programming: write instructions for the computer to follow. Functional Programming: model the instructions that you want the computer to follow. Subtle difference. A model can be manipulated by other code in interesting ways.
- danmaz74 3y ago> We only bring up state because of how closely all of our languages are tied to stateful CPU designs I would rather say that we bring up state because almost all practical applications of computers have state to manage - to be honest, I can't think of many which don't have state.
- _a_a_a_ 3y agoI'm getting seriously pissed off with articles like this. There is inadequate discussion of the real cost... > Okay, so let's address the elephant in the room: performance. Yes. Immutable data structures do use more memory, and they are slower to operate on. However, they are fast enough ...and are presented in a way that gives the impression to people with not enough experience that this kind of thing is "the future of programming". Which then gets parroted back on HN by people who can't justify it – it's something they've read and they're sure it's true. The problem I'm complaining about is not functional programming or anything else, but a people problem. IME that's where the problem is in programming, and functional programming is just as prone to being abused as any other kind. Functional programming is not "fast enough". It can be and usually is, in my personal project I'm quite happy to waste memory and thrash the TLB and cache and whatever else to get the job done, but in other cases it's not and that needs to be understood. I've seen a commercial project brought to its knees by going all-in on functional programming done badly (the aforementioned people problem). I'm going to say this really loudly: don't absorb articles like this and spout them back. They provide easy solutions that are often correct but sometimes very incorrect where it matters, or completely ignore – yet again – the people problem. I have a lot of experience and I keep reading on HN that "functional programming is the right way" or that "you don't do that in SQL" but these people with the strongest opinions seem least able to back up their claims. Programming is fundamentally a people problem and that fundamentally is where I've seen most of the problems come from. Functional programming/object-oriented programming/procedural programming... These are all good in the right place. They can all be abused. They can all be combined. They all have costs and benefits. Don't write them off, And equally, don't treat them as 'the solution', because they are tools, and will only ever be tools to be used in the right place, and that takes judgement. End of rant.
- augustk 3y agoFunctional versus imperative programming is a bit like socialism versus liberalism; the best solution is probably a combination of both.
- Silhouette 3y agoDid you realise that this article is the author's notes on someone's else's book? Have you read that book? Does either actually take the absolute positions you appear to be criticising here? I didn't get that sense from them personally - more that the book presents some ideas that come from the mindset of functional programming and can be useful elsewhere as well - but YMMV.
- augustk 3y agoAmong non-pure functions I can think of two interesting subclasses: 1. A functions with no side effects which (possibly) returns different values each time it's called, for instance a function which reads a global variable and returns its value 2. A function with side effects while running but which leaves the state of the program and its environment unaltered once it has returned, for instance a function which displays a dialog window and returns when the user clicks a button in it. Are there any names for these classes of functions?
- Leftium 3y agoI think both #1 and #2 have side effects (interactions with external mutable state.) 1. The side effect here is an input, and affects the output value of the function. 2. The side effect here is an output (or "action"). Displaying a dialog window mutated something in the external state of the program. Technically, I think "side effects" are undesired interactions. So #2 might just be an "effect" since it is presumably desired. So maybe: 1. Side effect 2. Effect
- Graziano_M 3y agoAs a fun bit of trivia, the (book) author's brother is a well-known (and hilarious) stand up comedian.