Posts Tagged software

Parasite

parasite-smiling

One thing we’ve run into at VMware is that devel­op­ing GTK+ appli­ca­tions can be hard. Espe­cially when cre­at­ing and edit­ing UI ele­ments from code (as opposed to Glade), it’s some­times chal­leng­ing to debug prob­lems. If a but­ton isn’t show­ing up the right size, or some­thing is aligned incor­rectly, it could be any num­ber of problems.

In order to address this, we’ve started devel­op­ment on a new debug­ging tool, which we’re call­ing Par­a­site. The name comes from the fact that it runs in-process with another appli­ca­tion (specif­i­cally, as a GTK+ mod­ule) and infests it with intro­spec­tion capabilities.

There’s a lot that can be said about what it does, but the best place to start is prob­a­bly a screencast.

parasite-introThere’s a lot more infor­ma­tion, some screen­shots, and instruc­tions for get­ting the source at http://chipx86.github.com/gtkparasite/

Tags: , ,

Code Review

A lot of the ini­tial responses we get about Review Board go some­thing like this:

Review Board looks cool, but it’s designed for pre-commit reviews. I don’t like the idea of need­ing review before com­mit­ting, for a num­ber of rea­sons. Can my use case be supported?

The short answer to this ques­tion is “Yes, it’s sup­ported, but our UI isn’t opti­mized for that case.” In par­tic­u­lar, it requires using the post-review com­mand line tool to cre­ate the review request instead of hav­ing a nice web UI for select­ing a revi­sion to review, and it’s almost com­pletely undocumented.

While we’re inter­ested in gen­er­al­iz­ing Review Board into a tool which sup­ports a vari­ety of work­flows, I’m not writ­ing this today to explain how to make it work. I’m writ­ing this to explain why all of you who think this are wrong.

Before I fin­ish my attempts to offend every­one, some peo­ple should leave the room:

If you’re work­ing in an indus­try such as tele­com or aero­space, and you have a very inten­sive code review process to ensure per­fec­tion, this prob­a­bly doesn’t apply. I appre­ci­ate your hard work ensur­ing that the air­plane I’m fly­ing in won’t fall out of the sky, and that I can call 9–1-1 when needed.

Next, if you’re not using ver­sion con­trol, stand up, hang your head in shame, and go set up a server. SVN, Git, Mer­cu­r­ial, it doesn’t really mat­ter.  Visual Source­Safe is maybe a bad choice, though. Seri­ously, ver­sion con­trol is number-freaking-one on the famous Joel Test. Once you’re up and run­ning with that (get a bug tracker too, while you’re at it) you can start think­ing about code review.

Okay, now we’re down to just those enlight­ened, version-control-using hack­ers (ahem, soft­ware engi­neers) work­ing on the sort of nor­mal soft­ware that we do. I promised to offend the rest of you. Here we go.

It’s often kind of hard to define code review, since so many peo­ple do so many dif­fer­ent things. It cov­ers the spec­trum from “occa­sion­ally glanc­ing at a diff when a com­mit mes­sage sounds dubi­ous” to those autopi­lot engi­neers I already told to leave. In the absence of any sort of author­i­ta­tive def­i­n­i­tion, I’ll go with Wikipedia’s:

Code review is sys­tem­atic exam­i­na­tion (often as peer review) of com­puter source code intended to find and fix mis­takes over­looked in the ini­tial devel­op­ment phase, improv­ing both the over­all qual­ity of soft­ware and the devel­op­ers’ skills.

Why should I care?

That’s prob­a­bly as good a def­i­n­i­tion as any, and I almost fell asleep before I fin­ished read­ing it. Yawn. What the heck is this good for, anyways?

The big, super impor­tant rea­son any­one does code review is find­ing mis­takes.  We all make mis­takes, some­times. Even those super­hu­man hack­ers who seem to write 10x as much code as every­one else where every line looks per­fect. It’s really easy to stop really look­ing at code after hav­ing read through it a few times. Ever spent 10 min­utes try­ing to get some­thing to com­pile before notic­ing that you missed a semi­colon? A child could look at that code and tell you what’s wrong in sec­onds. It’s not that you’re dumb (well, maybe), it’s prob­a­bly that you stopped read­ing and started remem­ber­ing.

