More Ramblings from a Los Angeles Programmer

May 29, 2007

View from the top

Filed under: daily life — Josh DeWald @ 7:16 pm

I was walking home from work and for some reason I remembered the time shortly after I started working at my current company and needed to access to something. I talked to one of the management guys because I couldn’t find it and he said “Oh, well everyone is supposed to check it so it should be on the list.” I remember laughing to myself and just walking away, because of course nobody actually used the check out list! You had to find the spreadsheet on the shared file system, open it in Excel (assuming it wasn’t locked by someone else, which it probably wasn’t), find the right worksheet and put my name and other details. Or I/everyone could just take it and not fill in the sheet. Which do you think usually happened? Nobody ever filled it out? It was way too inconvenient. When we needed to track something down, we just sent out an email or asked someone who probably had it.

So there was no real incentive to fill in the sheet, and the end goal (getting the item) was still accomplished. There was no “auto check-out” and no gatekeeper (the items were just in labelled boxes). Nonetheless, the manager fellow still believed that the check-out system worked, because, well that was the “policy”. He never had any need to make use of the policy and just assumed it was followed.

When our company first added a VPN to the system, you were unable to use the public internet while on it. How quickly do you think it was before every person became an expert (or became a friend of someone who was) at modifying their routing tables so that the internet could still be used. I’m sure that the upper management in the IT felt safe knowing that the system was “protecting” the network (don’t ask me how… this is not an effective security policy) while everyone on the ground was happily using their computer the way they wanted to. It was too inconvenient to do otherwise! It had nothing to do with just browsing the web, doing our job required us to be able to use Google for technical searches or one of many other necessary sites. The new VPN is simply a plugin for a browser that basically creates some tunnels so you can easily access both the public internet and the private network. I haven’t heard of any problems.

McDonald’s always claims “Service with a smile”. That’s their corporate policy. Do you think the high school kids working for beer and pot money at minimum wage really care about the policy? But no doubt all the way up the line the view is that there’s this amazing customer service.

When I worked at VONS (supermarket in the United States) they had a similar policy. What they also had was a “secret shopper” program tied to a profit sharing system. Only if the store got a perfect score during the “secret” shops did we get part of the profit sharing. I’ll tell you what, there was some “service with a smile” in that place. There was both incentive, and automatic feedback (through scores on the shops) back up to upper management. So there was no way for them to “fire and forget” the policy.

One wonders if this is how we end up with “private contractors” torturing people in Iraq. Officially, I’m sure, the government just wanted some information. And “officially”, we didn’t condone torture. But hey, if the information comes, I’m sure there weren’t a lot of questions filtering back down about how it came about. Sadly, there were also actual service men (and women) involved in humiliation and torture of people. Again, there was no feedback up the top (until there were pictures on the Internet) so if you’re of the mindset to do that sort of thing, why not? I don’t think it has a lick to do with the fact that they were in the military, but rather that happened to be how the got their jollies and there was nobody policing them. Officially though, the government would never condone that. I hope.

So if you’re the policy-making type,  know that people don’t just blindly follow if it’s inconvenient, doesn’t seem to have any tangible benefit, or appears to prevent them from doing something that they want/need to do. If you think the policy must be followed, then you better have checks in place to enforce it. So ask yourself if the extra bureaucracy is really worth it.

May 26, 2007

Economical? No. Necessary? Yes

Filed under: books, daily life, uk life — Josh DeWald @ 8:19 pm

