TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Grokking Simplicity: Taming complex software with functional thinking

154 pointsby jasimabout 2 years ago

10 comments

_a_a_a_about 2 years ago
I&#x27;m getting seriously pissed off with articles like this. There is inadequate discussion of the real cost...<p>&gt; Okay, so let&#x27;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<p>...and are presented in a way that gives the impression to people with not enough experience that this kind of thing is &quot;the future of programming&quot;. Which then gets parroted back on HN by people who can&#x27;t justify it – it&#x27;s something they&#x27;ve read and they&#x27;re sure it&#x27;s true.<p>The problem I&#x27;m complaining about is not functional programming or anything else, but a people problem. IME that&#x27;s where the problem is in programming, and functional programming is just as prone to being abused as any other kind.<p>Functional programming is not &quot;fast enough&quot;. It can be and usually is, in my personal project I&#x27;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&#x27;s not <i>and that needs to be understood</i>. I&#x27;ve seen a commercial project brought to its knees by going all-in on functional programming done badly (the aforementioned people problem).<p>I&#x27;m going to say this really loudly: don&#x27;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.<p>I have a lot of experience and I keep reading on HN that &quot;functional programming is the right way&quot; or that &quot;you don&#x27;t do that in SQL&quot; but these people with the strongest opinions seem least able to back up their claims.<p>Programming is fundamentally a people problem and that fundamentally is where I&#x27;ve seen most of the problems come from. Functional programming&#x2F;object-oriented programming&#x2F;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&#x27;t write them off, And equally, don&#x27;t treat them as &#x27;the solution&#x27;, because they are tools, and will only ever be tools to be used in the right place, and that takes judgement.<p>End of rant.
评论 #35771687 未加载
评论 #35771433 未加载
评论 #35776844 未加载
评论 #35771419 未加载
adamklabout 2 years ago
If you like these notes, you should read the (very good) book:<p><a href="https:&#x2F;&#x2F;www.manning.com&#x2F;books&#x2F;grokking-simplicity" rel="nofollow">https:&#x2F;&#x2F;www.manning.com&#x2F;books&#x2F;grokking-simplicity</a>
评论 #35769177 未加载
nine_kabout 2 years ago
A good headline. It&#x27;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.
augustkabout 2 years ago
Among non-pure functions I can think of two interesting subclasses:<p>1. A functions with no side effects which (possibly) returns different values each time it&#x27;s called, for instance a function which reads a global variable and returns its value<p>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.<p>Are there any names for these classes of functions?
评论 #35774955 未加载
bagerbachabout 2 years ago
Thank you for sharing my notes!
drunkanabout 2 years ago
I 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&#x27;t have this, just a powerful addition to an already versatile language).<p>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 &quot;services&quot; group observables and there functionality, RxJS observables are the &quot;plumbing&quot; 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&#x2F;event flow and neat seperation of concerns.
amw-zeroabout 2 years ago
&gt; &amp; aims to avoid side effects by using pure functions<p>I think this has always been an incorrect framing. Functional programming does not _avoid_ side effects purposefully. It simply doesn&#x27;t have them without explicitly modeling state, because it&#x27;s based on math and logic which are stateless at their foundation. That&#x27;s it.<p>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&#x27;s how all of our processors have been designed for all of the history of modern computing.<p>Said another way, functional programming doesn&#x27;t try to do anything, it simply computes in a different way.
评论 #35769415 未加载
评论 #35771586 未加载
turtleyachtabout 2 years ago
It&#x27;s strange. Most of the site displays fine on mobile except this link. I know we&#x27;re not supposed to comment on it.<p>However, the left side of the readable content is truncated, so I do not know what word or words start each sentence.
评论 #35766302 未加载
Graziano_Mabout 2 years ago
As a fun bit of trivia, the (book) author&#x27;s brother is a well-known (and hilarious) stand up comedian.
egberts1about 2 years ago
That is how I exactly mastered Firefox and Chrome project code base ... from scratch.
评论 #35786250 未加载