Archive for programming

Code Review 6: Bowling Kata, Erlang edition

Posted in erlang with tags , , , , on October 13, 2010 by moffdub

I spent most of the past month interacting with the score server. The Armstrong book details two “stages” of distributed programming: running on two Erlang nodes on the same machine and running on two Erlang nodes on different machines.

First, I added some functionality to the server:

Continue reading

Code Review 5: Bowling Kata, Erlang edition

Posted in erlang with tags , , , , on September 15, 2010 by moffdub

So for this cycle of Erlang coding, I did a combination of coding and reading.

Code-wise, one of the most pertinent things I tried was extracting constants. My initial pass at this was to create a module with functions that returned the constants, but, as I thought, it lead me to an illegal guard expression compile error:

roll(on_frame, #frame{first_roll=First, second_roll=Second}, that_knocked_down, Pins_Knocked_Down) when (First =:= constants:all_pins_down()) and (Second =:= undefined) -> 
	{frame, #frame{first_roll = Pins_Knocked_Down, value = Pins_Knocked_Down}};

I quickly wised up and, through a combination of the Armstrong book and a Google search, I found that macros are the standard way to achieve constants in this language. Thusly:

Continue reading

Code Review 4: Bowling Kata, Erlang edition

Posted in erlang with tags , , , , , on August 25, 2010 by moffdub

Yeah, yeah, I bet you thought that I had slipped into my familiar “I don’t have enough time for this” mumbo bugspit of the hiatus. “Oh, it’s been three weeks since the last time he posted any code, he must’ve stopped.”


Simply put, I had to weather our organization’s usual two-pronged quarterly software release, which involved a fifteen-hour day and two 3 A.M. wake-up calls. On with the code.

I’m not sure where to start. I was going to try to order this code review by the changes I made, but there have been so many, so I’ll just do this by module.

Continue reading

Code Review 3: Bowling Kata, Erlang edition

Posted in erlang with tags , , , , , on August 4, 2010 by moffdub

It has been nearly a fortnight since we last reviewed my spare-time attempt at learning Erlang and functional programming in general. Let us take a look, shall we?

Actually, I am going to follow up on my search for an Erlang IDE. At last check, I was in love with Erlide, a plug-in for Eclipse. It seemed to be working all nice and good… up until I started to resume development. Erlide is not stable. It seems that if you do anything that invokes any sort of syntax re-highlighting, even to the point of pressing the return key to open up some space in the middle of your module, Erlide will freeze up. I never did get it to work.

So, I moved on to a different Java-based IDE called Netbeans, and its Erlang plug-in, called Erlybird. This was an even larger fail than Erlide because I couldn’t install the damn thing. Netbeans was very proficient at telling me that Erlybird had a dependency on the Common Scripting Language plug-in. Go ahead and try to find a download for that plug-in. I dare you. There is a reason why I am not linking anything, because I spent at least two hours looking. Fail.

Continue reading

Code Review 2: Bowling Kata, Erlang edition

Posted in erlang with tags , , , , , on July 21, 2010 by moffdub

Well, despite my pleas to Miss Reina to have her use my face for her personal enjoyment, I am here reporting on my progress on learning Erlang and practicing my programming prowess by implementing the Bowling Game kata.

I left the first code review pondering which route to take in order to score the games. My main goal was to attack this logic.

Doing so involved an update to the frame’s data structure:

-record(frame, {
	first_roll = 0,
	second_roll = 0,
	value = 0,
	score_has_been_updated_due_to_spare = false

Continue reading

Code Review: Bowling Kata, Erlang edition

Posted in erlang with tags , , , , , , on July 7, 2010 by moffdub

I searched far and wide and cannot find any pre-existing snippet post on any excursions into Erlang land, other than a brain-storming session on OO bastardizations of the language. It was basically a beginner’s exploration of the language. It might be the subject of another post.

Several weeks ago, I took a company-sponsored course on TDD. The lab exercise on the last day of the course was to develop the Bowling Game kata in a test-first manner. The course was object-oriented.

In my renewed quest to learn me some Erlang via Joe Armstrong‘s Programming Erlang, I decided to take on the bowling kata in a purely functional way. My hope is to struggle through the essentials of Erlang as I implement the logic.

Continue reading

Meaningful Meaninglessness

Posted in The Industry with tags , , on August 19, 2009 by moffdub

(theme music)
Here comes the rain and thunder now
Nowhere to run til until now
I’ve disappeared, they’ll wonder how
Looking for me, I’m underground

OK, OK, cut the music. Yes my friends, it is I, the phantom shadow of your nightmares, OO’s native San Diegan, a bitter codist, and anonymous OCD denier, El Moffdo. Enemies commence pouting, because I am here after a one week unannounced absence. There was no Nowhere To Run strip and there was no Helltime on Monday, to be sure.

Continue to stay tuned for a special guest feature on Nowhere To Run by Reina. She is finding that drawing stick figures that say witty blurbs and partake in geeky inanity isn’t as easy as I make it look.

As for the Helltime of August 17, you’ll have to do without, for it has sank quietly into the stormy abyss of nothingness. Now that we’re all cheered up, let’s talk about morons.

Continue reading


Get every new post delivered to your Inbox.