News for hackers. Stuff that matters.
Re:Functional Programming in C++ (2013) by S4M on Saturday July 25, 2015 @06:16PM (#9949250)
What convinced me that avoiding mutations as much as possible was having to deal with code like that (in java):

    public class MyBigClass() {
        private int a;
        private int b;

        //hundreds of lines of code

        private int calculateSomething() {
            //do something
            a = a+1;
            return b*b;
        }

        //hundreds lines of code

        private int calculateSomethingElse() {
            int c = calculateSomething();
            return a+c;
        }

        //hundreds of lines of code
        public returnSomething() {
            return calculateSomethingElse();
        } 
    }
In this example. It's hard because you have to remember constantly which functions are changing your classes before you use them, and if you haven't written the functions, it's very easy to introduce a bug by involuntarily modify the states using the function calculateSomething, just wanting its output and not the modification of a.
Re:Functional Programming in C++ (2013) by pekk on Sunday July 26, 2015 @11:01PM (#9953118)
That demonstrates some design flaws of Java, yeah, because your "private" variables are effectively just globals anyway.

The guy who is not using encapsulation at all this year will be making similar mistakes (massively long bodies, proliferation of unnecessary entities, etc.) if he switches to functional programming next year. It's not a panacea.

I'm afraid this doesn't demonstrate that any tiny bit of statefulness is "exhausting."