My wife and I try to read fairly steadily. But I was just thinking that the cost to send these books back are probably going to be quite a bit more than I paid for most of them (there’s a local market that I pick up a lot of used books for on average 1 GBP ($2). The ones of the left are what we’ve read since getting here and the rest are “to read”. The rightmost ones actually were ones we sent *from* the US for reference and to read.

Books

I’ve been getting into Stephen Baxter, but I kept ignoring him in the states because I only saw him attached to some Arthur C. Clarke books and I tend to not read books that are co-written like that. Incidentally, Arthur C. Clarke has traditionally been my “favorite” author (I’ve got most of what he’s written fiction-wise, about 45 books or so) but haven’t actually read him in years as he’s been mostly doing the “co-written” stuff. What this means as the ACC came up with a story, and Baxter wrote it. But they are never pitched that way, ACC is in the big letters as if it’s all him. I dunno, just seems slightly misleading. But I digress.

Baxter turns out to write some cool “big idea” books, I’d recommend the Destiny’s Children (yeah, I know. Close, right?) series (Coalescent and Exultant are the ones I’ve read so far) in addition to Evolution (which I just read… very cool hypothetical evolutionary history starting with the earliest primates during the time of the dinosaurs).

Bill Bryson is absolutely hilarious and insightful in whatever he writes. I managed to get Short History of Nearly Everything for 2.50 ($5) at the local market. Very good read and actually goes well with Evolution a bit.

As you can tell, I try to have a fairly eclectic mix of books; I try not to read only SciFi or technical but also “literature”, mystery, thriller, history, etc.

May 21, 2007

Sometimes you just need to read the code (RTFC)

Filed under: coding — Josh DeWald @ 4:54 pm

Someone asked Raymond a question (that dealt with MFC code that he’d never seen or known the workings of) and he solves it by going to the code (which the person asking has access to as well).

Honestly, that’s what you have to do sometimes. In a perfect world, every system will be 100% documented (and the documentation will be easy to find… which is half the battle). But how often does that actually happen? In this particular case, part of the question *is* documented and clearly available.

The code will always tell you exactly what the system is doing (not to be confused with what it *should* be doing), and the code never lies. Every developer should be capable of finding answers to their problems by reading the code in question, assuming they have access to it. I know that sometimes you really just want the answer in a quick way (after all, time is money and all that), especially if someone knows the answer off hand. But you’ll be more knowledgeable about the system you’re working in, in addition to being able to honestly say you’ve looked as deep as you could to solve your problem. You might even find bugs!

Much of the time that someone asked me a question about our system I end up… looking at the code. I’ve done it enough times that I happen to know where to look but I don’t necessarily know the answer off hand. But when I started out, I had obviously never seen the code base (in fact, I’d never even coded in the language it was written in) but reading the code taught me the system. Often the reason I was in the code was to troubleshoot a problem, so I had to figure out what the system was *supposed* to be doing, so that I could make it do that.

Perhaps a new phrase is in order, RTFC. Note that that ‘F’ in that phrase should never been taken as harshly as the spoken version actually sound, but if you can’t help it… RTC.

Update: Apparently RTFC has been coined previously.

May 20, 2007

Never Finished

Filed under: coding — Josh DeWald @ 9:57 am

or… Zeno’s Paradox as an Analog to Software Development

Ask any developer out there if a program is ever finished and they’ll tell you “No, of course not, I still need to…”. But, ask any developer out there if the program is almost finished and, assuming that the development cycle has progressed far enough along, their answer will invariably be “Yes, all I have to do…”. They may even quantify it: “80% complete”. Ask them a couple of days, weeks, months (depending on the magnitude of the project) later and you will get a similar response, but with a different percentage, say 90%. And so forth… but never 100%.

No real point here I suppose, but just the observation that it sounds remarkably like Zeno’s Paradox of Motion. I particularly like the version, apparently invented by Philip K. Dick, about a frog jumping out of a well: every jump takes him halfway out so therefore he can never get out, because there’s always another half (of the previous jump) to go.

And so it is with software development.

May 9, 2007

Acknowledge It’s Broken

Filed under: coding — Josh DeWald @ 8:52 am

Being a software developer (but I don’t think that this necessarily only applies to programming), I often find myself troubleshooting/debugging my code. This is especially true now that I’m messing around with JME (formerly J2ME), which presents its only fun set of issues. But anyhow, anytime I’m troubleshooting I find that the first stumbling block to overcome is to acknolwedge that it’s broken. You know what I mean: you keep running through the application hoping that magically the part that keeps failing will suddenly work. In the C++ world this sometimes happens because of bad pointer usage, but in the Java world you can’t go down that path. When you know it’s broken, really know it, step back and look at where exactly the problem might be. Some questions to ask:

  • Where is the last place the output/data looks correct?
  • What inputs/interactions have taken place since then?
  • Are you using “dummy” data that isn’t well thought-out?
    • Entering ‘test’ for all of your text inputs is not a good idea, how do you know which is really being assigned where?

Some techniques that I find useful (your mileage may vary):

  • Old-school “printf” style logging of important variables
    • This is great because you only see the ones you care about and you can put as much or as little as you want at key points. You can even do complex logic (if that will help, such as testing multiple boolean variables or for a particular value).
  • Run through a debugger
    • I actually haven’t done this in quite a while, when you have a lot going on stepping through is frustrating and you end up missing the point that you wanted or you have *too much* information.
  • Again, don’t forget it’s broken! It won’t fix itself. And if it does, be afraid because it will break elsewhere and probably corrupt data down the road.
  • Write a unit test (because you know you haven’t already done this) for the specific method(s) you think are failing.
    • Warm it up with some “expected” data
    • Throw a curve-ball; if it’s expecting a positive number, throw a negative one at it, or a null value. Give it a text string if it’s taking a character string that it expects to contain a number (e.g. “3”). You can also do the equivalent of assert() on all of these (in Java, I throw a RuntimeException or IllegalArgumentException).
  • Take a few (code) steps back
    • Check the outputs of methods that happen before the one that seems to be failing. There can be a chain reaction of bad inputs/outputs that begin from one small thing.
  • Take a few (real) steps back
    • Take a breather. Go have a drink. Chat with a co-worker. It’s like getting that “second eye” without having to bother anyone. Seriously, this works.

I firmly believe that the ability to troubleshoot is more important than the ability to write the code for the first time. One one of my regular blogs someone wrote that “As soon as you’ve written a line of code, you’re maintaining it”. It was meant in terms of writing clean and readable code, but it also applies to the ability to actually do what it’s supposed to. Readable code that doesn’t work is pure evil; you almost feel guilty about modifying it even though you absolutely must!

Face it, much of your life as a developer is going to be in fixing your, and other people’s, code. It’s time you got good at it.  Think of it as an excuse to truly learn the codebase, you may even find some real gems in that rough: truly poetic code that does exactly what it should.

 Reading List (this stuff will make you a better engineer):

  • Raymond Chen – Writes about problems (and, more importantly, the thoughts that lead to those problems) and how to fix them in terms of Win32 development. I don’t do Win32, but I read it every day.
  • Anything by Steve McConnell, especially Code Complete (now in it’s 2nd Edition). Go buy this right now. If you don’t think it’s amazing, I will personally buy it back from you (but you have to send it me so I can give it to someone else). I have no affiliation with Steve McConnell. Another amazing one is Software Estimation: Demystifying the Black Art. Search for “software estimation” on Google, it’s the second link for a reason.
  • Worse Than Failure (formerly “The Daily WTF”) – Highlights less-than-great-and-perhaps-just-a-little-horrendous code snippets (disguised to protect the not-so-innocent). Admit it, you’ve written some of this code.
  • Hacknot – I stumbled on this a couple of months ago. Not as regularly updated as others, and I don’t agree with everything he says but he’s passionate about what he believes and backs it up with a lot of thought.  Also has a great troubleshooting guide.
  • Salvatore Iovene – Infrequent but of great quality, especially his rant about why many programmers suck and how to fix them.
  • Joel On Software – No reading list can be complete without him. Both the blog and, especially, the book. He also has 2 more books are software writings (basically he edited the best stuff found from the tech blog sphere, but I believe he links to them on one of his entries). Even if you don’t agree with him, he links to some other amazing articles which has helped me grow my daily reading list.

Have any others, let me know! I’m always looking for other insights and views on the art of software engineering.

May 7, 2007

The guy has a point

Filed under: daily life, humor — Josh DeWald @ 8:29 pm

Just stumbled upon “some prepared remarks”, which is basically a bunch of images with some funny commentary/thought. Some damn good stuff.

Just one of many really good ones is about elevator safety notices: Elevator Notices

Decided not to show the actual image for this one, it’s worth visiting.

First Geocaching Adventure

Filed under: daily life, technology, uk life — Josh DeWald @ 6:06 pm

Rachel and I headed into London today to go the “Science of Spying” exhibit at the National Science Museum. I would not recommend it for adults, it really is meant for kids and, possibly, teenagers. But, it get us into London. Before we went something clicked in me and I remembered the concept of ‘geocaching’ where you hide and seek items based on GPS. I figured that would be a great way to spend some time around the museums.

I ended up on the Geocaching website and created a login form myself. There are tons of sites in London so I specifically searched around the South Kensington area. After reading them, I downloaded the .loc file and used GPSBabel to transfer it to my Garmin eTrex Venture. I happened to do GC104M3, GCY0D5 and GCXWJD. I was unsuccessful at the first one, but amazingly Rachel was still willing to walk with me to try to locate the second one which was at a park near St. Luke’s search. We got there and there was a couple hanging around where the GPS unit said the cache was so Rachel and I had to wander around a bit nonchalantly. Blessedly, they left pretty quickly and were locating the cache. It was pretty exciting. It was just a film canister with a piece of paper (the “log”) but it now made us part of this sort of game that tons of people play without the rest of the world being aware. I mean, it really was in plain site for the most part but nobody really notices it. In fact, I’m still paranoid that I didn’t put it back hidden enough, because it just seems so damn obvious.

Because I’m such a nerd, here’s a screencap from Google Earth with our track around the cache. Some of the lines seem a bit stray and I don’t know if those are artifacts of the unit or if Google Earth is off by 25 feet or so (which seems reasonable). I’ve taken off the waypoint for the actual cache.

Geocaching around St. Luke’s

For the second one, GCXWJD we ended up around Sloane Square station at the Royal Hospital (the label for the cache is Chelsea Pensioners but I didn’t see that anywhere). Now that I knew what I was looking for I pretty easily spotted where I thought it might be, even when the GPS lost the signal. Amazingly though, I wasn’t able to locate it until I was sure (when the unit got the satellite back). Again, hidden in plain side. Exciting!

While Rachel wasn’t amazingly enthused, she was more into it after the initial skepticism that came about when I couldn’t locate the first one. It really didn’t help that I had grabbed the camera from the house but forgotten to put the memory chip back into it! She now wants to buy a bunch of buttons to put into the canisters (or whatever is the ‘treasure’) as our sort of ‘calling card’. Works for me!

Anyhow, I’m really looking forward to doing some geocaching around the Woking area, there are apparently quite a few of them. Humorously, people in the area who are not part of the hunt are known as ‘Muggles’ from the Harry Potter series. Seems very appropriate actually. You also get to feel a bit like a spy… grabbing these things without looking too terribly suspicious. Sort of like a dead letter drop, which seems particularly appropriate after having gone to the “Science of Spying” exhibit mentioned before.

May 6, 2007

And they say England has bad weather

Filed under: daily life, uk life — Josh DeWald @ 8:54 am

The view outside our apartment on May 1st (not that that’s the only day we’ve had glorious weather).

From Beautiful Morning in Woking

When we first got here around February, it rained every other day and we definitely wouldn’t go a week without rain. The past few weeks have been awesome. Don’t even need a sweatshirt anymore. It is May, so I shouldn’t be surprised.

May 3, 2007

Some things I can’t live without

Filed under: coding, technology — Josh DeWald @ 8:08 am

There are a few very simple tools and techniques I use every day that save me tons of time and pain. Most of these are command-line type stuff.

  •  CTRL+R – In bash, you can type part of a command line from your history, hit CTRL+R and you can cycle through the ones that match. Basically it’s incremental search for your command history. I use this every single day. Thanks Harry!
  • Tab completion – Not having to fully type a word is quite astounding. To get to Google Reader in firefox I just type ‘r TAB”. Especially useful for long filenames with spaces. The running theme is my own laziness obviously 🙂
  • Remapping of Caps Lock to Control – Fellow emacs users out there will really appreciate this. Seriously, do it. How often do you actually use the Caps Lock to capitalize? CTRL+S just got a whole lot easier. For those non-emacs folks out there, how often do you CTRL+C, CTRL+V or CTRL+F? That’s what I thought.
  • The command line – I guarantee I can navigate directories faster than clicking around. If you’re a Windows user, there’s Cygwin. Seriously, install it. The 4th thing I do (after installing Firefox, AVG and Spybot Search & Destroy) on a new computer is install Cygwin.

Some daily things I use, but are far from being productivity enhancers:

  • Google Reader (or any RSS aggregator) – This could be argued to be a productivity enhancer if you’re already going to read a lot of blogs and comics. Why not have them all in one place and only see them when they are updated? I’ve never been a fan of bookmarks anyhow (except for the Bookmarks Toolbar Folder in Firefox for the ones I use daily).
  • StumbleUpon – My oh my aren’t you addictive. Been using this for a year or two. This is a Firefox add-on toolbar (the most important part is the ‘Stumble’ button) which takes you to a random site based on what others with your same interests have marked as being cool (which you do via the ‘I like it’ button on the toolbar). This is the only add-on toolbar I use. Every person I mention this to comes back to me a day later with how many hours they spent hitting ‘Stumble’. I’ve discovered many of my current blogs via this.

Based on those last two, I really don’t “browse” the internet anymore, it’s all pretty targeted in a sense. Even in StumbleUpon you can set it to just show you Wikipedia articles if that’s your fancy.

One last one:

  • My wife – We are alike in so many ways, but different enough to make it interesting (or frustrating, if you ask her).

May 2, 2007

Good luck, my friend.

Filed under: technology — Josh DeWald @ 12:40 pm

http://09-f9-11-02-9d-74-e3-5b-d8-41-56-c5-63.com/

Older Posts »

Blog at WordPress.com.