Blog of Rob Galanakis (@robgalanakis)

functional programming

Qt Designer is harmful, exhibit A

Last week, iker j. de los mozos posted a Qt tutorial on his blog. The post was retweeted a number of times, so I figure people liked it. The post exemplifies what is wrong with the Qt Designer, and also how a little more investment in learning can pay...

Read more

All languages need first class tuples

I was doing some work on a Flask app today and built up some chart data in Python that had a list of two-item tuples like [(<iso datetime string>, <value>), ...]. I needed to iterate over this same structure in JavaScript and of course was reminded how great it...

Read more

Python Singletons

In my opinion, good python libraries and frameworks should spend effort guiding you towards the ‘pit of success’, rather than trying to keep you from failing. They do this by spending most effort on things related to the critical path- clear interfaces, simple implementations, thorough documentation. Which is why...

Read more

Passing around complex objects is the opposite of encapsulation

I see this a lot: class Foo: spam = None eggs = None def frob(foo): return sprocket(str(foo.eggs)) f = Foo() s = frob(f) It tends to be more sinister, and difficult to see, in verbose examples. But generally it is easily identified by the called method using a single...

Read more

Large initializers/ctors?

With closures (and to some extent with runtime attribute assignments), I find the signatures of my UI types shrink and shrink. A lot of times we have code like this (python, but the same would apply to C#): class FooControl(Control): def __init__(self, value): super(FooControl).__init__() self.value = value self._InitButtons() def...

Read more

Don’t use global state to manage a local problem

Just put this up on altdevblogaday: http://altdevblogaday.com/2011/09/25/dont-use-global-state-to-manage-a-local-problem/ I’ve ripped off this title from a common trend on Raymond Chen of MSFT’s blog.  Here are a bunch of posts about it. I can scream it to the heavens but it doesn’t mean people understand.  Globals are bad.  Well, no shit...

Read more

WTFunctional: Be Declarative

Functional programming is one of the most important developments in programming, but one that has been understandably slow to be adopted and understood by many programmers and tech artists.  Over a few posts, I’m going to try to go into the how and why of using a more functional...

Read more