CS 371p Fall 2024: Rob Mayoff

Rob Mayoff

Blog #4

Your blog entry must explicitly answer the following questions about the class (mark the questions in bold in your post):

Pride is one of the seven deadly sins, so instead I will post the class-related thing I am most ashamed of. I forgot everything I learned from doing the first exercise on Ed, so when we did the second exercise, I forgot about (and didn’t notice) the button to run the tests. I just clicked “Submit”. Since my code didn’t even compile, I immediately failed the exercise. Fortunately, Prof. Downing was kind enough to increase the submission limit from 1 to 2 so I got a second chance. 😅

I used my ability to forget how we did the first exercise. I also used my rustiness in C++ programming to write incorrect code on my first attempt.

Maybe I wasn’t the only one that needed a second attempt? I don’t know. I probably had more impact when I pointed out that Prof. Downing typed strcmp(...) == "abc" instead of string(...) == "abc" during the lecture.

I thought the paper was a little too cutesy in its attempt to mold lessons from kindergarten into lessons about pair programming. I like the idea of pair programming, although I haven’t been given that many opportunities to apply it. It also doesn’t mesh well with work-from-home.

Fun story: the book Extreme Programming Explained introduced pair programming to the world. It came out in 1999, when I was working at DejaNews (possibly it had been renamed to Deja.com by then). I liked the ideas of XP so I gave a copy of the book to the company founder. He liked it too and spread it around the management team. In a great example of ridiculous dot-com bubble workplace culture, we soon had managers going around trying to catch people in the act of pair programming and rewarding them with $20 bills. Later, the execs came up with the idea of “extreme management”. By 2001 the company had been split up and sold to Half.com and Google.

I thought it was easy from a programming standpoint, and excessive from a bureaucracy standpoint. So many GitLab issues to work through!

Exceptions can be a very nice language feature, but the C++ design of exceptions leaves much to be desired. Calling a function that might throw an exception is like using an if statement or a loop: it is a branch point in the execution graph of your program. But a call to a function that might throw looks exactly like a call to a function that never throws. This is a cognitive burden you shouldn’t be forced to bear.

Function strcmp is badly named. The name doesn’t tell you enough about what it returns. A name like strdiff would be better. The function answers (approximately) the difference between the strings, so a statement like if (strdiff(s ,t)) { do something; } more naturally reads as “do something if s and t differ”.

Types vector, list, and deque are just part of the C++ toolbox. They are necessary data structures and they have APIs consistent with the design philosophy of the language, for better and for worse.

Getting a 2 on project 1 made me happy. Or at least I felt relieved. I’m also enjoying the video game Animal Well.

My tip this week comes from Nobel laureate Richard Feynman:

The first principle is that you must not fool yourself and you are the easiest person to fool.

See you next week!