Welcome to the new blog!
Welcome all to my new blog: Coding Coda. Why a new blog? Well, the old one is basically dead. I’ve struggled a long time on writing at the old blog. Why? It was explicitly technology/programming focused. Lately, I’m trying really hard to merge my two favorite “hobbies”: computers and music. I couldn’t bring myself to talk about music all that much on my previous blog. A compounding factor is that my previous blog had largely been focused on the tech I created and worked on at work. However, now that I’m in “The Windows Bunker”, I absolutely can’t talk about work-related tech until our “coming out party.”
So, here we are. I’m doing a reboot of my web presence.It’s about time for me to start focusing on both my hobbies. You will see a good amount of talk about programming and computers still. However, more and more of that discussion will also be focused on music (or audio programming in general). Whether this is about fun MIDI stuff, creating a drum sequencer, etc., there is a lot of cool stuff coming up!
What about the name? Well, I wanted a name that clearly played on the role of computers and music in my life. All of the titles and domains I thought of were terribly boring. Thankfully, I have a creative coworker. So I say a big “Thank You!” to my coworker Harry Pierson (http://www.devhawk.net) for coming up with Coding Coda!
Here’s to new beginnings! In many ways, this feels like the start of “the true me” out on the web. So I’m very excited about this
. I hope you all enjoy the journey just as much!
My Comprehensive Must-Read Books List About Technology
The other day on Twitter, some friends and I were discussing the narrative books we like that are about technology (not technical books themselves). These are books about notable figures in the technology field, about the history of a specific technology, and so on. Here is my list of books that I consider must-reads for those techies out there that like this type of stuff (in no particular order).
If one of your favorite books is not on this list, please leave a comment as I would love to have more books to add to my list
.
Jason’s Must-Read
-
iWoz: Computer Geek to Cult Icon: How I Invented the Personal Computer, Co-Founded Apple, and Had Fun Doing It
. This is perhaps one of my most favorite books on a notable figure in the technology field. Though I’m not personally a hardware guy, it’s hard to find somebody to look up to more than Steve Wozniak. He is most definitely the Mozart of hardware design. I usually find the last part of the book (when it’s less technical) less interesting, but don’t let that deter you from a great book!
-
Just for Fun: The Story of an Accidental Revolutionary
. This is a book all about Linus Torvalds and the creation of Linux. It’s when it’s being very technical that I think it is at its best. Then again, I’m a geek
. Gives especially interesting insight into the motivations and life of Linus. A thoroughly enjoyable read. -
The Second Coming of Steve Jobs
. It’s amazing the difference a single person can make in the direction and drive of a large company. I personally think it is one of the reasons Apple is who they are. There is no doubt that Steve Jobs is a major influence and he probably single-handedly saved the company when he returned. This is a very interesting read to get some insight into the events surrounding his return to Apple.
-
Showstopper! The Breakneck Race to Create Windows NT and the Next Generation at Microsoft
. Ah, the creation of Windows NT. Quite the milestone for Microsoft. This book gives good insights into the culture of the Windows division at the time and the many different conflicts that were happening at the time that impacted the development of Windows NT. If you’re a “Microsoft Guy” (as in, you know of executives like Soma, Bob Muglia, and the like), you will find yourself recognizing many names within this book (like when Soma was a tester in the Windows division). At the heart of it is Dave Cutler. There are many times where you’ll either laugh or be incredibly scared at some of the behavior by Dave Cutler as he pushed his time to finish and ship Windows NT.
-
Microserfs: A Novel (P.S.)
. Let’s say one thing, this book is not based on a true story. However, it might as well be. It probably shouldn’t be on this list as it is a fictional book. Oh well! From what I’ve heard, it captures much of the feeling and culture of what it was like to work at Microsoft in the late 1980s and early 1990s. Even before working at Microsoft, I enjoyed this book very much. However, after joining Microsoft, I really like this book
. It’s very interesting to “get” some of the inside jokes after knowing Microsoft from the inside (like the main character working in Building 7 (which doesn’t exist and is a part of Microsoft lore)). If you’re familiar with the areas of Redmond and Bellevue that surround Microsoft’s main campus, you’ll smile several times during this book. The book isn’t entirely based at Microsoft as many of the characters “move on” to different things.Interestingly enough, I have a version of this book as a “Book on Tape” that is narrated by Matthew Perry (yes, of Friends fame).
-
The Soul Of A New Machine
. This book tells the story of the one-year development of a 32-bit minicomputer built by Data General engineers in the 1970s. It’s a crazy time shown in this book and a fun read. On the verge of being a page-turner. I’m glad I don’t work on a team like this
. But it was definitely quite the time to be involved in the computer industry. -
Coders at Work
. An absolutely masterful set of interviews done with well-known subjects from all over the computer field. In this book, you will find interviews ranging from Guy Steel (father of Scheme/Lisp), to Donald Knuth, to Simon Peyton Jones (of Haskell fame), and many others. This book is very suited to sudden starts and stops so I found myself reading it before bed and when I had quick breaks during the day. Though I skipped around a bunch, I found myself with a compulsive need to read every single interview in the book (and it’s hard to find an interview in the book less than 40 pages long). A must read, especially for programmers.
-
Fire in the Valley: The Making of The Personal Computer (Second Edition)
. This is most definitely not a narrative. It’s actually a borderline encyclopedia on the making of the personal computer. You don’t sit down and read this book through in one sitting (it’s massive to-boot). But it’s still fun to have this one on the shelf to go through from time to time to get a fairly complete breakdown on all the events (and their timelines) that led to the development of the personal computer (and how it evolved).
-
Dreaming in Code: Two Dozen Programmers, Three Years, 4,732 Bugs, and One Quest for Transcendent Software
. If you like The Soul Of A New Machine, you should like this book as well (and vice versa). This book is largely considered a “modern retelling” of Soul Of A New Machine by many people. Having read both books, I can’t exactly disagree with that sentiment. Provides much of the same context and insight into the computer field for a more modern age that Soul Of A New Machine did for the 1970s.
-
The Early History of Smalltalk (free PDF available). Yes, this is not a book. This is actually a paper written by Alan Kay himself. This means you can’t get any more accurate about all the events leading up to the birth of Smalltalk, considering it was written by the visionary behind Smalltalk. In this paper, Alan goes back all the way to his college days and talks about many of the cutting edge research being done in the computer field that gave the inspiration that ultimately led to the development of Smalltalk. I can’t express enough how much I believe this to be a must-read for any language fan/geek. Do it now, there is no excuse to download the PDF as you are reading this!
-
Masterminds of Programming: Conversations with the Creators of Major Programming Languages (Theory in Practice (O’Reilly))
. If you don’t know already, I’m a language geek. I’m fascinated by the design and implementation of programming languages. With that in mind, there should be no surprise on why I like this book so much. This book (as the title says) contains a bunch of interviews with many different implementers of major programming languages (from C#, to Haskell, to Lua, and many, many others). If you’re a language geek like myself, there is simply no excuse not to read this book.
-
The Annotated Turing: A Guided Tour Through Alan Turing’s Historic Paper on Computability and the Turing Machine
. Heard of Turing Machines? Perhaps you’re not a mathematician? If so, this is a fantastic read. In this book, Charles Petzold provides the background knowledge and context that is required to understand this ground breaking paper written by Alan Turing. Not only that, Charles Petzold will walk you through the paper practically sentence-for-sentence breaking down exactly what it means and the ramifications for each section. This book can order on “brain explosion” from time to time, but well worth the effort to read it. I almost didn’t put it on this list as it is not nearly as narrative as the other books on this list, but I would rank it as just as awesome as the others
. -
Code: The Hidden Language of Computer Hardware and Software
. Similar to The Annotated Turing above, it’s hard to say whether this book actually belongs on this list or not as it is quite the technical book. I’m fascinated by how things work, and this book walks you all the way from logical gates (AND, OR, XOR, etc.) to how, specifically, memory works (all the way down to the logical gate level), and even how CPUs work. You’ll find yourself starting with basics like light bulbs and switches, and ending with the basics of computers. Another “gold-star” to Charles Petzold for this book. Get it!
-
In Code: A Mathematical Journey
. I’m not a mathematician. In fact, compared to other software developers I know, my math skills and knowledge is pretty poor. Yet I continue to find myself intrigued by topics like Cryptography. If that sounds like you, this book is a must-have. It chronicles the journey of a young woman through the land of mathematics and into the realm of cryptography. It is truly amazing what this young woman accomplishes at her age. This book tells the narrative in such a way that you get to understand how it works as well as she works along. And we’re not talking about “Cryptography 101” either
. There are definitely times in this book that you need to stop and “absorb” the information for a while.
Jason’s Must-Watch
The following ones are technically “must-watch” as they are videos, not books. But I find myself popping them in when I’m in one of those moods (and want some video playing in the background while I code).
-
Pirates of Silicon Valley
. This is a made-for-TV movie based on the book Fire In The Valley from above. It mostly focuses on the early days of Apple and Microsoft and the interaction between the two. Not 100% accurate, but mostly accurate. Fun to watch.
-
Triumph of the Nerds
. An early (pre-Windows 95 launch) three-part documentary done by Robert X. Cringley. Has some interesting interviews with Steve Ballmer, Bill Gates, Larry Ellison, Steve Jobs, and more. Discusses some of the conflicts between IBM and Microsoft towards the end of that partnership as well as diving back into some of the early history of the Altair and Apple 2.
-
Revolution OS
. A documentary about the creation and initial rise of Linux. Has interviews with Bruce Perens, Linus Torvalds, Richard M. Stallman, Eric S. Raymond, and the like. Granted, it is a fairly weighted and one-sided presentation (the narrative over Bill Gates’ letter to hobbyists is especially laugh-inducing). But don’t let that get in the way of what is normally a good watch.
-
Hackers – Wizards of the Electronic Age
. It contains a bunch of "legendary" hackers, what else is there to say?
Jason’s I-Really-Need-To-Get-Around-To-Reading-These-Myself
Here are some more that are on my own must-read-this-in-the-future list, I just haven’t gotten around to buying and reading them yet…
-
Revolution in the Valley
. This is about how the Mac was made and is written by one of the main engineers of the Mac as well (Andy Hertzfeld).
-
Hard Drive: Bill Gates and the Making of the Microsoft Empire
. It seems ridiculous that I’m a Microsoft employee and don’t have a single book on Bill Gates (yet my bookshelf is stocked with books on Linus, Steve Jobs, Steve Wozniak, etc.). This one looks like a fairly good read to.
-
Hackers: Heroes of the Computer Revolution
. I think the title says it all. Sounds like a fun read!
-
A Few Good Men from UNIVAC (History of Computing)
. Based on how much I enjoyed The Soul Of A New Machine and how much I like computer history, I definitely want give this one a read.
-
Fumbling the Future: How Xerox Invented, then Ignored, the First Personal Computer
. I’ve always had great respect and admiration for those people that worked at Xerox PARC in its heyday. I think every geek needs to realize the sheer amount of technologies that our modern computer world is built on (that we take for granted) that were all founded and built at Xerox PARC. An amazing story.
-
Analog Days: The Invention and Impact of the Moog Synthesizer
. It could be argued that the original Moog synthesizers are what really put synthesis on the map. Though I’m not much of a hardware geek myself, I have always been intrigued by the hardware side of things. This is definitely on my wish list.
And there you go, my opinions on what are some must-reads and must-watches for other geeks out there. Outside of computers, I’m not much of a history person. I’m not interested by ancient civilizations, the civil war (unless it involves the Oregon Ducks and Oregon State Beavers), or anything of the sort. But computer history? I love it and am incredibly fascinated by it.
Enjoy
.
An Intro to Barrier
In this first stage of our Tour de BCL, we will be passing through the new Barrier class.
So what is a Barrier? Let’s take a look at the boring technical description for a Barrier:
A Barrier is a synchronization primitive that enforces the stopping of execution between a number of threads or processes at a given point and prevents further execution until all threads or processors have reached the given point.
I don’t know about you, but sometimes technical descriptions like the above just sound like “blah, blah, blah” to me. What does a Barrier really mean to me, as a developer. Let’s break it down a different way by looking at a specific real-life scenario.
Think of a Road Trip
Instead of looking at the technical description above, think of the concept of a road trip.
There are three friends, Mac, Charlie, and Dennis. They live in a small town south of Seattle but want to take a road trip up to Seattle. So Mac calls up Charlie and Dennis and says “Hey guys, let’s take a road trip to Seattle. Meet up at the local gas station and then we’ll all leave from there.” So now they all now they need to go to the local gas station, wait for all of them to show up, and then they’ll leave for Seattle together and follow each other there.
Relating this scenario to some code, let’s say that Charlie, Mac, and Dennis are all individual threads that have one method of execution, the DriveToSeattle() method. Within that method, they are all going “to drive” to the same gas station and then continue to drive to Seattle.
If we don’t use the Barrier to synchronize the work (aka wait for each other to arrive at the gas station), each one of them will leave for Seattle the second they arrive at the gas station:
static void Main(string[] args)
{
var charlie = new Thread(() => {
DriveToSeattle("Charlie", TimeSpan.FromSeconds(1))
});
charlie.Start();
var mac = new Thread(() => {
DriveToSeattle("Mac", TimeSpan.FromSeconds(2))
});
mac.Start();
var dennis = new Thread(() => {
DriveToSeattle("Dennis", TimeSpan.FromSeconds(3))
});
dennis.Start();
charlie.Join();
mac.Join();
dennis.Join();
Console.ReadKey();
}
static void DriveToSeattle(string name, TimeSpan timeToGasStation)
{
// Drive to gas station
Console.WriteLine("[{0}] Leaving House", name);
Thread.Sleep(timeToGasStation);
Console.WriteLine("[{0}] Arrived at Gas Station", name);
// Need to sync here
// Perform some more work
Console.WriteLine("[{0}] Leaving for Seattle", name);
}
Well, that’s hardly a road trip. If I were in Mac’s or Charlie’s shoes when Dennis left for Seattle without me, I know I would be a little upset. We obviously don’t want that to happen. So we can use the new Barrier to make sure they all “wait up” for each other at the gas station.
Using the new Barrier class
So how do you use the new Barrier class? It’s actually quite simple.The cool thing is that there are really only three things you need to learn to use the Barrier for this simple type of scenario: a single constructor and two method calls (both of which take zero parameters). Yes, it’s that simple to use.
Let’s look at what our new code using Barrier looks like:
static Barrier sync;
static void Main(string[] args)
{
sync = new Barrier(participantCount:3);
var charlie = new Thread(() => {
DriveToSeattle("Charlie", TimeSpan.FromSeconds(1))
});
charlie.Start();
var mac = new Thread(() => {
DriveToSeattle("Mac", TimeSpan.FromSeconds(2))
});
mac.Start();
var dennis = new Thread(() => {
DriveToSeattle("Dennis", TimeSpan.FromSeconds(3))
});
dennis.Start();
charlie.Join();
mac.Join();
dennis.Join();
Console.ReadKey();
}
static void DriveToSeattle(string name, TimeSpan timeToGasStation)
{
// Drive to gas station
Console.WriteLine("[{0}] Leaving House", name);
Thread.Sleep(timeToGasStation);
Console.WriteLine("[{0}] Arrived at Gas Station", name);
// Need to sync here
sync.SignalAndWait();
// Perform some more work
Console.WriteLine("[{0}] Leaving for Seattle", name);
}
You can see now that nobody leaves for Seattle until everybody has arrived at the gas station. Essentially, with every call to SignalAndWait(), the number of signals received by the barrier is incremented. Once the number of signals received reaches the number of participants the Barrier was constructed with, all threads are then allowed to continue execution. And that’s all it takes to leverage the new Barrier class being introduced into the BCL with .NET Framework 4.0.
But Jason… What is up with that line of code: “sync = new Barrier(participantCount:3);”? I mean, what the heck is “participantCount:3”? How is that valid syntax?
Well, that’s easy. This is a new feature in C# 4.0 called Named Parameters where you can actually use a parameter’s name to specify what a value applies to. This becomes very handy in two places: 1) when combined with Optional Parameters, and 2) when used to clarify “magic numbers” (or “magic strings”, “magic booleans”, etc.) without having to introducing a temporary variable.
In this case, I could have left out participantCount and written just “sync = new Barrier(3);”. But I personally don’t like a magic number like “3” just floating around like this and Named Parameters give me an easy way to provide more context about the value “3”.
In Closing
So let’s look back at that boring technical description again:
A Barrier is a synchronization primitive that enforces the stopping of execution between a number of threads or processes at a given point and prevents further execution until all threads or processors have reached the given point.
Think about it this way:
- “stopping of execution between a number of threads…” = waiting for each other to arrive
- “… at a given point” = the gas station
- “prevents further execution until all threads… have reached the given point” = can’t leave for Seattle until everybody shows up
See? Nice and simple!
Barrier is a great new synchronization primitive to use when there is a known amount of work to do that is being done by different workers that all have common synchronization points. However, if the amount of work needing to be done is not well known beforehand, Barrier is not the greatest primitive to use. Next we’ll look at another new synchronization primitive coming in .NET Framework 4.0 that is great to use when the amount of work is not known: the CountdownEvent.
I hope you all enjoyed this first stage in our Tour de BCL. Until the next stage, we’ll see you later.
A work in progress
Here’s a sneak peek at a project/library I’m currently working on:
include Microsoft::Xna::Framework
include Microsoft::Xna::Framework::Graphics
include RubyXna
class FluxxGame < RubyXnaGame
def initialize
self.background_color = Color.black
end
def load(loader)
@font = loader.load_font("Title")
end
def render(renderer)
renderer.draw_text(@font, "Fluxx, v0.1", Vector2.zero, Color.white)
end
end
The combination of IronRuby and XNA Game Studio is proving to be pretty darn fun!