I remem­ber a paper I wrote in col­lege. I think it was about medieval Japan. My mother offered to read through it for me, and I wasn’t about to refuse some free edit­ing, so I sent it to her. In one sen­tence, I had two “the“s. That’s right. It said some­thing like “In the the Heian court…”. I must have read that para­graph twenty times before I sent it, and I had just stopped pay­ing atten­tion to what was on the page. I said that even super­hu­man hack­ers make mis­takes, and that means even me.

Find­ing mis­takes is pretty obvi­ously a good thing, I think. After sev­eral decades of using soft­ware, peo­ple have pretty low expec­ta­tions for qual­ity. You wouldn’t believe how often I tell peo­ple where I work and they start talk­ing my ear off about how our soft­ware never crashes, and how it’s such a dif­fer­ent expe­ri­ence from, well, almost every­thing else they have to use. It turns out that writ­ing soft­ware is really hard. Shock­ing, I know.

The next big rea­son for code review is train­ing. Most large soft­ware projects have some under­ly­ing archi­tec­ture and design prin­ci­ples which can take some time to learn. One exam­ple that imme­di­ately springs to mind is the way we use sig­nals and slots in our UI code at VMware; this sort of asyn­chro­nous design can take a while for peo­ple to get the hang of, and pro­vid­ing sug­ges­tions dur­ing code review is a great way to get peo­ple up to speed in the con­text of doing real work.

Code review also helps us improve our truck fac­tor. This is my term for “if you were to get hit by a truck tomor­row, how many peo­ple would under­stand the code you’ve writ­ten?” If it’s been peer reviewed, that num­ber will be at least one. Gas prices may be dri­ving down SUV sales, but there’s still a lot of trucks. Be care­ful out there on the roads, guys.

And last but not least, it’s so we can learn from each other. I’ve lost track of the num­ber of times I’ve seen some­thing I didn’t under­stand in someone’s code and ended up learn­ing a new trick. Every­one likes new tricks, right?

How to ruin everything

So, over­all, code review seems like a pretty good thing. We can improve the qual­ity of our soft­ware, train new employees/contributors, and learn stuff all at the same time. Now lets look at how peo­ple do it wrong.

The first extreme I’ve men­tioned is where every­one gets together and pores over some code to find every prob­lem with it. If you’re doing this and your soft­ware doesn’t have lives on the line, stop it. Per­fect code is a nice ideal, but “some­times it is not worth fix­ing a bug.” There’s no way that an entire code­base can be scru­ti­nized in this detail and still live in the fast-paced world of software.

On the other extreme, the eas­i­est way to do it wrong is just not to do it. Sure, you may get an extra few hours a week to surf pornog­ra­phy and make faces at the dude in the adja­cent cubi­cle, but it’s not gonna help the qual­ity of your software.

So, assum­ing that you’re some­where in the mid­dle, and you’re doing code reviews with­out inter­rupt­ing your devel­op­ers’ lives too much with hours of meet­ings, you’ve prob­a­bly fallen into one of two camps: pre-commit and post-commit. There are some pros and cons for each, but to me, the choice is obvi­ous. Here’s why.

In a post-commit envi­ron­ment, a devel­oper makes some change to the code and sub­mits it to ver­sion con­trol. At this point, usu­ally in an auto­mated fash­ion, that change is sent out to the other devel­op­ers. This almost always takes one of three forms:

  1. The com­mit mes­sage and a list of files is sent to a mail­ing list (lame).
  2. The com­mit mes­sage and a diff is sent to a mail­ing list (slightly less lame).
  3. The change is auto­mat­i­cally made avail­able to a tool like Review Board or Trac (okay, I guess)

