GOOS Book Distilled Part 0

A follow through of the great book Growing Object-Oriented Software, Guided by Tests with code

2 minute read

I decided to start this new series of blog posts to mark my progress of re-reading the classic book Growing Object-Oriented Software, Guided By Tests. I read this book a couple of months ago (mostly on the train to work), I remembered it is a good book, but since I have no code out of it, the understanding must not be good. So this time, I’m gonna do it the hard way.

Completed Programming Paradigms Course

Completed the Stanford Programming Paradigms course

1 minute read

Finally I finished the 27th video on the famous Programming Paradigms course by Stanford. It’s excellent! It basically covers: C programming. Functional programming (using Scheme). Jerry is an excellent teacher! Thank you for putting up the material online. Highly recommended for anyone!

Icecream Shop Simulation

An example that shows how to use semaphore to code complicated concurrent program

5 minute read

I have been watching the good old Stanford CS course Programming Paradigms. The first half of the course deals with C and serves as great material for learning C. Then the course introduced threads, and concurrent programming in C with some homebrew library. The most complicated example given is this program that simulated the icecream shop. Here are the description of the problem: This program simulates the daily activity in an ice cream store.

You Think You Know If Else?

The subtlety of if else statement

2 minute read

I was shocked during this fantastic video by Kevlin Henney not because all the programming history that he talked about, but by one simple example of if-else statement. Here is the leap year function he gave as an example in the talk: def isLeapYear(year) { if (year % 400 == 0) return true if (year % 100 == 0) return false if (year % 4 == 0) return true return false } def isLeapYear(year) { if (year % 400 == 0) return true else if (year % 100 == 0) return false else if (year % 4 == 0) return true else return false } Which one do you think is better?

Dynamically Load Windows Function by Yourself

How to load Windows function by yourself

1 minute read

In HandMadeHero Day6, Casey showed a neat way to load a Windows function by yourself. The senario is as follows: In order to get game pad input working, we need the function XInputGetState, but it is in different dll files on different Windows versions, if we link directly to Xinput.lib, then we have the risk of the program won’t start if somehow the dll is not found in the system. We don’t want that to happen considering that the user may not even use a game pad.