News for hackers. Stuff that matters.
Re:Simple Ways of Reducing the Cognitive Load in Code by larschdk on Tuesday June 28, 2016 @07:40AM (#11992878)
Shared state between different parts of the code sounds an awful lot like something that could be a class.
Re:Simple Ways of Reducing the Cognitive Load in Code by alisey on Tuesday June 28, 2016 @08:11AM (#11993039)
Yes, a Method Object pattern http://c2.com/cgi/wiki?MethodObject
Re:Simple Ways of Reducing the Cognitive Load in Code by throwanem on Tuesday June 28, 2016 @11:37AM (#11994587)
Neat! Now I have to refer to an entirely different file (or a different section of this one, which is almost as bad) in order to figure out what this one function is doing.
Re:Simple Ways of Reducing the Cognitive Load in Code by amirouche on Tuesday June 28, 2016 @01:53PM (#11995902)
maybe both are related.

I never understood people that create a function only to set a flag or a set of flags in another and pass everything else.

Also sometime doing code that looks like this

> > if a: > getting_started(d,e) > if a and c: > maybe_prepare(f,g) > common(d,e,f,g) >

Instead of

> > getting_started(a,b,c,d,e) > maybe_prepare(a,b,c,d,e) > common(a,b,c,d,e) >

Usually I leave branching for the leaf code. It's maybe just me.