At this point, those other devel­op­ers can look at the code and see if there’s any­thing they dis­agree with. The big, major, 600-pound hairy smelly gorilla of a prob­lem with this is that /they don’t/. For exam­ple, one of the peo­ple who checked out Review Board and asked about post-commit reviews wrote this:

Sure, some bugs can (and do) creep in because they are missed in larger com­mits where we don’t read the entire email, but I’m not wor­ried because QA should catch those…

It’s exactly the larger com­mits that need the most review! Any devel­oper writ­ing a three line triv­ial bug­fix patch can con­vince them­selves fairly eas­ily that it’s not going to com­pletely fuck shit up (that’s a tech­ni­cal term). It’s a bit harder when the patch is thou­sands of lines and imple­ment­ing com­plex functionality.

Also note that unless you’re work­ing on a pri­vate branch (which is fairly rare), com­mit­ting that big patch before review has a good chance of break­ing stuff. Raise your hand if you’ve done an svn up (p4 sync, git pull, what­ever) and the code you pulled down didn’t build. Or crashed in a super obvi­ous place as soon as you tried to run it. Every­one? Yeah.

The rea­son for this is because most peo­ple are ama­teurs, and those who aren’t some­times get sloppy. Shortly before I started work­ing at VMware, they split the main per­force depot into three sep­a­rate main branches. They couldn’t com­po­nen­tize the code, so they decided to com­po­nen­tize the devel­op­ers into branches based on the orga­ni­za­tion they worked on, in some mea­ger hope of mak­ing it so peo­ple could actu­ally get work done instead of spend­ing all day hunt­ing for a change­set that wasn’t broken.

That’s right, with the most amaz­ing group of hack­ers I’ve ever had the plea­sure of work­ing with, they couldn’t keep *main* build­ing cleanly once there were more than a few hun­dred peo­ple work­ing on the code. I’ve heard sim­i­lar sto­ries from many other engi­neer­ing orga­ni­za­tions that I deeply respect. If they can’t do it, what makes you think that you can?

Real­is­ti­cally, you can’t. Noone can. That’s why we have to take steps to try to pre­vent it. Steps like branch­ing. And, sur­prise sur­prise, code review. And tools. Because if the build is bro­ken, it’s not just you and your QA con­tacts whose time is wasted, it’s every sin­gle engi­neer you’ve got.

Why would any­one want to do it wrong?

So why do peo­ple do this? I’ve seen two com­mon reasons.

REASON NUMBER ONE! “Because that’s how peo­ple are used to doing things.” This is a pow­er­ful rea­son, and I won’t deny that it’s very hard to get peo­ple to change their ways. How­ever pow­er­ful iner­tia is, it doesn’t mean it’s right. It took a lot of effort to get doc­tors to start wash­ing their hands, but I’m pretty happy that it changed.

Num­ber two, and this is the big stu­pid one. “Because we’re a fast-paced devel­op­ment shop, and it would slow us down.” I’ve heard this from sev­eral peo­ple. It’s par­tic­u­larly hilar­i­ous to me, because they talk as if slow­ing down is a bad thing. How many MP3 play­ers hit the mar­ket before the iPod?  How many search engines came and went before Google? Being first to mar­ket is great, but being best to mar­ket is better.

And finally, a sil­ver bullet

So how do we solve this big morass? Sim­ple. Review code before it’s com­mit­ted. If you’ve got branch­ing that doesn’t hurt, com­mit to a branch and review it there, but before it affects any­one other than the orig­i­nal devel­op­ers. Slow down, pay atten­tion to what you and your team­mates are doing, and you may find that you’re not quite so good at what you were doing as you thought. And once you’ve real­ized that, it’s hard not to want to take every pos­si­ble step to improve.

Finally, before you com­ment, keep this in mind: I inten­tion­ally wrote this in a con­fronta­tional tone for my own amuse­ment, and to encour­age peo­ple to talk. I’ve been doing this soft­ware thing for a while, but I don’t have any­where near all the answers. Think I’m wrong about all of this? Let me know!

Tags: , , ,

Open Mondrian?

