Posts

Showing posts from March, 2009

Mercurial Branching

It's easy to do local branching in mercurial . My partner was exploring it for the first time and asked if this was supported in mercurial since it was supported in git . I didn't know, and dug into the the Mercurial book (pdf book) to find the answer. It's really very easy, though the use of update is a little odd. You only really need the update and branch commands, but I include others here because they provide aid and comfort. hg branch Name creates branch Name , and it becomes active on the next commit. hg branch shows the current branch (no param). hg branches shows the local branches. hg update Name switches to the branch called Name . hg tip shows you where you are wrt: branches, etc. hg merge Name merges the named branch with the current one. When you do a commit and allow mercurial to call up the editor, the commit message will be populated with the tip information, so you know for sure which branch you are in. WAIT! these branches are not what you th...

Find Users of method through inheritor

So you have a method defined on an abstract base class, and you are going be messing with it. Someone decided to hang a deep inheritance hierarchy (deep to me means three levels or more) on the class. You want to know who is using an inherited method. What G (Tim Gifford) did was pretty simple, but mighty handy. He just declared an override method on the abtract class's method, and used resharper's methods (show usages, show inheritors). Quick intelligence, little real effort, and you delete the override method when you're done. This is almost as nice as Dave Chelimsky's trick of commenting out a variable declaration in order to see where the variable is used. In VS.NET + Resharper, all the usages turn red. :-)

New Upgrade

Today we had a little upgrade to our internet access. We went ahead and moved from Vonage to Comcast for phone service, and included in the upgrade were a few cable channels and a boost in bandwidth. Channels: who cares. Bandwidth boost: yeee-haw! I'm now 80% faster on downloads, and nearly 5x on the upload. I had an afternoon's worth of remote pairing with WebEx and Skype, and it went pretty well indeed. I'm sure it was just the emotional optimism on my part, but I like to think that the audio and video were smoother and that I had less lag with the keyboard. I still have lag, and sometimes when my partner is refactoring the screen refreshes too slowly and I miss what he's done. Sadly, whomever is on the "hosting" side of things gets to do any work that has a lot of edits in a lot of places. Some funny stuff, though. A change we thought was the "easy bit" took most of the day, and the ugly-seeming part took almost no time at all. I learned som...

Caring About Stupid Stuff

A clear sign of a sick workspace is when people care far too much about stupid stuff , as reported at Tech Dark Side by David Christiansen. Nicely done.

Contractor or Consultant?

Saying it here for future reference: In the software world, the difference between a contractor and a consultant is whether you are paying for obedience or advice. Reference: CIO Matthew Edwards' blog entry.

First glance: SPE and TDD

SPE is a pretty nice python editor. I'm using Ubuntu Intrepid Ibex's default version (0.8.4) and have had pretty good results most of the time. It has nice features like functional auto-completion, file navigation, debugging, UML generation, session history, shell window, tab and syntax checking, etc. Many of these features, sadly, I don't really need. I probably need a bigger project so I can really appreciate the UML and documentation generators. In today's little app, it hardly matters. Overall, it is a very reasonable full-featured editor for python programmers. SPE 0.8.4 suffers from the same malady many of the others suffer from: no real support for TDD. I can switch to a script and run it with Ctrl-R (after making sure I do a save on each file that has changed). I would like to see the next version contain a Save-All feature and a nosetests runner. It would be even cooler if the nosetests runner would fire up automagically after a save or save-all or else in...

Power Of Naming

This is from a moderately recent copy of my Meaningful Names paper, and was translated into Java in the book Clean Code. Here it is in original context with python code examples. The simple act of using a better name (instead of applying a better comment) can reduce the difficulty of working with the code we write. What is the purpose of this python code? list1 = [] for x in theList: if x[0] == 4: list1 += [x]; return list1 Why is it hard to tell what this code is doing? Clearly there are no complex expressions. Spacing and indentation are reasonable. There are only three variables and two constants mentioned at all. There aren't even any fancy classes or overloaded operators, just a list of lists (or so it seems). The problem isn't the simplicity of the code but the  implicity of the code (to coin a phrase): the degree to which the context is not exp...

Probably something stupid...

I kept a mantra for my years in C and C++, and frankly I lost it when I was working in Python (probably a strong recommendation for the language). It is a useful and deeply wise saying, though. You will someday find yourself in a little bit of confusion. A minute ago, the code was fine. You just made a very small change hoping for a very specific effect. Instead, the results you get are completely bizarre. Something deeply strange is happening, and it's not the effect you were looking for at all. The error messages are bewildering and seem totally unconnected with your change (especially if you're in C++ or Java). Take a deep breath. Smile for therapeutic value. Close your eyes for a second, and look at your partner. Repeat the mantra: It's probably something silly and syntactic. This came about today, because we forgot to put a "virtual" on a method we were mocking. We've done this many many dozens of times in the past few weeks, but it's a manu...

