Thursday, December 29, 2011

Ghost Story by Jim Butcher - What is the goal of training the young?

Ghost Story (The Dresden Files,  #13)Ghost Story by Jim Butcher

My rating: 4 of 5 stars

So, Harry is dead. But apparently not quite. He is now a ghost. And he knows nothing about how to survive as a ghost. Fortunately, he soon meets some guides to mentor him along the way.

Along with the rest of the story, Ghost Story is the story of the training of the young. While Dresden has been spending years training an apprentice. But throughout the series Dresden has had a problem with trusting others. He has made a practice of hiding the truth of dangers and the realities that he faces from those around him. Even after it repeatedly gets him and those around him in trouble. And now that he is dead, he is not able to help his friends when they inevitably get caught up in things bigger than they are So throughout the book he learns of what his friends have been doing to compensate for his absense.

The question at hand, was his way right? In his absense his apprentice has gone off on her own, and one of his old acquaintances has teken up the task of continuing her training. And his friend comments that she was training his former apprentice to survive in combat, in a world that was harsh and unforgiving. While he has been derelict in his duties in coddling his apprentice.

Was she right? I have a young son, who we are hoping to raise so that he will be able to handle the world. And I have been entrusted with the training and mentoring of graduate students to prepare them to face the world and to survive and thrive in it. My wife and I have promised that we would not coddle our son, that as he grows we will prepare him for the world that he will be a part of. That may not be forgiving. We do not promise success. But we promise that he will not into it blind. And we will have prepared him so that it is possible for him to thrive. But in the end, he will be the one who has to learn the lessons, develop the skills, and go into the world.

View all my reviews

Monday, December 26, 2011

Teaching Notes: Simulation Fall 2011 and using Simpy and Sage

This was my first semester teaching a graduate level (research focus) simulation course. The department has not had this course in quite some time. There is a master's level graduate course taught by an adjunct professor that focuses on simulation modeling (i.e. building the models, with an explicit de-emphasis on analysis). This course, in stark contrast was to focus on the analytical side of simulation with a de-emphasis on model building (i.e. the models used would be considerably simpler then would be expected in the other course, including the project).

The other goal was to learn a new simulation library. I wanted to learn to use Simpy simulation library as it is used by researchers associated with a computational research center at my school. I was using this within Sage, a mathematical programming environment. Sage in its notebook mode was how I was going to present the material, as it allows for mixing formated text as well as showing the results of calculations, graphing of results, etc. I wanted to test live generating of graphs and output of random simulations, to demonstrate the effects of randomness throughout. I let each student choose a simulation platform. The standard here was Arena. The other options were simulation libraries targeted at various simulation languages such as Simpy (Python), SSJ (Java), Simlib (with the Law and Kelton books for C/Fortran) or Omnet++ (C++).

The students were a mix of engineering PhD/MS students and students in the MBA/MS-Industrial Engineering (IE) program. Note that there is some selection here, as everyone is fully aware that the other graduate simulation course would be offered in the spring. Actually, one of the MSIE students had previously taken that course. Most students used Arena. One used Simpy and one used Matlab (i.e. roll his own)

Some notes
  1. Teaching MBA/MSIE students was fun. If this is what teaching MBA students is like, I'm all for it. These students were attentive, frequently asked very insightful questions, eager to learn the material and implement it, and were quite appreciative of the analytical focus of this course. A few of them mentioned that since they were interviewing for jobs, topics covered came up in their interviews (clearly, these were quantitatively oriented MBAs). One issue was during projects, as one of the PhD student projects was based on what he was exploring as a PhD thesis, I had to explicitly state that there were different standards for projects.
  2. An analytically focused simulation course was the right idea. The MBA/MSIE students liked it and appreciated the difference, including the one who took the other simulation course previously. Focusing on the use of simulation instead of the building of simulation models put the emphasis on the use of simulations for decision making (which allowed the MBA students to bring in what they knew from other courses with them). And for the PhD students, implementing analytical methods gave them an understanding of the field. And a decent part of one PhD dissertation is going to come out of the course.
  3. Simpy - I liked using Simpy. I found it fairly easy to pick up once I started putting some time into it. One issue was the general flexibility of programming language simulation libraries compared to commercial packages. My general pattern for solving a homework problem was to (i) take code from a similar problem, (ii) (re)write a class to incorporate the differences, (iii) write data collection code (iv) analyze results. But what happened to those who used Arena was they could not get modules to do what they wanted, and developing data recording procedures for an arbitrary performance measure and getting the per-replication output in Arena could be a daunting task. So what took me 20-30 minutes sometimes took the students hours.
  4. Sage - The Sage notebook view was very useful since it allowed the mix of formatted text (like a Powerpoint slide would have), along with live calculations. I used this along with simulations to demonstrate the effects of random variables and to show how various formulas and algorithms are actually implemented. (the descriptions in books and articles skip implementation details) Having the description alongside implementation made sense. When asked, the students preferred this version over the alternative of me drawing on the board (which I also did on occasion) and definitely better then Slides (with the benefit that slides give of having distributable lecture notes). One other benefit was I had to make sure I understood everything, because I would implement every procedure discussed in code including charting before giving the lecture, since the implementation was part of the lecture. There was a similar downside of the students not being able to efficiently replicate the analysis, as they were mostly using Excel spreadsheets for analysis and it was sometimes time-consuming to do tasks that programming made quick.
  5. Sage data analysis. Sage uses the Matplotlib library for data display and graphics. It is reasonable capable, and I have more flexibility than say R. But the tighter integration with the data analysis techniques already built into R make R a better platform when it comes down to it. Sage/Matplotlib has the advantage that modeling can be done in Sage/Python, allowing for all in one tool. (R can be accessible from within Sage, but it is not straightforward once you get past the R core functions)


  1. An analytically focused course works, even with non-PhD students (who were admittedly self-selected)
  2. The Sage notebook view is useful for teaching purposes. Formatted text, LaTeX for equations. Sage's ability for typesetting symbolic math and putting descriptions as well as implementation side by side was useful. Especially in stochastic settings where people do not have well developed intuition on the effects of stochasticity. I like this as a teaching environment. Unfortunately, this seems to be difficulty to teach people how to install it so I'm on my own here :-(
  3. One issue is having people in the same class using commercial simulation packages and programming languages. It is very easy to create a problem that is unexpectedly difficult in a commercial simulation package (and I have no reason to believe that it is a particular failing of Arena). The lack of flexibility in modeling, data collection and analysis makes it easy to get a student in trouble. And I am convinced that this occurs in practice once you leave the core domain the packages were designed for. (I get direct personal contact with representatives from the companies behind a couple of the packages so I get to have this discussion directly with them.)

Sunday, December 25, 2011

Book Review: Cool Tools in the Kitchen by Kevin Kelly

Cool Tools in the KitchenCool Tools in the Kitchen by Kevin Kelly

My rating: 4 of 5 stars

Cool Tools is a listing of kitchen gadgets that have received rave reviews on the Cool Tools website. While none of these are necessities (actually, for those who think that all you need is a chef's knife and paring knife, one of the reviews is for just that). But beyond gadget porn, it is good for all the explanations of how people use these Cool Tools, in many cases beyond its originally marketed purpose.

Cool Tools is NOT a listing of what are necessities for your kitchen and why. For that, I would go to Bittman's "How to Cook Everything." What it is are 81 gadgets that have been reviewed highly on the website "Cool Tools." Each has one or two reviews of just how the reviewer has used that gadget over time and why it has become a key addition to their kitchen. And they discuss practical aspects such as price and cost effectiveness.

Now, it is what it is. A fun little catalog of kitchen gadgets. But within the provided reviews, I actually learned a few things. And that was an unexpected bonus.

Disclosure: I received a free electronic copy of this book from O'Reilly Press as part of their O'Reilly Bloggers program. For more information, this book is available at the O'Reilly Press website

View all my reviews

Monday, December 19, 2011

The Art of Readable Code by Dustin Boswell

The Art of Readable CodeThe Art of Readable Code by Dustin Boswell

My rating: 4 of 5 stars

In engineering, it is often easy to forget that as much as we deal with things that are determined and immutable laws of nature, while the subject we study may be science, our practice of it is an art. And to be good at an art, one needs to master the use of the tools, not only in the sense of understanding its instructions, but as a craftman. When I was just learning computer programming while in high school, I used to openly wonder about my teacher’s concern about aesthetics. But now, with a few more years, I recognize that viewing programming as an art and learning it as a craftsman, leads to better outcomes in programming of our models and algorithms. And The Art of Readable Code is about what it means to look at the writing of code as a craft, one to be mastered and where the doing is as important as the final product.

The first part of the book are the details that go into every line of code. Naming variables and functions, aesthetics (using whitespace and line lengths to make the code easier to understand), using comments frugally, simplifying the logic. I had one person working with me that refused my comments in this area. I somewhat think that part of the reason his time there was unproductive was that he would not take suggestions along these lines, and his implementation of algorithms was both hard to follow and I think contained errors.

The second part was on reorganizing the code. This is something that has relevance as part of what I do is develop new methodologies. But this development very frequently is in many stages. The section on one task at a time was particularly enlightening. I have long known of the idea that it is beneficial to make every function return one output only. But I have felt that only applied when I reached a point where the current progress in the method had a single output. The chapter here discusses organizing steps within the function so each section of the function did one thing only. And reading it, I can think of how that would have made the last paper I submitted to a journal much less painful to develop and maintain.

It is easy to pass over books that look at the art and craft of programming in favor of those that teach new skills or pass on new language or library features or techniques. But a book like The Art of Readable Code is one that will help through over the course of the career, part by part as you mature as a programmer and coder.

I received a free electronic copy of this book as part of the O'Reilly press Blogger program. More information on The Art of Readable Code can be found at the O'Reilly website.

View all my reviews

Friday, December 02, 2011

Parenting 13 months: Holidays

Red in Tamatebako by LugerLA
Red in Tamatebako, a photo by LugerLA on Flickr.

Our holiday activity this year was having little auntie visit us from Chicago for Thanksgiving. And she performed the duty of all little aunties and uncles everywhere. She taught T tricks. In this case how to stick his tongue out at people (ps he still did this for days after little auntie left).

S and I have never been much for holidays. S jokes that for her and her friends, the most notable thing about holidays was that it was much easier to get practice room time. And paid gigs. For me, it was mostly a slight pause that let me catch up on things and visits home to see friends.

We're told that as T grows up, this will change as he gets excited about holidays. We'll see.