One of the things Chris­t­ian and I looked at as we were get­ting Review Board off the ground was the tech talk on Mon­drian. At the time, it was dis­ap­point­ing to us that Google had cre­ated this great tool, and kept it inside. Well, it’s still inside, but Guido has just announced a pub­lic code-review project based on the idea of Mondrian.

I played around with the demo server he’s got run­ning, and it’s still pretty rough — a lot like Review Board was back when we first did our first pub­lic announce­ment. Since that time, we’ve had an amaz­ing ride, with lots of con­tri­bu­tions and the build­ing of a fairly vibrant com­mu­nity. I wish the yet-to-be-named Mondrian-like project sim­i­lar luck; code review is one of those things that can be a major drag, and hav­ing an excel­lent tool makes all the dif­fer­ence in the world.

Just as a reminder, if you’re involved in this year’s Google Sum­mer of Code as a mentor/student/organization, we’re offer­ing to host a server for you.

Tags: , , ,

Review Board: post-release madness

Every­one seems to be lov­ing review board. Here’s some of the crazy stuff that’s hap­pened this last cou­ple weeks:

Here’s what some folks using the sys­tem are saying:

Review Board is so awe­some it brings tears to my eyes. We’ve been need­ing this so badly for so long, and now it’s here and it’s bet­ter than my wildest dreams! Thank you so much! Also, thanks for mak­ing it free!

Just so you know, the peo­ple in my team that use Review­Board are lov­ing it! Thank you!

These two emails have had us glow­ing like proud grand­moth­ers. :) Who says open source is a thank­less job?

Tags: ,

Announcing Review Board

Chris­t­ian Ham­mond has a great intro­duc­tion to this project, so I’ll keep this rel­a­tively short.

For the past sev­eral months, the two of us have been using our spare time at VMware (thanks to our man­agers) to work on a web-based tool for doing code review. This is tra­di­tion­ally a big hole in soft­ware devel­op­ment infra­struc­ture, and every­one tries to fill it with things like mail­ing lists or bug track­ers. We got tired of deal­ing with prob­lems such as being unable to eas­ily find out which patches needed review, or los­ing someone’s com­ments deep within our inbox. These prob­lems aren’t unique to com­mer­cial soft­ware either; one of the biggest gripes within the GNOME project is that it’s hard to keep track of every­thing need­ing review.

It’s been a heck of a ride over the last few weeks. We’ve rolled it out inter­nally to two groups so far (Hosted UI, where we work, and Lab Man­ager, who were sim­i­larly fed up with email and decided they wanted to start using this imme­di­ately after see­ing a demo). We finally decided, with a lot of the kinks worked out, that we’re ready to announce it to the world.

Review Board is hosted on Google Code, and released under an MIT/X11 style license. There are lots of good­ies in the source (such as an NIS back­end for django’s authen­ti­ca­tion sys­tem) that we hope are use­ful to peo­ple, even if they don’t use Review Board itself.

And, since new soft­ware can’t be announced with­out screen­shots, here are a cou­ple of the screen­shot sup­port within review­board (for that double-screenshot taste). There are lots more screens on Christians’s announce­ment.

request-with-screenshots-t.png

screenshot-comment-t.png

Tags: , ,

Kids say the darndest things

“When you pro­gram a com­puter, there is a lit­tle piece of your mind and now it’s a lit­tle piece of the computer’s mind. And now you can see it. I mean, the com­puter can be just like you if you pro­gram it to be, your thoughts, your pic­tures, your feel­ings, your ideas, not every­thing, but a lot of things. And you can see the things you think and change them around”

–Deb­o­rah, 13 years old. The Sec­ond Self: Com­put­ers and the Human Spirit

Tags: ,

Announcing libcontrast

A while back, I devised a method of pro­vid­ing named col­ors which could be adapted to any given back­ground color, with a rea­son­able guar­an­tee of read­abil­ity. Any­one inter­ested in the details can check out my pre­vi­ous two entries about it:

