8,760,000 Work Hours

8760000-work-hours-000000-formatted

According to a statement in the book The Well-Grounded Java Developer icon-external-link-12x12 icon-search-12x12, the Java Virtual Machine—which is that incredibly nifty piece of software that allows applications written in the Java programming language and others icon-external-link-12x12 to run on many different types of operating systems, such as Windows, Mac OSX, Linux, etc.—represents approximately “1,000 person-years of effort”. The book was published in mid-2012, which was more than three years ago now, so that number would already be significantly higher.

Let’s do some simple arithmetic:

y = ( number of years )
d = ( number of days per year )
h = ( number of hours per day )
t = ( total number of hours )

t = y * d * h

y = 10 yr
d = 365 day/yr
h = 24 hr/day

t = ( 10 yr ) * ( 365 day/yr ) * ( 24 hr/day )

t = 8,760,000 hr

Assuming that a standard year’s worth of work is comprised of 2,000 hours of labor—and I feel obliged to point out that this is a number at which some people would scoff—it would take one person 4,380 years to match the amount of time that was committed to this technology back when those words were put into print.

On a somewhat related note, I find it interesting that the authors chose the term “person-years”, as if the fellows on the Java team are something other than human. Perhaps I’m reading into this too much, but it may suggest that the Java Virtual Machine was made by aliens… or dogs… or maybe very intelligent hamsters?

From Bango-Bongo-Bingo to Led Zeppelin

It’s interesting to me the ways in which Computer Science exams attempt to deceive students. The trick that sometimes gets me is the unnecessary-answer-inversion modification: start out with a mostly straightforward question and make the correct answer the opposite of what would be expected.

from-bango-bongo-bingo-to-led-zeppelin-000001-formatted

The example above contains a second artificial layer of difficulty through the use of nonsense words in an inheritance hierarchy. After reading the code, any reasonable person would question the name Bango and how it relates to a Bingo and Bongo. It’s at this point that one must accept the game that’s being played between the educator and the learner. Sadly, induced cognitive stutterings are one particular result of the malformed educational transaction that is occurring.

Another trick that works on me 100% of the time is the unnecessary-details-about-awesome-rock-and-roll-band modification:

from-bango-bongo-bingo-to-led-zeppelin-000000-formatted

In this case, I started thinking about how I would much rather be playing bongos along to Houses of the Holy icon-external-link-12x12 icon-search-12x12 than taking this stupid test.

Ruminant Ruminations

After spending the weekend poring over programming texts and technical articles, I brought up a dictionary website to quickly investigate the subtle but very important difference in meaning between the words superfluous icon-external-link-12x12 and extraneous icon-external-link-12x12. I take notes when I am studying and regard each unfilled Post-it as an opportunity to better articulate whatever idea is being presented to me by an author. Aside from being an effective learning device that also enhances a book’s usefulness as a reference, this approach makes it possible to gauge the overall quality of the source material. In general, extra work done on my part to complete a lesson exposes a book’s incompleteness. In this particular case, I was not correcting the author or expounding an idea but simply augmenting the original statement, which went something like this: in a Java program, writing a subclass can be superfluous—and not extraneous—when an anonymous class can be used instead. Here is the code-representation of a pen, the well known and commonplace writing utensil, and how it’s behavior can be changed in a computer program using an anonymous class:

class Pen {
  public void write() {
    System.out.println( "Writing with a pen!" );
  }
}

class Lecture {
  // COMMENT:  This anonymous class produces cleaner code by
  //   extending the Pen class and overriding its procedure
  //   write(), giving it new behavior.
  Pen pen = new Pen () {
    public void write() {
      System.out.println( "Writing with a pen in a lecture!" );
    }
  };
}

Like any popular dictionary website, the one I frequent provides a Word of the Day on the front page. The appeal of a Word of the Day showcase is that people find it entertaining to discover words that they have never or rarely seen or heard before. Normally this is just for entertainment, but some people take it too far and memorize these words so that they can inject them into conversations with their peers. The goal, of course, is to fool others into thinking that Mr. Word of the Day is more intelligent or better educated than everyone else. However, it doesn’t always pan out, as shown in this made up but entirely plausible example:

Mr. Jefferson: “So John, anything interesting happen lately?”
Mr. McStevens: “Well Earl, I spent yesterday at work, went to the gym to play some racquetball afterwards and somehow discombobulated my shoulder.”
Mr. Jefferson: “Sorry to hear that John. It sounds… painful. I hope you get that worked out.”

It is usually necessary to make sacrifices in an uncommon word’s dictionary meaning in order to wedge it into common, everyday dialogue. I’m always reminded of the movie Mary Poppins when this happens: for some reason, saying supercalifragilisticexpialidocious makes children feel more intelligent. In the same way, forcing big words into a trivial conversation makes small-minded adults feel like they are somehow superior to others.

Needless to say, I find the whole Word of the Day silliness to be most irritating, especially when something like this happens:

ruminant-ruminations-000000-formatted

Reading this after many consecutive hours of processing literal meanings from dense technical material in front of a computer screen really does something strange to a person’s brain, such as imagining sheep writing poetry in a field on a sunny day.

ruminant-ruminations-000001-formatted

Here is a summary of my drawn-out thought process after reading this not-so-carefully-composed Word of the Day definition:

A pen for sheep? That doesn’t sound right, but there it is. Maybe it’s possible. After all, the world is a really big place and has all kinds of interesting critters in it. Maybe they have intelligent sheep in the more remote areas of Europe..? But sheep that can write? No… that can’t possibly be correct. If sheep can write then certainly dogs can write, but I have never met a dog that can write. Wait a second… maybe the pen is a special name for a farm tool that maintains a sheep’s hooves? Okay, that might work. Do they ride sheep in Europe? Etc. Etc.

It took nearly five minutes for my brain to paint a mental image that was different than the illustration above, or one of an Icelander riding a saddled sheep into town for road supplies. Another 30 minutes passed before I remembered why I went to that damned dictionary website in the first place. When everything was said and done, I burned through almost 45 minutes of my day confirming to myself that sheep can’t write and trying to remember what the hell I was originally doing.

Cross Purposes

As I prepare to test for my Java certifications, I am frequently reminded that patience is not always a virtue. See below:

03. class Alpha {
04.   static String s = " ";
05.   protected Alpha() {
06.     s += "alpha ";
07.   }
08. }
09. class SubAlpha extends Alpha {
10.     private SubAlpha() {
11.       s += "sub ";
12.     }
13. }
14. public class SubSubAlpha extends Alpha {
15.    private SubSubAlpha() {
16.      s += "subsub ";
17.    }
18.    public static void main( String[] args ) {
19.      new SubSubAlpha();
20.      System.out.println( s );
21.    }
22. }

What is the result?
A.  subsub
B.  sub subsub
C.  alpha subsub
D.  alpha sub subsub
E.  Compilation fails
F.  An exception is thrown at runtime

Answer:  C is correct.  Watch out, because SubSubAlpha extends
Alpha!  Since the code doesn't attempt to make a SubAlpha, the
private constructor in SubAlpha is okay.

Yes, I must concede that I got this particular question wrong. And you know what? I’m not going to lose a bit of sleep over it. While I regularly use private constructors in my classes, I have yet to use them in tandem with any descendents of said classes. If I was willing (or perhaps able) to spend more than two or three minutes on the problem during the exam, the private constructor would have received additional scrutiny and led me along a path to the correct answer.

The point is this: I could have made the investment of an hour and I never would have noticed the SubSubAlpha extends Alpha bullshit, which serves as a nearly instantaneous escape hatch for the inexperienced and superficially intelligent. People who write obnubilated code and excel at these types of questions are the kind you want working for your competitors, not with you.