Do the Right Thing and Get It Done

Practice - Corey Haines from 8th Light on Vimeo . Looking good, Paul P. Rock on, Corey.

Windows wants to reboot

Sheesh. I'm trying to participate in a webex conference call, and windows wants to update. Then it wants to reboot. No, no, no. I have to get my cursor back from webex and click the darned "Reboot Later" box over and over. Remoters, set your update appropriately! Who knew this would be a bother?

Article about readability of exception test

Readability and exceptions article by Bill Venners is worth a gander. I think his solution is elegant because it's obvious and terse. I love obvious and terse.

Web Cams

People told me that eventually Linux would bite me in the butt. I went a long time without that being true, or never being true in any serious way. I figured when it happened it would be something to do with drivers for some device. Ubuntu Intrepid Ibex is the version that does the biting, and where it bites is the webcam. Normally a webcam is nothing. If you're not doing a home "web cam show" or something, who cares? But now that I'm working from home, it matters quite a bit. I like to be able to see my partners sometimes and participate in meetings a little better. When audio is weak, reading lips a bit helps. But no. Intrepid doesn't do webcams well. Especially Logitech QuickCam Chat models. Nobody has support for it. I'm not rethinking Linux, but I'm rethinking Ubuntu. Maybe I need to go to Debian Testing and see if that works. Linux has many distributions, and their problems don't always overlap. Perhaps another choice will work better ...

Prioritization

The Ryan Martens article on prioritizing is worth your time. Go read it right now.

Clean Code Clarification

There is a confusing edit result in Clean Code on page 25, referring to class names: Class Names Classes and objects should have noun or noun phrase names like Customer, WikiPage, Account, and AddressParser. Avoid words like Manager, Processor, Data, or Info in the name of a class. A class name should not be a verb. Read on its own, this makes it sound like I (or the editors) think "Manager", "Processor", "Data", and "Info" are verbs. Not so. Just an unwanted effect of editing. This is more disappointing than the neutering translation of my code example from Python to Java. I became aware of the sloppy edit through a Sun forum where they were bashing the paragraph a bit, with good reason. Their arguments pro and con had little to do with my arguments, and I would have made clarification on the spot except they wanted me to to register and give a lot of personal information. Still, I suppose there should be a record somewhere of my correcti...

Three Rules for Code Comments

Code comments are a topic which still draws a lot of heat (and an occasional burst of light) in programmer debates. I understand.  If you are dealing with long, complicated functions with dozens of if conditions, many levels of indentation, and a number of design issues all at once then comments are a survival mechanism. They're absolutely an indispensable coping mechanism. Deleting them will make your code many times worse than it is already. In this regard, comments are a lot like the single-exit rule . Also, like the single-exit rule, this coping mechanism is unnecessary when code is small and simple and everything is reasonably well-named. Still, we find many comments that code would be better off without. After spending time in debate, discussion, observation, and consolidation, my friends and I have come to the realization that there are only three important rules governing the use of comments. The Primary Rule : Comments are for ideas cannot be expressed in cod...

Remote Pairing Requires Headsets

When not in group meetings, remote pairing requires headsets on the in-house side. Otherwise, the voices of the partner tends to be no louder than the voices in the bullpen. Good noise rejection is pretty important in a headset. The remote partner should keep the mute button handy. It's important when he wishes to hear all the sounds on the other side, or when the family is up and busy at home (unless he has an isolate office to work in). I would recommend an office with a door, though I don't have one.

"called from" boolean variables considered ugly

One feature I hate to see in any code base (and have seen in several) is the "called from" argument to a function. class EvilPoliticalRobotDouble: Minion { ... public void runForElection(Person replicatedPerson, bool CalledFromRNC=false) { ... } } There are three different reasons that I hate this kind of "feature" and consider it harmful to clean code. The first reason is that it doesn't even hint at what will happen if it is set true v. being set false. What thing will the code do differently? What decisions will it affect? Will it change the transactionality of the function? Behave in a less thread-safe manner? Will it be non-persistent? Will it choose a fast approximation over calculating an accurate answer? Will it choose different sources for the facts it acts upon? A different database? A different configuration file? Will it rely on different global variables (ick!)? Will it choose not to retry failed operations? What? What?? What?!? The second reason...

Bounce Rates