There’s been some inter­est in this approach from a vari­ety of peo­ple for dif­fer­ent projects. I even went so far as to cre­ate a patch to put this inside GTK+. Unsur­pris­ingly, this patch hasn’t even been looked at due to the main­tainer shortage.

So, I’m try­ing a dif­fer­ent approach. I’ve cleaned up the code, slapped the MIT/X11 license on it, and put it in a sep­a­rate direc­tory to make it easy to cherry-pick. This is kind of libegg-ish right now, though I’d like to make it eas­ier to have an “upstream”. If any­one has any ideas about mak­ing this more friendly for svn:externals (viz. Makefile.am), I’d love to hear them!

Get it now from SVN at http://svn.gnome.org/svn/xchat-gnome/trunk/src/libcontrast/

Tags: ,

X windows has nearly defeated me.

I’m about at my wits end, and don’t know where else to turn. My dear lazy­web, please come to my aid before I start crying.

I have a toplevel win­dow. I wish to remove dec­o­ra­tions, place it at a spe­cific point on the screen, and give it a spe­cific size. This arrange­ment is so I can have a sin­gle win­dow cov­er­ing mul­ti­ple mon­i­tors in a xin­erama con­fig­u­ra­tion. This doesn’t seem like it should be so hard.
Doing this over a sin­gle mon­i­tor seems to work just fine, at least with metac­ity. My win­dow hap­pily goes “fullscreen”, cov­er­ing the panel at the top, on the mon­i­tor I expect it to. Then, when try­ing to move_resize it to cover both of my heads, things get bad. Attempt­ing to set it to 3200x1200+0+0 gives me a win­dow which is 2721x1200+1600+0 (the min­i­mum width as per gtk size request, cor­rect height, bad X and cor­rect Y). Note that this is tran­si­tion­ing from one screen to both.
Kwin does a lit­tle bet­ter. Depend­ing on which head I attempt, it may go “fullscreen” on the wrong one ini­tially, but it seems to work after that.

Set­ting this win­dow as override-redirect causes all sorts of more-bogus behav­ior, so I’ve pretty much given up on that. Get­ting a new hint into EWMH for multi-head-fullscreen-windows is the cor­rect thing to do, but I don’t have nearly enough time for that right now, and this has to work with cur­rent (and older…) win­dow man­ager releases.

Help?

Tags: ,

VMware Workstation 6.0 public beta

Although it was com­pletely over­shad­owed in the press by the release of the VMware Fusion (the Mac prod­uct) pub­lic beta, we released our first pub­lic beta of Work­sta­tion 6.0 for Linux and Win­dows today, too.

There are a lot of excit­ing fea­tures in the beta already, with more lined up before we hit the final release. I won’t dupli­cate the release notes, but a few par­tic­u­larly neat ones are:

  • The abil­ity to leave VMs run­ning “head­less” with­out a copy of the Work­sta­tion UI run­ning, and then reat­tach to them the next time you start vmware.
  • Multi-head guests — we’ve had a bazil­lion requests for this one, and it’s finally here.
  • Solid USB 2.0 sup­port, for just about any device you own.
  • Drag-and-drop files and copy/paste between your host and a VM.
  • Up to 8GB RAM per VM!

There’s a lot more that can be found in the Release Notes.

And one more thing — Work­sta­tion 6.0 on linux sports a brand-new, super clean-looking, slick, icon-themeable Tango face:

WS6 Screenshot

We’ve still got a ways to go before the final release. I invite you all to go grab the free beta, try it out, and let us know if there’s any­thing we can do to make it better.

Tags: ,

Fyre 1.0.1 released!

After a really long time with­out a release, here’s ver­sion 1.0.1 of everyone’s FPU-abusive com­pu­ta­tional art­work tool!

This release includes a few bug fixes for odd cor­ner cases, some per­for­mance increases, bet­ter over­sam­pling, and a beau­ti­ful new icon by everyone’s favorite Swedish artist, Andreas Nilsson.

fyreimage.png

Get it now at http://fyre.navi.cx/

Tags: ,

Bad Behavior has blocked 97 access attempts in the last 7 days.