Tag Archives: Math

Rob Pike Comment on OOP

Rob Pike posted this on Google Plus a few days ago here and I had to share it.

A few years ago I saw this page: http://www.csis.pace.edu/~bergin/patterns/ppoop.html

Local discussion focused on figuring out whether this was a joke or not. For a while, we felt it had to be even though we knew it wasn’t. Today I’m willing to admit the authors believe what is written there. They are sincere.

But… I’d call myself a hacker, at least in their terminology, yet my solution isn’t there. Just search a small table! No objects required. Trivial design, easy to extend, and cleaner than anything they present. Their “hacker solution” is clumsy and verbose. Everything else on this page seems either crazy or willfully obtuse. The lesson drawn at the end feels like misguided epistemology, not technological insight.

It has become clear that OO zealots are afraid of data. They prefer statements or constructors to initialized tables. They won’t write table-driven tests. Why is this? What mindset makes a multilevel type hierarchy with layered abstractions better than searching a three-line table? I once heard someone say he felt his job was to remove all while loops from everyone’s code, replacing them with object stuff. Wat?

But there’s good news. The era of hierarchy-driven, keyword-heavy, colored-ribbons-in-your-textook orthodoxy seems past its peak. More people are talking about composition being a better design principle than inheritance. And there are even some willing to point at the naked emperor; see http://prog21.dadgum.com/156.html for example. There are others. Or perhaps it’s just that the old guard is reasserting itself.

Object-oriented programming, whose essence is nothing more than programming using data with associated behaviors, is a powerful idea. It truly is. But it’s not always the best idea. And it is not well served by the epistemology heaped upon it.

Sometimes data is just data and functions are just functions.


Neil deGrasse Tyson on STEM

This video is exactly right.

Tyson makes a perfect case for why we need to change the way we educate in the US. STEM is critical in teaching people how to solve problems and provides the broad understanding and mental capacity required to create, innovate, and advance a team, a company, a nation, and over time the world. STEM is a primary engine of progress.

Tyson, in this short interview, has given yet another talk that no one should miss, no matter who they are. We as a species are approaching a state in which understanding the idea in this short video can determine our long term survival.


Flatland: A Great Introduction to Dimensional Thinking

I just want to call attention to an often overlooked little 1884 novel called Flatland, which describes a society of two dimensional figures, with the angular and linear characteristics of each serving to relegate him or her to a particular social class. There’s much more that happens in this book and it’s an interesting read, both as an introduction to thinking of objects as having properties according to their dimensionality and for the insight it gives into the rigid class structure of the Victorian society the author lived in and describes in the book.



Recent Article on Flatland – http://www.americanscientist.org/bookshelf/pub/a-forgivably-flat-classic

Flatland at Amazon.com – http://www.amazon.com/Flatland-Romance-Dimensions-Thrift-Editions/dp/048627263X

Cool Math Problem I Found on XKCD Blog

Check out this math problem I found on the xkcd blog:

Alice secretly picks two different real numbers by an unknown process and puts them in two (abstract) envelopes.  Bob chooses one of the two envelopes randomly (with a fair coin toss), and shows you the number in that envelope.  You must now guess whether the number in the other, closed envelope is larger or smaller than the one you’ve seen. Is there a strategy which gives you a better than 50% chance of guessing correctly, no matter what procedure Alice used to pick her numbers?

HINT: I’ll give a slight hint in that if you consider the range of the real numbers, it should make the answer clearer. Hopefully that didn’t give it away.

Link: xkcd post with math problem