A little story about Object Orientated Programming

By Brian Will (See: Object-Oriented Programming: A Disaster Story)

In the beginning, there was spaghetti code.

And Dijkstra said, 'Let there be Structured Programming! Thou shalt consider goto harmful and organize your code into functions with proper control flow mechanisms.'

And programmers said, 'OK, sure we'll do that.'

Then Dijkstra saw that code was still spaghetti and said, 'Stop sharing state willy-nilly! Thou shalt avoid global variables and instead pass all state through the call graph.'

And programmers said, 'Er, um, wait, really? We haven't really figured out this functional programming thing, nor do we want to pay the overhead of immutable data on today's machines, so what you're proposing is horribly impractical and inconvenient for non-trivial programs.'

But the programmers did agree that shared state is problematic and that maybe they could cut back on all these global variables.

And so Object-Oriented Programming was born, and the global variables lived happily ever after disguised as singleton object fields.