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."

====================Discussion Notes===================================

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.


I Remain,


Tuesday, July 12, 2016

A Bucket List Item: SICP

The Wizard Book!!!

Yes, The Wizard book.

TheHackerCIO finally got to go to this Meetup: Computer Science Reading Group. It's based on reading the classics of Computer Science, and working actively on solving the problems found therein.

At present, they are working through the classic book, available free online!, by Abelson and Sussman,  Structure and Interpretation of Computer Programs. Commonly "initialized" as SICP, this book is a LISP based advanced beginners "introduction" to programming languages. Instead of focusing on the mechanics of languages, the focus is on the abstractions used within computer science.

You must have heard of this book! It's a classic! A.K.A., "The Wizard Book," from it's cover, this book is written by MIT professors and became for many many years the basis of a class at MIT. Thanks to the new MOOC trend, you can now see/take this class for yourself here.  Go on! I recommend it!

The LISP of choice for the Meetup is Chicken Scheme, available on the MAC through a Homebrew install. Or, if your a building kind of guy, you can get the source code here.  I was going to build it, but I had a client MacbookPro without XCODE loaded. And building from source code required GNU Make, which in turn required a Homebrew install! So, I gave in, and put up homebrew, to save time. Then it was a simple command to install Chicken-scheme:
     brew intstall chicken

you also want some "eggs," apparently some kind of module or library system. In this case, you want an sicp "egg," so you should issue:
     chicken-install sicp

Then you invoke the Chicken-scheme by entering this command:

Which puts you into the chicken scheme interpreter or REPL prompt: Next you load the "egg" by this:
     (use sicp)

You'll see messages that libraries were loaded. Finally, the acid test is the simple Functional "Hello World" equivalent:
     (+ 2 2)

Which for those of you having some Functional style experience, is the way that you add two and two in LISP. You should get the answer of four, naturally.

The previously mentioned wiki has a special place to then "get started," so that's a good place to do just that.  Documentation is also available here.

Three or four of the attendees had to get installed, so we spent a good bit of time going through the above steps.

Then, Mac pointed us to an interesting article on building a scheme from scratch, by Peter Michaux. There was also mention about a special github, where the source for special things to be used in the book is kept. I'm not that clear on what exactly this was, but the account is here.

Then Frankie discussed and presented his attempts to solve problem 5.52, a garbage collector in C. Apparently the book structure, toward the end requires you to implement your own lisp in lisp, and then in C.

All in all, this was a wonderful meetup! For many years this book has been on my "bucket list," and now I have an excuse to work through it in the company of like-minded individuals. It doesn't get any better than that!

I remain,