It's a funny thing, but "bounce rates" at Agile In A Flash make me happy. According to google analytics, the "bounce rate" is the percentage of single-page visits. In the case of catalog or business pages, that is a bad thing often indicating that users did not find your site relevant. For Agile In a Flash, though, it more likely means that the user got the card he was looking for, probably from an RSS feed. I would like to see more search engine traffic and a lot more comments, but I take the bounce rate more of a "customer satisfaction" rate. If you come for a card, and you get the card, you're happy. And if you're happy, we're happy.

Skype today

New tip: Skype is more or less half-duplex so noise being picked up by the microphone affects your ability to listen to your remote partner. Adjust your audio settings. Don't let Skype automatically adjust your volume. Set the mic sensitivity down a bit so that your voice still comes through but rubbing your hands together, scratching your knee, or typing softly doesn't interrupt the conversation. The other thing I found on Linux was that the volume setting for capture device was turned up all the way. If I didn't mute the mic, I couldn't hear my partners. I turned this device down and suddenly I have the behavior I wanted all along. I didn't know I had a "capture device" before. Watch for this! Troubles de jure: Finally gave up on skype around 11:08 today. Too many disconnects and audio trouble even when it was connected. Gizmo no better. Google voice & video really eats up my computer but is a more viable choice if we don't do anything b...

Networking problem solved

Image
This greeted me this morning with the cheery news that my network is not sick anymore.

Conference Calls and Remote Team Members

Today was a mixed bag. My code was surprisingly more performant than I expected once we moved a save point. The database handled my subselects better than I expected. I learned a bunch of stuff. I gained application perspective. That was all good. The bad part of the day wasn't bad, so much as frustrating. We tried a conference call for planning. My audio was simply awful. It broke up so that I was missing phonemes from the middles, starts, and ends of words. The mic was not located close enough to all the speakers. I had to try to catch up from the context of people responding. Everyone was really quiet, except the other remote member who had a very strong signal (and thankfully a pleasant voice). It is an unfamiliar app, so I was not able to contribute much to the overall conversation and was a little stymied in trying to learn from the conversation. One thing that bothered me was that my phone handset is not nearly as nice to work with as my computer headset. In the c...

Gizmo5

Today we realized that google voice & video was eating my laptop cpu. It's great, but a bit piggy. By the time you load up resharper , visual stupido and a good sized app, fired up a webex session, and fired up your VPN you find there's not much CPU left to do things like run unit tests and pull updates from subversion . I decided to move the a/v off of my work laptop and use my personal Ubuntu -powered laptop for that. We tried skype first (which worked great) and then gizmo5 . Gizmo is cute. It has hold music (I like the 70s bit) and "blasts" (sound effects you can drop in your conversation) and does a fine job of keeping the voice sounding clean on linux and windows. It doesn't have video in the linux version, but I am not having a lot of luck in Linux with my webcam with any programs. WengoPhone can sometimes use it. I think that Ubuntu Intrepid Ibex just hates the Logitech quickcams. It worked great before the upgrade (when resume from being...

XCopy still works

Just so we all can remember (or find) this later: xcopy in windows has a /Z option to resume in case a file transfer fails. For you WFH types who are stuck in windows, you might save a lot of trouble by using this flag when moving from your remote office server/nas/workstation to home computer over vpn. This is especially useful if the network is spotty.

Home Networking

Image
If your home network isn't quite up to snuff, it will put quite a damper on your pairing velocity. You will be doing a lot of VNC and VPN and screensharing and file transfers. If your normal bandwidth isn't everything you want it to be, just wait until you lose wifi and all your sessions have to be re-stablished. It can take several until you can continue where you left off. Today : I had a download of a scrubbed production database over secure VPN fail multiple times. The method I used for downloading the file did not have a "resume" feature. I had video and audio either freeze up, "stammer", or "flutter" all morning and afternoon. I had my WebEx screen session drop out on me a few times. Twice I had my laptop suddenly drop off the home network. I was in the middle of a quick architecture meeting and dropped out for probably fifteen minutes. I lost time to a short series of reboots because windows was acting all wonky with relationship to t...

Continuing remote pairing & SQL testing

This week has had a lot of network issues. We've temporarily gone voice-only to reduce our bandwidth. We're screen-sharing and voice chatting and hoping for the best. Yesterday was awful, today not so much. We also ran out of free trial for TeamView and LogMeIn (both excellent) and are resorting to WebEx for screen sharing. WebEx works pretty darned well, except that the scroll wheel on any mouse I own sends me immediately to the bottom of the file. Yikes. We also continue to have trouble with colors. I see very low-contrast foreground/background combinations (white on light blue, yellow on white, blue on black etc) but the remote partner sees different, more reasonable colors. These two problems together are a constant dripping faucet. OTOH, the partner is great and we were able to make some progress between stepping on ORM landmines. We test-drove our changes through the API/Business layer, but needed to get our gateway working. We use the strategy of creating a trans...