Archive for code h’yung

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.”

False.

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

Code H’yung: Ropes, Sprint 6

Posted in smalltalk with tags , , , , on October 7, 2009 by moffdub

Welcome to the Sprint 6 Review of the Ropes h’yung mini-project. As the only person who really matters on this project, I’m happy to report that we have code to show you for our review today!

Recall from Sprint 5, Sprint 6′s agenda:

  • finish testing and debugging hasMore
  • start to implement renumber

I am Developer, Born Brave.

The building is creaking. The machine isn’t working. The imps in the teleportation lab need to be exterminated. Any metaphor applies.

Continue reading

Follow

Get every new post delivered to your Inbox.