Monday, February 23, 2015

"A darker utility" and some thoughts about fiction.

Jeremy Bentham's Corpse.
A Darker Utility indeed.
I'm happy to report that my short story "A darker utility" will be published in the next edition of New Contrast, South Africa's oldest literary journal still in print.

This is an interesting pub for a couple reasons.

The first is that this will be the first "literary" piece that I've had published.

The other cool thing about this is that it's the first story I've written that's actually inspired (broadly) by philosophy. I've been very careful to try and keep my study of philosophy out of my writing. I think that too much philosophical content misses the whole point of imaginative literature. If there is philosophy it should be implicit, it should be dramatized, it shouldn't be the centerpiece of the work. "Sophie's World" might be a bestseller, but god damn, as a work of fiction I'm happy to say that it's a major failure. "Zen and the Art of Motorcycle Maintenance" has far better integration of philosophical ideas, because it feels like someone thinking. It's thought, dramatized. That's why it's so much more successful than the follow up "Lila", which often reads as an exposition of an existing philosophy than thought coming into existence. In this regards, Descartes' "Meditations" is probably a more successful dramatization of thought in process than is Pirsig's second book.

In this case, though, my story was inspired by some work in moral psychology on psychopaths (see, for instance, Nichols' "How Psychopaths threaten Moral Rationalism: Is It Irrational to be Imoral?") - so the title suggests that the story is about the bad parts of utilitarian thinking (even though, strictly speaking, my main character isn't really a utilitarian - she started out being one, and at the end I just wanted to keep the title).

I have a lot that I'd like to say about the relationship between literature and philosophy, and -- in particular -- about philosophy in literature. Perhaps in another post, though.

Friday, February 20, 2015

Slightly Buggy CSS Lava Lamp

So here's a slightly buggy demo I wrote up after I read Chris Coyier's short tut on shape blobbing. I thought it was a cool effect and that it could probably be used to achieve something that looked a little like a Lava Lamp.

Essentially I generate a bunch of square divs made to look like circles (setting border-radius), make them randomly move either up or down at varying speeds.

I should probably spend a little time cleaning up the code -- I suppose that's what you get when you code while watching Project Runway :P

See the Pen wBmbee by Blaize Kaye (@bomoko) on CodePen.

Sunday, February 15, 2015

Is "Learn to code by coding" a useful answer for someone asking how to code?

Earlier today I asked a question to some of my friends on Facebook the gist of which was "Which practices to you find useful in your pursuit of becoming a better programmer". I was asking about Code Katas in particular, but the question was quite general.

I think the way I phrased the question must have -- to people who don't know that I am a professional programmer -- suggested that I was asking how I could learn to program, rather than inquiring of my peers how they hone their craft.

Someone, who I assume interpreted my question as if I were a beginner, answered
"The best way to learn to code is to code. Deep end"
In one sense, this is very good advice. Those of us who are able to code generally learned how to do it through hundreds of hours of effort. This kind of advice resonates with those of us who have crossed that particular chasm -- we nod gravely and acknowledge that, indeed, there is no royal road to code.

But then I got thinking about how I would have taken this answer if I wasn't someone who has the experience to recognize just what is being expressed in this nugget of truth. What would I have
thought if someone had answered a genuine request for advice from a beginner with this succinct expression of what all of us programmers know to be true.

I think I would have been baffled. I think I would have been no better off than if I had received no answer at all, because to people without the shared experience of learning how to program, who haven't already spent the hundreds of hours required to grasp how to solve problems with computational solutions, this kind of answer carries very little information.

I'm not denying the truth of the statement, I'm denying it's usefulness if it stands without qualification.

What a beginner needs more than Nietzschean brevity is a clearer guide to getting started. I've taught several programming classes, and have mentored several juniors, and one thing is certain - learning to program is often an overwhelming prospect for people who haven't yet learned how. Beginners need examples, they need explanations through books and (good) lectures, they need people who can guide them in the practice of thinking like a programmer.
What is true, though, is that at every step of their learning one would want to include a very hefty portion of programming practice. A series of increasingly complex exercises and projects, for example.

Furthermore, even for experienced programmers saying that the best way to learn how to code is simply to code is misleading. One can spend several years solving the same kinds of programming tasks and not improve in any substantive way. So it's not true that simply coding is enough to become better once you've already got a basic competency in the discipline. What is required is some kind of deliberative practice along several dimensions as well as a steady dose of theory. And, to his credit, this is exactly the kind of thing the person quoted above suggested in a later comment once we had cleared up what I was asking.

To answer the question in the title: Yes, "Learn to code by coding" is indeed a useful piece of advice, but never simply left at that. For the beginner, it should itself act as a qualification "Read X,Y, and Z, but never forget that actually coding is the most important thing". For the more experienced "You should learn to code by coding in this way".