Wednesday, July 13, 2016
Biting Like a Pit Bull, twice [AKA Code Complete ch. 19]
No, it's not TheHackerCIO biting you like a Pit Bull.
The biting involved refers to problem areas found in the book. We'll get to that in a moment.
Let's back up here a bit. This blog is multi-purpose. One purpose is to record interesting things learned and discussed in the many technology Meetups I regularly attend. At the same time, since I'm both a code hacker AND a CIO type, I need to strike a balance so that I'm not too technical only with these posts. I don't want to scare off people who are interested in my views on outsourcing ???, for instance, or the 10x engineer???. The solution I've hit upon is to start general interest when I'm recording Meetup Notes, as I am here and now, and then gradually move more technical to the actual comments on the book. You can quit if and when things get too technical or specific.
As I said, this particular blog post, always on Wednesdays, is dedicated to the previous evening's Meetup Notes. On Tuesday evenings, for about a decade, TheHackerCIO has enjoyed a Meetup called DevTalkLA. It's a book club. For techies! What makes it nice is that I've known the core members for this whole time. They are both friends and colleagues. And they are excellent technologists. The discussion is always good, always helpful. Even if the book we democratically select doesn't live up to expectations, we find ways to weave in work-related questions, or meta-criticism on the problem of technical writing, or something. So we make every sessions worthwhile. And so, while I'm at it here, let me give a shout-out to both Ken Dempster for hosting it for so long, and to Sony for graciously allowing us the use of their facilities.
If you want to join, I'd encourage it. We love new blood. And feel free to come mid-book. We allow backing up.
The current book of interest in called Code Complete, by Steve McConnell. Last night we covered chapter 19, but remember ... that allows anything prior to chapter 19 to be covered. :-)
There were two particular problem areas that bothered me in this chapter. This is where we're going to "bite like a pit bull." For now, I'm too far behind on blogging, so I'll update this page to explain further, probably tomorrow. But for now, I need to "book" a place on Wednesday for this DevTalkLA Meetup review. So, I'm about to hit "Publish."
p. 434 - Ken really likes to pull expressions out into a method, with a really good name. Even if not complicated, because it makes it more readable.
George on the other hand argues that locality of reference makes it more of a pain: you have to look it up, and that's an extra overhead.
Ken's take was the the good name eliminates the need to look it up. Unless of course you think you have a problem with it, and then it's easy enough to do.
TheHackerCIO agrees with Ken. Pull em out. I'd like to incorporate this notion of multiple levels of condensation into a new language, but that's a blog topic for another day.
p.438 - short circuit operator ... is this wrong? Maybe I'm cynical
p.441 - Ken raised the idea of the null object.
p. 446 - what *is* a side effect? we argued a bit about this. I'll post my argument and we'll discuss further in another blog posting. Basically, I'm not convinced that this is an example of a side-effect. I want to bite like a pitbull on this one, because I've had a bad feeling about this usage for a long, long time.
Ken saw an abstract enum the other day. I don't see it. Isn't an enum supposed to be essentially a literal? He promised to post it.
Another way Ken likes to roll his own enum is with a map: you know, a key value pair. then he can just look them up.
George noted how happy he was that you can use a String in a Case statement. TheHackerCIO noted that the whole Java world breathed a sigh of collective relief at the eventual capitulation to this excellent notion.