Hacker News new | past | comments | ask | show | jobs | submit login

> What do you suppose is the recommended way to use the encapsulation? ;) This is partly why there's a "defining global variables" section, I know people will will consider some usage as not using a global

What the post discusses can be distilled into the concept of Referential Transparency[0]:

  A linguistic construction is called referentially 
  transparent when for any expression built from it, 
  replacing a subexpression with another one that denotes the 
  same value[b] does not change the value of the expression.
Any construct which is not referentially transparent can be classified as potentially effectual, which is not a Bad Thing(TM) as if there were no observable effects of a program, it would be useless.

What makes programs easier to prove correct and reason about is when effects are localized to well-defined areas often "at the edges" of the architecture.

What makes programs impossible to prove correct and very difficult to reason about is when effectual logic is pervasive throughout, such as most of the "Global Variable Use Cases" the post advocates.

0 - https://en.wikipedia.org/wiki/Referential_transparency






Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: