Monday, December 2, 2013

Star Trek plot holes that annoy me

I love Star Trek, but that doesn't mean that I'm oblivious to its flaws. Specifically, there are some issues with some storylines that really get to me. I thought I'd call a few of them out and provide my alternate story.

Probably obvious, but spoilers follow the jump.

All of TNG: Riker is always and forevermore Picard's XO.

Commander William Thomas Riker was the executive officer (XO) on the USS Enterprise for seven series of TNG and four movies (in Star Trek time, from 2364 to 2379, 15 years). That's a long time, even in Star Trek lore. Various people mention how long he's held the position and that it's kind of weird. He'd been offered commands three times and turned them down each time. Was Picard's Enterprise really that amazing to serve on? The answer the show/movies give is "yes", but I've got a better answer.

He's an asshole who only Picard really tolerates.

Let's look at the times he is given command. When he's commanding the Enterprise against the Borg, he constantly clashing with his XO, Shelby, to the point of treating her like crap. He even shouts her down a few times. Not particularly captain-esque behavior, eh? What about when Captain Jellico is temporarily given command of the Enterprise? It took Riker all of 10 minutes to get him dismissed as XO.

When he's in command, do you ever see him confer with the senior staff? That is, aside from Best of Both Worlds, when it's already become clear he needs help.

It would have made so much more sense for Riker to have been a difficult-to-work-with asshole than for him to constantly refuse promotion like a 24-year-old hanging around his high school.

Star Trek: Generations: Crusher explains a joke to Data; Data pushes her into the water.

This is a really minor thing, and yet it bugs the crap out of me.

Star Trek XI: Alternate Universe Kirk opens fire on the mid-black-hole Nerada.

This is just dumb. The Romulan ship Nerada is caught in a black hole. Anyone who knows anything about black holes knows you cannot escape them, particularly if they form in the middle of your ship. Why waste a single torpedo? Further, why risk your ship? They almost get sucked into the black hole themselves.

I get that Kirk was a punk kid and Spock was too angry to think straight. But, you know, there were a few other officers on the bridge who could have piped up. It would have taken nothing away from the movie to have the Enterprise turn tail as soon as Nero turns down the offer of help.

Star Trek: Generations: Kirk dies on Veridian III after a fist fight with Dr. Soren. 

This one is the worst. Captain James Tiberius Kirk, the man who thwarted General Chang's plot to incite war between the Federation and the Klingon Empire, the man who outdueled Khan in the Mutara Nebula, ends up dying on an essentially meaningless planet. Not only that, but Kirk left the Nexus, a place that literally gives you whatever you want. So he gives up a literal heaven because Picard decided that two is better than one in a fist fight.

Gah! What a disgraceful way for the writers to send off Kirk.

Here's what should have happened. If you recall, Picard had agreed to a prisoner exchange; himself for LaForge, as long as the Duras sisters sent Picard to the surface first. Once in the Nexus, Picard taps Kirk and brings them back to the moment Picard confronted Soren.

What a dumb move by Picard. He could have gone anywhere, at any time, and he chose to only go so far back as to have a two-on-one melee with Soren. He should have gone back to before the prisoner exchange with the Klingons (I assume he's not going to super-blatantly violate the temporal prime directive and go back WAY farther). He'd already agreed to the exchange, and so couldn't send a random old dude (it's highly unlikely the Duras sisters would recognize, let alone accept who Kirk was). So Picard would have Kirk go back to the bridge with his legendary combat experience to aid Riker and crew fight the Klingons. Picard would do what he could to stall Soren while Kirk and Riker attempted to gain the upper hand against the Klingons.

Picard would have instructed Riker to work with Kirk, but it would become clear once the Klingons fired that Kirk was the better tactician, and Riker would cede command. The same pitched battle would ensue, with the Klingons firing through the Enterprise's shields. However, instead of exploiting some weird cloaking shenanigan to force the Klingons to cloak, Kirk would come up with some badass maneuver to give the Enterprise the upper hand.

However, mid-battle, something would happen that would force most of the bridge crew to evacuate (and let's say data was already off the bridge for whatever reason). But Kirk would stay, leading the ship to victory, and give his life in the process.

There are plenty of problems with Generations, but Kirk's death is by far the worst.

Tuesday, November 26, 2013

A Long Post for a Simple Rule

The other day, my buddy Ryan asked me a question about a program he was working on:
Ryan: so say I have three lists of (different) objects in a helper class to deserialize JSON to
Ryan: then these objects get saved to a database
Ryan: in the current version of our platform, all three of these lists will be populated, but in the previous version only two lists get populated
Ryan: would it be better to create a new helper object just for the backwards-compatible API call? or use a variety of if statements to check whether that one list is null or not and update the DB accordingly?
 As I mentioned in my post on the XY problem, I needed to get more into the details about the problem:
Ed: umm
Ed: depends?
Ed: you're adding a new list to this object?
Ed: or was it always there, but is sometimes filled?
Ryan: basically JSON data from a HTTP request is automatically deserialized into an object, and depending on API version a client will either send 2 or 3 arrays of objects
Ryan: would you create two different objects to deserialize to or use one object and just check whether one of the lists has been populated
At this point, I was pretty sure what it was he was trying to do. He was rewriting a service with a new API, but it had to be backwards compatible. But we were still talking about a problem one level removed from the important issue at play: changing the API.
Ed: is the api changing? is the client changing?
Ryan: the API is changing, but the client may not change
Ed: So the question you have is, On the backend of the API, do you create separate classes to represent data for APIv1 and APIv2?
Ryan: right
Ed: what does APIv1 send
Ed: right now
Ed: 2 arrays or 3
Ryan: v1 sends 2, v2 sends 3
This is a sneaky issue. One might think that changing an API to send additional data back is not really a breaking change. I mean, if they're still getting X and Y, who cares if they get Z as well?

You should care! You can't predict how someone else will use your API. Maybe they'll write some terrible code that would throw exceptions if there are three arrays returned. Even if the consumers of your API are your coworkers, you have to expect that your consumers will rely on every single thing your API does.

And so, I began to dissuade Ryan of his folly:
Ed: so if you use the same object, you'd change APIv1?
Ryan: no, v2 only extends on v1, doesn't change it
Ed: but v1 sends 2 arrays now. if you make it send 3 arrays, you are changing v1
Ryan: I'm deserializing to the same object via two different controllers in two different namespaces
Ed: doesn't matter. Don't change v1
Ed: and changing the return value, even if it means adding an always-empty array, is changing the API
Like I said, this one's sneaky. We as programmers tend to think about how we would use our own code. But an API, even if only available to a limited set of people, is a public interface, and people will do dumb things with it.

Conclusion:
Ed: a good rule of thumb is Never change the API
Ryan: yeah I guess I would be changing it, wouldn't I
Ryan: damn
Ed: yes
Ed: that concludes today's lesson

Thursday, November 21, 2013

Two Cents is Too Much: Ender's Game

It's about time I reviewed something again! Here comes Ender's Game, only the most celebrated scifi book in forever (citation needed). If you haven't read the book*, fair warning: there's a ton of spoilers below the jump. Even if you saw the movie but didn't read the book, there are still spoilers.

* And if you haven't read the book, go read it. Now. It's the only book I've bought multiple copies of solely to loan out to people to read. All of my copies are out at the moment, so you'll have to ask someone else. 

I wish I got the Federal Network with my cable package.
But before I get into the review, I wanted to unveil my new plan for reviewing things. I've been trying to find a way to encapsulate two separate axes of rating. The first is hype vs. reality, expectations vs. inevitable disappointment. The proto-idea had been bouncing around in my head for a while when I finally read the Movie Plus-Minus* post by Joe Posnanski. The idea is that we as humans judge things not by their absolute value, but rather their value relative to our own expectations. You know you've had that thought; you were so excited to eat that burger, watch that movie, read that book, that when you finally eat/watched/read it, the burger/movie/book was unable to live up to your expectations. And you've had the converse as well; picking up something you expect to be mediocre at best, only to be blown away.

* Posnanski** took the name "Plus-Minus" straight from the Fielding Bible, which makes sense, as he writes a sports blog. I prefer to call it the "Hype-O-Tron". 

** Whenever you see an asterisk followed by an italicized comment on this blog, it's a Posterisk, and I totally stole it from him. The guy is brilliant, if not for his sports writing, then for his writing style in general.

The other axis is quality vs. enjoyment. Sometimes we really enjoy terrible things. Other times, we look at world class works of art and say, "Eh, I'd rather clip my toenails" (I'm looking at you, Citizen Kane). For example, Starship Troopers is not a quality movie*. The acting is sub par, parts of the plot make no sense, and the execution of all the actors (save NPH) it pitiful. Yet I can watch that movie anytime. It's definitely a comfort movie for me.

* If you get a chance, read the book. It's so much better than the movie in terms of quality, yet it's still eminently enjoyable. 

Two axes, you say? Sounds like a job for a graph!

No one ever accused me of being good at graphics.
So you can see, Starship Troopers was far lower quality than I expected, but I enjoyed it even more than I thought I would.

Now, on to Ender's Game (after the jump, you know, to hide them spoilers).

Thursday, October 17, 2013

Upcoming Blog Posts

I've got quite a few blog posts that I want to write, and I figure that if I write down the ideas here, I might feel obligated to finish and post them. So here's the list:
  • Media Swap
  • Nation of Criminals
  • Star Trek Plot Holes That Annoy Me
  • Sneaky API changes
  • Positions on X
  • Student Loans and You
  • My Withdrawal from Caffeine
  • Quantifying Customer Service
  • Games and Narrative
  • Books, Media, and Loss
I have probably another 30 blog post drafts saved, but I figure I'll never really get back to them. 

Wednesday, October 2, 2013

Funeral Arrangements

Here are the funeral arrangements for dad:

The wake will be at Vander Plaat Funeral Home on Thursday, October 3rd, from 2-4PM and 7-9PM.

We'll be holding an open house/celebration at my folks' house on Saturday, October 5th, from 3-7PM.

Dad didn't believe in big church services for funerals; he just wanted people to have a good time.

Here's his obituary, if you're interested.

Tuesday, October 1, 2013

All Good Things...

On October 1st, 2013, over the night, dad passed away.

Thank you all for your wonderful words and support.

I'll be sure to post here when the funeral arrangements are set.

Monday, September 30, 2013

Death Smiles at Us All. All a Man Can Do is Smile Back

It's looking like dad's time on this planet is coming to a close. He hasn't woken up since he fell asleep on Saturday night. Hospice is here, and we're all making sure he's as comfortable as can be. We're making arrangements to have his brain donated to NICHD, which is what he wanted. Otherwise, we're just waiting for the inevitable. But, as Captain Kirk said:
How we deal with death is at least as important as how we deal with life, wouldn't you say?
Post title is a quote from "Gladiator", one of dad's favorite movies.

Monday, September 23, 2013

Lighting the Batsignal

A while ago, I tweeted that Dan Solovay had asked me a question about Sitecore, and that I had the answer. Because Dan can't be the only one with this question, I figured I should post the question and answer here.

The question had to do with item sorting. By default, when you insert a new item, Sitecore will sort it alphabetically among the existing siblings. You can then move the item up or down in the content editor (via the sorting options or the super cool keyboard shortcut, ctrl + shift + alt + up/down).

There is another option built into Sitecore for sorting items. You can configure Sitecore to show the items in date order (which is what Dan wanted). However, when you enable this option, you lose the ability to manually override the sorting (which is not what Dan wanted).

And thus, the Sitecore MVP came to me, using the call normally reserved for either trouble in Gotham City or help needed from a Sitecore MVP.

My suggestion was to add a processor to the item:added pipeline and, in that processor, adjust the sort order field on the items. It's more work than a configuration change, but it definitely would work.

I threw together some sample code that would just make sure the new item is added at the top of the item list:

public class EditSort_ItemAdded
{
  public void OnItemAdded(object sender, EventArgs args)
  {
    if (args == null)
      return;
    var item = Event.ExtractParameter(args, 0) as Item;
    if (item == null)
      return;

    SetSortOrder(item);
  }

  protected void SetSortOrder(Item newItem)
  {
    var parent = newItem.Parent;

    var children = parent.Children.ToList();

    int minSort = Convert.ToInt32(children.Min(c => c.Appearance.Sortorder));

    using (new Sitecore.SecurityModel.SecurityDisabler())
    {
      newItem.Editing.BeginEdit();
      newItem.Appearance.Sortorder = minSort - 10;
      newItem.Editing.AcceptChanges(false, true);
    }
  }
}

So that's it. Certainly not an epic save, and I'm not sure it's the best answer, but it made my day nonetheless.

Sunday, September 22, 2013

After All, Number One, We're Only Mortal

I posted this on Facebook a few days ago, but I figured I should post it here as well.

So, I guess it's time to go loud with this. My dad has been suffering from brain cancer for almost two years, but it seems like the cancer is going to win. It's glioblastoma, a particularly vicious cancer, but we thought dad had a better chance because we caught it very early. However, despite surgery, chemo, radiation, clinical trials, and even homeopathic remedies, the cancer still won.

I wanted to share this publicly because I know that I've been acting different lately, and people have begun to notice. Dad wanted to keep this quiet because that's the kind of guy he is. But I think at this point, it's worth letting everyone know.

Before anyone asks, I can say there's not much that anyone can do to help out. If you're near my folks, I'm sure they'd appreciate a visit. Other than that, please keep dad in your thoughts and (if you're religious) prayers.

Thank you to everyone who has been helping us out already; the level of support we've received has been wonderful.

Dad's been an incredible father to us all; we love you and will miss you, old man.

Post title is one of dad's favorite quotes from Star Trek. 

Tuesday, September 3, 2013

Star Trek's Best Non-Captains

Trekkies have long argued about who is the best captain, Kirk or Picard, and what is the best ship. I'm not going to wade into that mess (Picard, 1701-A), but I was thinking: no one ever talks about the rest of the crew. It takes more than a captain and a ship to save the galaxy.

I've got every crew position listed here, as well as some other non-positions that exist in most of the shows. I'll be looking at the five main shows that got significant airtime (so I'm not including the Animated Series or Final Frontier), as well as the movies: Star Trek: The Original Series (TOS), Star Trek: The Next Generation (TNG), Star Trek: Deep Space Nine (DS9), Star Trek: Voyager (VOY), Star Trek: Enterprise (ENT). It's worth noting that TOS and TNG have an unfair advantage, having by far the most screen time.

N.B. Sometimes I had to make assumptions as to who was in charge of a particular position. In these cases, I italicized the character's name to make it clear they are not a clear choice.

XO: Spock, Riker, Kira, Chakotay, T'Pol

Is there any contest?

Spock
There is an old Vulcan proverb: Only Nixon could go to China.
I grew up with Riker as the XO I knew and loved, as TNG was the Star Trek on TV when I started watching. But then I saw Star Trek VI in the theater. Spock would win this competition based on his performance in that movie alone. If you need me to explain any more of why Spock wins here, you should just stop reading and watch Star Treks II, III, IV, and VI. Or, hell, the Reunification two-parter on TNG.

I'd give Kira the nod for second place. She makes an excellent counterpoint to Sisko's emotional wrangling and firm commitment to the principles of the Federation.

Science Officer: Spock, Data, Jadzia Dax, Kim, T'Pol

Believing oneself to be perfect is often the sign of a delusional mind.
Apparently, humans are not all that good at science. This one is a tough one. I don't really want to give Spock wins in the first two categories, but he's such a great science officer. In the end, though, I have to give Data the nod, as he not only is the science officer, but is a science experiment himself.

Chief Engineer: Scott, La Forge, O'Brien, Torres, Tucker

I love Geordi. Love him to death. I love LeVar Burton too. I mean, look at this tweet:


Amazing, right? The problem is, La Forge is a fairly one-dimensional character. I blame the writers for this. There are only a few times when he gets an actual story for himself. He has the Brahms storyline, the bit with his mother, and a few other notable story moments (his eyes on the Ba'Ku planet). Interestingly enough, one of his best episodes is where he teams up with our winner, Scotty.

I'd like to get my hands on her "ample nacelles," if you pardon the engineering parlance.
This is the first award I'm giving that was significantly influenced by the alternate timeline of Star Trek XI. Simon Pegg nails it; he must have studied James Doohan's performances religiously. Between the canonical and inaccurate "Beam me up, Scotty," the classic Scottish accent, and all of the pop culture references, Scotty has to be the winner for Best Chief Engineer.

RIP, James Doohan.
Chief Medical Officer: McCoy, Crusher/Pulaski, Bashir, EMH, Phlox

This was a tough one, but not because they are all great. Really, they all are pretty meh. They all have their perks. McCoy is a great ornery bastard and has the classic line: "Dammit Jim, I'm a doctor, not a ____!" Crusher has the interesting backstory with Jack and Picard. Bashir has the whole genetically engineered storyline, along with the Section 31 links and brofriend O'Brien. The EMH's struggle with transformation from an emergency short-term backup to a full-time chief medical officer. And Phlox well, Phlox is just this cuddly Denobulan with a cheery bedside manner and three wives. 

In the end, the doctor that I'd most want treating me is the EMH.

Please state the nature of the medical emergency.

Tactical/Weapons: Checkov, Worf/Yar, Kira/O'Brien/Worf, Tuvok, Reid

If you were any other man, I would kill you where you stand!
Worf wins this category because he's clearly the most badass of the options. As much as I love Checkov, he was kind of a wuss as a weapons officer. Tuvok was more interesting in his role as Janeway's 2nd officer, and Reid, well, kinda sucked. Worf runs tactical on the Enterprise-D, and he captains the Defiant. He's a badass Klingon warrior. And this all in spite of getting shot down left and right.

Helm: Sulu, LaForge/Ro/Crusher/Redshirt, N/A, Paris, Mayweather

OH MY
From this point onward, the competition thins, as not every crew has a reasonable competitor for the position. And on top of that, two of the three full-time helmsmen are boring characters (Paris and Mayweather) That said, Sulu doesn't need the reduced competition to win this category. To be fair, he wasn't that memorable in his TV series... well, except for one notable episode:

The only Starfleet officer to go topless (beside, you know, the dozens of times Kirk loses his shirt)
But it's the movies (1-6 and prequels) that nail it for Sulu. Between freeing his captainsaving his former captain, as well as wielding the best future sword since the lightsaber, Sulu wins best helmsman.

Security Officer: ??, Worf/Yar, Odo, Tuvok, Reid

Only one of these people has the sole responsibility of security, and he's our winner.

Doctor, if a Klingon were to kill me, I'd expect an entire opera on the subject.
Constable Odo is an amazing security chief. Hell, if we only had season one of DS9 to rely on, I'd still pick Odo for the way he deals with Quark.

Counselor: McCoy, Troi, Ezri Dax, Neelix, ??

I grew up with Counselor Troi, but she seemed more useful to the ship with her empathic abilities than with her actual counseling. One of these made a very important contribution to their crew in the counseling field...

As they say on Talax: "Omara s'alas - Good news has no clothes." 
Technically, Neelix was the (self-appointed) morale officer, not a counselor. Still, I'd argue he did more for his crew's mental health than any of the official counselors (especially Ezri).

Communications Officer: Uhura, Sato

I guess Starfleet's universal translator tech improved such that communications officers were no longer necessary by the time of TNG. Makes sense; the universal translator was improved to the point where a dedicated communications officer was no longer required. I'm throwing a curveball here:

Math is just another language.
Uhura is the easy choice, but if you took the time to actually watch Enterprise, you'd see that not only is Sato a deeper character, but she's also much more badass at the whole language thing. Remember Star Trek VI? Uhura couldn't even speak Klingon (of course, the alternate-timeline Uhura can). In the end, only one communications officer became empress:

You're speaking with Empress Sato. Prepare to receive instructions.
Token youth: Ensign Ricky Redshirt, Wesley, Jake, Kes, Mayweather

OK, real dregs here, but this category must be addressed. As much as I love Wil Wheaton...

But I'll always remember it as something more - as the place I learned that the line between courage and cowardice is a lot thinner than most people believe. 
Jake grows up. He's a little kid at first, pissed that his dad moved him across the galaxy... again. But he gets used to the station, makes friends, and makes the bold decision to stay on DS9 as a reporter when the Dominion took it back over.

Comic Relief: Checkov, Barclay, Quark/Rom, Neelix, Trip/Phlox

This is a real tough one. Really tough. I was all set on my choice before I spoke to my friend/best-trekkie-bro Joe, and he almost convinced me to change. Almost.

Doctor! My capillaries are shrinking! 
Quark and Rom are designed for humor, and they are hilarious. If you think I'm wrong in choosing Reg Broccoli, I won't begrudge you. But Barclay is hilarious without trying to be, and he's far more human. AND he was on two series', TNG and Voyager (yes, Quark had a cameo in the premiere of Voyager, but that doesn't really count).

Non-Spock What-Does-It-Mean-To-Be-Human Character: Data, Odo, Seven of Nine/EMH, T'Pol

It seems that every series after the original had a character who struggled with humanity. The struggle was more prominent in a few of these characters, but in the end, it was always Data.

0.68 seconds, sir. For an android, that is nearly an eternity.*
If I need to explain this, you're not a trekkie.

* Of all the images I got for this post, this one was by far the hardest to source. Normally, between Google Images and Memory Alpha, I had no problem getting the picture I wanted. However, I was only able to find two versions of this shot; one that was badly distorted, and one that had anti-hotlink text pasted all over it. In the end, I had to get out my DVD (it was still in the shrink wrap; I hope it wasn't valuable) and take my own screencap. Though, as I type this, I just realized I get the movie for free through Amazon Prime. Oh well. 

Non-Kirk/Picard Captain: Sisko, Janeway, Archer

Hey, the other captains need some love, too! These three all have great traits. Sisko embodies the moral philosophy of DS9 (more Kantian than the others) by being willing to do the dirty work to get the right outcome. Janeway is the exact opposite; she never betrays her moral compass on the way back to the Alpha Quadrant (though she does lose it when dealing with the Equinox). And, though he gets a lot of flak, I have to give Archer credit for being a truly dynamic character. He starts off as this starry-eyed captain, thinking about how great the world is. Then the Xindi come and bust down humanity's door, and he transforms into a badass dude willing to do anything to save earth.

There's coffee in that nebula.
I choose Janeway because of her moral compass and because she brought her ship and crew back home from 70,000 light years away. I wouldn't argue if you prefer Sisko, however.

Sex symbol: Uhura, Troi, Mirror Dimension Kira, Seven of Nine, T'Pol

You know I had to go here, right? Well, here it is. Who's the best sex symbol on all of Star Trek? Well...

One or both?
I bet you didn't see that coming, did you? I mean, he made an asexual being attracted to him. How much more sexual can you get?

Tuesday, August 27, 2013

Testing, Testing, Can You Hear Me Now?

My mother gave me her old Kindle Fire (first generation) a few months back, and I've been trying to find new ways to use it. I removed the default OS and installed Cyanogenmod (as it was the only mod I had any experience with). First, I just used it as a sort of phone extension; I'd read my RSS and reddit on it on the train. Then I started reading comics on it (Komik is a great app for that). But I got to thinking: shouldn't I be able to do more with a tablet?

So I looked into getting a keyboard case for it. Turns out, this became a far more complicated affair than I originally thought (I may detail this process in a future post). However, after much pain and suffering and swearing, I finally got a keyboard case working!

And, as you may have suspected, this post was authored entirely on the tablet. I hope that this will help me blog more, as I should be able to write stuff while on the train.

Monday, May 20, 2013

The XY Problem and the Five Whys

Have you ever heard of the XY problem?
What is it?
The XY problem is asking about your attempted solution rather than your actual problem.
That is, you are trying to solve problem X, and you think solution Y would work, but instead of asking about X when you run into trouble, you ask about Y. 
The Problem
This can lead to frustration by people who are trying to help you solve the problem because by the time you ask about it, the solution that you need help with might not have any obvious connections to the problem that you are trying to solve.
It comes up a lot, and it's something you should try to recognize both in yourself and in others. I recently encountered it with a coworker of mine:
Coworker: Have you used the HtmlAgilityPack?
Ed: a little

Coworker
: I can't get it to work.
Ed: what part of it

Coworker: Sitecore apparently has it included?
Ed: it does

Coworker: But I can't reference it.
I was perplexed at this point. HTMLAgilityPack is an assembly included by default in Sitecore installations. In fact, Sitecore itself relies upon it and will not work without it. So I probed a little deeper:
Edthe project should already include a reference to it
Edok
Edso, when you reference it with the using statement, its just not available?
Coworker: Oh.
Coworker: It looks like the sample code I got needs a later version?
Now we're getting somewhere. The problem wasn't that my coworker couldn't get the HTMLAgilityPack to work. Instead it was that he had the wrong version of the assembly. We then thought about upgrading the version of the assembly, but before we did, something struck my mind:

Ed: do you need the latest HTML agility pack? 
Coworker: Probably.
Coworker: At least, the one included doesn't have methods I need.
Ed: what are you trying to do
Coworker: So, I'm trying to take a substring of content, to display in a "Featured Pages" section.
Coworker: But if there are any tags that open in the substring, but close after, the formatting breaks.
Now we're really getting somewhere! We now were both on the same page about what he was trying to do (already a far cry from "I can't get the HTMLAgilityPack to work"). From here it was just a hop skip and jump away from monkey-patching in the method he needed from the newer assembly (for those with a desperate need of closure, the method was "Descendants()"). 

This whole exchange reminded me of the Five Whys:
To reach this sweet spot, we borrowed an idea from Sakichi Toyoda, the founder of Toyota. He calls it Five Whys. When something goes wrong, you ask why, again and again, until you ferret out the root cause. Then you fix the root cause, not the symptoms.
This is basically what the XY problem boils down to, a lack of finding the root cause/problem. However, simply asking "Why" won't really get you to the proper solution in the XY problem case. Employing pure "Five Whys" in this situation would not have gone so well:
  • I can't get the HTMLAgilityPack to work. 
  • Why? It won't compile.
  • Why? The compiler says the methods I need from sample code I found aren't there.
  • Why? The sample code was using a different version of the HTMLAgilityPack. 
  • Why? I don't know, man, ask the author of the sample code!
  • Why? I can't read the man's mind! I don't even know him!
I find it helps to modify the question from "Why?" to "Why is that important?" or "How so?" or "What do you really mean?" when just asking why wouldn't work. . 

To summarize my interaction with my coworker in my modified "Five Whys" method (call it the XY5Y method) would look like this:
  • I can't get the HTMLAgilityPack to work. 
  • Why? It won't compile.
  • Why? The compiler says the methods I need from sample code I found aren't there.
  • Why? The sample code was using a different version of the HTMLAgilityPack. 
  • How do we fix this? Let's upgrade the version of the HTMLAgilityPack.
  • How would that solve the problem? It would give me the methods I need to solve my problem.
  • Are the methods all you need? Well, yes...
  • Is there another way to get the methods? We could disassemble the newer version of the HTMLAgilityPack and monkey-patch in the methods we need
  • Profit!
If you find yourself working with a new programming language or framework (or really a new anything), make sure to question yourself (or your comrade) to find what the real problem is. 

Wednesday, January 16, 2013

Potpourri

I've been playing a lot more PC games lately. I think the reason is a combination of a more powerful computer, really good PC games coming out, and awesome Steam sales and Humble Bundles. Seriously, I think I've bought more quality games in the past six months than I have in the previous six years. The big winners are DayZ (Arma2 mod), Mark of the Ninja, and FTL, but there are plenty more I've played and loved. I intend to give my impressions on some of those games here (Ryan has a great DayZ story here; I was the friend in the story) in the future, as well as maybe some other original content. It's also the first time I've been buying games on spec with the intention to play later.



I have a half-dozen unfinished blog posts about politics that I will never finish. I get really fired up about some things in Washington, and inevitably when I start researching them for a blog post, I find the "answer" I thought is not so clear. For example, I wrote 750 words about job creation, thinking I was some kind of straight-talkin' answer man. Then I started reading to see if I made any sense. Turns out, economics is hard. I did learn that while there is not enough economics in politics, there is entirely too much politics in economics. Not to mention the old joke of "put 10 economists in a room and you'll get 13 different answers." I started regularly reading Paul Krugman's blog on NYTimes; that should give you a good idea of where my politics lie. 



Parenthood is a trip, man. Mia is learning how to manipulate us. For example, she learned that we reacted strongly when she said she was hungry. So now, if she wants to delay us from doing something she doesn't want, she says "I'm so hungry!" What a punk. Pretty darn smart for a 2.5 year old. (She just did it again while I was writing this post.)



I spent about two hours shoveling snow the other day. My neighbors all have snow blowers, but I kind of prefer to do it myself. Part of it is definitely machismo crap; I'm the youngest father on the block, so I can be all "Look at me, the young strong man." But I think the greater part is the serenity I get while shoveling. The task is sufficiently mundane that my brain can wander freely. It's like when I used to drive places with my family when I was a kid, I would love to just stare out the window and just look. Sometimes my mind would wander to the point where I was totally dazed out; I'd snap back to reality and wonder what I was thinking about. I don't really have those moments anymore, but shoveling snow gets me close to them.



The big three games (for me) that came out at the end of last year (Call of Duty: Black Ops 2, Halo 4, and Assassins Creed 3) so far have been a mixed bag. BO2 is good, H4 was mediocre, and I've barely played AC3. I've probably played more FTL than all of them combined. 
All rights reserved. Take that!