Explosion in my head

Sometimes, I'll go for months without having any really inspiring thoughts.

Then, like buses, three will come at once.

"Blade Runner: The Final Cut"

I watched this the other weekend in Hi Definition, and I have to say that it stayed with me. I immediately watched it again. It's not often I'll watch a movie twice in the same day. It was that good. If only I could see it on "the big screen" again.

I have a lot I could say about this XKCD comic.

Are the laws of physics computable? Consider the mandelbrot set. You can approximate the Mandelbrot set with a computer program... but you can never draw it completely accurately in a finite amount of time. Nobody knows of an algorithm which can tell you, in a finite time, whether any given point belongs to the mandelbrot set... and it's this non-computability of the mandelbrot set that makes it infinitely detailed no matter how far you zoom into it....  Personally, I agree with Roger Penrose. I think there must be some sort of "halting problem" aspect to the laws of physics.

Functional programming vs OO (Object Oriented programming)

"Is a set of sheep also a set of animals, given that all sheep are animals?".

Most people would quite naturally and reasonably answer "yes" to this question.

But in OO, this is quite a common mistake to make when designing a class hierarchy if you also allow your "set of animals" to be a mutable set (i.e. you can change the contents of the set over time). This is because it then becomes possible to add, say, a "cow" to your "set of sheep", breaking the invariant that a homogeneous list of "sheep" contains only sheep....

I see this as a failure of OO. When such an obviously "correct" answer is the wrong answer in the "OO" methodology, it's the methodology that's broken.

People naturally think in terms of "immutable" concepts. We're not actually very good at "simulating" little machines in our head.

But also, I've realised that all I ever do now when writing "my style" of OO code is to write anonymous, immutable implementations of interfaces anyway... I write "factory methods" which "compose" immutable objects out of other immutable objects into chains of delegating implementations of interfaces, splitting apart the different bits of functionality to the scope in which they were created. Up to now, it seemed verbose, but necessary in order to model things correctly and keep the right information in the right parts of the program.

Now I've realised that what I'm really doing is a horribly syntactically verbose form of functional programming.

I think we've reached the end of the road for "Object Oriented" programming... All of the stuff about Decorator, Factory Method... they're all just ways of doing what comes naturally, with better language support, in a purely functional language like OCaml or F#.

So, my plan is, I'm going to write a moderately complex algorithm (a symbolic differentiator) in C++, C#, Scheme, and then OCaml (or maybe F#), and write up my experiences. I'm teaching myself Scheme at the moment...

Oh, and if you're interested, I've finally fixed the RSS feed for this site...

 

This page last modified on