Devs.tw 是讓工程師寫筆記、網誌的平台。歡迎您隨手紀錄、寫作,方便日後搜尋!
when your compiler enforces immutability, there are less things to look for when something goes wrong. In addition, same when your compiler enforces types (statically).
Turns out no matter how hard we try, we cannot teach programmers to not to forget to release manually allocated memory. So GC was born.
In fact it is even more general trend: automation. Taking away as many manual tasks from humans as possible. Humans are the weakest link in the process. Ideally removing them completely is the final goal. But until we acheieve this the next best thing is to take away as many small tasks from humans and giving them to machines.
Another example is sql. When the decision on how to find the data was taken away from humans and given to software (sql server). Humans only tell what to find (using sql language). Move from imperative to declarative.
All these changes over the time fit one major direction: automation of programmers work. Squeezing out humans from lower levels to higher levels, leaving lower levels to machines that are much more trustworthy.
The next big fight is over the manual state management. This is what's happening right now with all the push towards immutable data. Basically humans are forbidden to change manually the global state, just how they were forbidden in the past to manually allocate memory (GC replaced them) and to manually write loops to find the data (sql replaced old pre-sql code)
This simply leads to a much better software (less bugs). The less humans do, the better the software is.