Sunday, November 30, 2008
stop refactoring
The term "refactoring" was made trendy a while ago by Martin Fowler, et al. Given that programmers are not generally fans of marketing, it surprises me that what is effectively a marketing euphemism for "rewriting" has become so popular. I think it's time to go back to the olden days, when people called refactoring what it is: rewriting.
Wednesday, November 26, 2008
refactor later
There's a saying in chess, "When you see a good move, look for a better one."
I've found this applies to programming too. Too many times, I've seen something I didn't like in code and rushed to rewrite it. The outcome, very much like when I rush a move in chess, rarely comes out as well as I'd hoped.
So, when you see something that could be refactored, refactor it later. By then, you're certain to have improved in several ways your plans to rewrite.
I've found this applies to programming too. Too many times, I've seen something I didn't like in code and rushed to rewrite it. The outcome, very much like when I rush a move in chess, rarely comes out as well as I'd hoped.
So, when you see something that could be refactored, refactor it later. By then, you're certain to have improved in several ways your plans to rewrite.
Sunday, October 26, 2008
testpp c++ testing framework
testpp is a new c++ testing framework I've developed. It's meant to be:
* Easy to use
* Simple enough to be used without macros if desired
* Can run individual tests, files or suites from the command line
* Various output formats, user-definable
* Clear, operator-based assertion syntax
http://github.com/mdg/testpp
* Easy to use
* Simple enough to be used without macros if desired
* Can run individual tests, files or suites from the command line
* Various output formats, user-definable
* Clear, operator-based assertion syntax
http://github.com/mdg/testpp
Monday, September 22, 2008
computer dreams
I was having a lame dream last night when I woke up. In my dream, the huge software project I've been working on had achieved self awareness (it's just a big web site, we're not trying to build artificial intelligence). And in the dream, we had given the project a female personality. And it started hitting on me. Not in a nice way either. It was in a scary, fatal attraction way.
I gotta get off this project already.
I gotta get off this project already.
Tuesday, September 09, 2008
2008 git survey
Try taking the git survey. It's a little long, but you can just skip over anything that looks too long or you don't want to answer.
Friday, September 05, 2008
how is subversion still alive?
I first looked into Subversion (SVN) many years ago, after hearing its slogan: "CVS done right". This sounded good to me at the time, and I'll allow that at some point, maybe it made sense. I wasn't using it seriously at the time and only gave it a superficial lookover. It seemed pretty good.
The other day I was just looking into it more seriously because I'm now using it at work. Wow. What a pos. If you're a Subversion user, please excuse me. To those of us who have seen the light of distributed SCMs, Subversion might as well be Visual SourceSafe. By that I mean that Subversion is more similar to Visual SourceSafe than it is to modern distributed SCMs like git or mercurial.
The most amazing thing about Subversion is that it has no branch or tag commands. Instead, it has a bizarre "copy" command that does utterly different things depending on whether the arguments you pass refer to the working copy or a URL. One permutation copies a file and schedules it to be committed. Another permutation immediately commits the working copy to a URL. What does that even mean and why do I want to risk doing it accidentally when I really meant to do "cp file new_file; svn commit new_file;"?
A third permutation branches or "tags" the repository. First, to actually branch, you need to know the repository layout. Repositories are so simple that this online book devotes an entire chapter about how to choose one. Why should I have to care about a repository layout? Even CVS has the good sense to just give me a simple, straight-forward branch or tag command.
The other insane thing about SVN is that tags aren't fixed. They're exactly the same as branches and can be committed to. Seriously? Wtf is the point of that? To make them fixed, you have to read another chapter about access control scripts. And people say git is hard to learn...
Apparently Subversion's developers are continuing to work on it, trying to catch up by adding features like offline commits and merge tracking that are inherently part of a true distributed SCM. Subversion, please give up and start using git or hg, they already do all the things you wish SVN could do one day. It's time for Subversion to retire.
The other day I was just looking into it more seriously because I'm now using it at work. Wow. What a pos. If you're a Subversion user, please excuse me. To those of us who have seen the light of distributed SCMs, Subversion might as well be Visual SourceSafe. By that I mean that Subversion is more similar to Visual SourceSafe than it is to modern distributed SCMs like git or mercurial.
The most amazing thing about Subversion is that it has no branch or tag commands. Instead, it has a bizarre "copy" command that does utterly different things depending on whether the arguments you pass refer to the working copy or a URL. One permutation copies a file and schedules it to be committed. Another permutation immediately commits the working copy to a URL. What does that even mean and why do I want to risk doing it accidentally when I really meant to do "cp file new_file; svn commit new_file;"?
A third permutation branches or "tags" the repository. First, to actually branch, you need to know the repository layout. Repositories are so simple that this online book devotes an entire chapter about how to choose one. Why should I have to care about a repository layout? Even CVS has the good sense to just give me a simple, straight-forward branch or tag command.
The other insane thing about SVN is that tags aren't fixed. They're exactly the same as branches and can be committed to. Seriously? Wtf is the point of that? To make them fixed, you have to read another chapter about access control scripts. And people say git is hard to learn...
Apparently Subversion's developers are continuing to work on it, trying to catch up by adding features like offline commits and merge tracking that are inherently part of a true distributed SCM. Subversion, please give up and start using git or hg, they already do all the things you wish SVN could do one day. It's time for Subversion to retire.
Monday, September 01, 2008
Even on IMAX, The Dark Knight wasn't that great
I went to see the Dark Knight in IMAX at 8:45pm Friday night. Even though we got there early, it was still sold out. So we got tickets for the 12:30am showing and went to dinner to kill time. It's hard to kill 4 hours though so we still had to wait a while. And by 12:30 I was quite tired already and kind of wished I was home in bed.
Maybe I just had the wrong attitude going in, but even on IMAX I found it underwhelming. I did see why people are so impressed by Heath Ledger, but the rest just left me feeling like I endured it, rather than enjoyed it. Maybe it would be better earlier in the day and without having to wait 4 hours.
Maybe I just had the wrong attitude going in, but even on IMAX I found it underwhelming. I did see why people are so impressed by Heath Ledger, but the rest just left me feeling like I endured it, rather than enjoyed it. Maybe it would be better earlier in the day and without having to wait 4 hours.
Sunday, August 24, 2008
rake for c++
In the c++ program I've been working on, shessiond, I had been using GNU make. Unfortunately make blows. I got it to build, but it wasn't doing incremental builds, it was rebuilding everything everytime. This worked for a while because it was small. Now it's growing larger and I finally got sick of full rebuilds everytime.
I considered mucking with the Makefile to get it to work. I even have the GNU Make book. But, it isn't much different than a longer version of the make man page.
I also looked at scons. At first it looked like it had good documentation, but it's not as much or as helpful as it first appears. There was no obvious, simple example of compiling source objects _and then_ compiling those objects into an executable. Also, they seemed to have an odd build system that they almost threaten you with on the developer page.
So Rake seemed good. I decided this because it's also hosted on github. Most Rake documentation is for using it with Ruby. The few C++ examples I could find were pretty realistic.
* http://rake.rubyforge.org/files/doc/rakefile_rdoc.html
* http://www.ruby-forum.com/topic/58444
After a while of messing around, I finally got it working. Most of my confusion here came from the Ruby syntax, which I think I'll adjust to. And, as opposed to the Makefile, when I got the Rakefile working, I actually understood the important parts of how it works.
The one thing I'm still trying to resolve is an issue with the build paths. I tried to configure it to build my source files into a separate obj directory. This works for my files in the src/ directory, but breaks when I try to compile test code in the test/ directory. It seems a solvable problem though, and far less intimidating than trying to figure it out with make.
The other remaining issue is dependencies on headers. This is covered in the link above though, so I expect to get it working once I actually try to do it.
I considered mucking with the Makefile to get it to work. I even have the GNU Make book. But, it isn't much different than a longer version of the make man page.
I also looked at scons. At first it looked like it had good documentation, but it's not as much or as helpful as it first appears. There was no obvious, simple example of compiling source objects _and then_ compiling those objects into an executable. Also, they seemed to have an odd build system that they almost threaten you with on the developer page.
So Rake seemed good. I decided this because it's also hosted on github. Most Rake documentation is for using it with Ruby. The few C++ examples I could find were pretty realistic.
* http://rake.rubyforge.org/files/doc/rakefile_rdoc.html
* http://www.ruby-forum.com/topic/58444
After a while of messing around, I finally got it working. Most of my confusion here came from the Ruby syntax, which I think I'll adjust to. And, as opposed to the Makefile, when I got the Rakefile working, I actually understood the important parts of how it works.
The one thing I'm still trying to resolve is an issue with the build paths. I tried to configure it to build my source files into a separate obj directory. This works for my files in the src/ directory, but breaks when I try to compile test code in the test/ directory. It seems a solvable problem though, and far less intimidating than trying to figure it out with make.
The other remaining issue is dependencies on headers. This is covered in the link above though, so I expect to get it working once I actually try to do it.
shessiond
I started working recently on a new software application. It's purpose is to allow web applications to share sessions across multiple servers. It's called shessiond and is hosted publicly at github. It's not ready for production yet, but it does work and I think it's far enough along that it's interesting to look at.
Sears has clothes?
I've started shopping for clothes at Sears recently. I'd definitely recommend it. They don't have flash clothes or brands, just nice looking stuff without lame brands (like Hollister) plastered all over it. And it is Sears after all, so the prices are decent. They also have Land's End clothes in the store so you can try things on.
Saturday, August 16, 2008
Soccer is almost perfect
I'm watching the Olympic soccer and am once again reminded of the one short-coming of soccer: penalty kick finishes. For some reason, FIFA officials seem to think penalty kick finishes are a good thing. They have no gold or silver goals, and seem to almost want penalty kicks. But they're so lame.
For one, all games should be played with the Golden Goal. Hockey playoffs in overtime are so exciting because you can't look away for a moment without fear of missing the finish. In soccer, even if the team scores a goal, you know you have to sit through the remainder of overtime watching boring play until time finally runs out.
Also, each of the 2 overtimes should start with an additional obligatory substitution. No one wants to see 20 tired guys walking around the field. Force teams to substitute someone for a guy with fresh legs to keep the game moving.
Lastly, shoot outs should be moved back, outside the 18, to make them more interesting. Give the goalies a chance and force the shooters to make real shots. That would make it way more interesting to watch than seeing goalies just guess left or right before the shot is even taken.
For one, all games should be played with the Golden Goal. Hockey playoffs in overtime are so exciting because you can't look away for a moment without fear of missing the finish. In soccer, even if the team scores a goal, you know you have to sit through the remainder of overtime watching boring play until time finally runs out.
Also, each of the 2 overtimes should start with an additional obligatory substitution. No one wants to see 20 tired guys walking around the field. Force teams to substitute someone for a guy with fresh legs to keep the game moving.
Lastly, shoot outs should be moved back, outside the 18, to make them more interesting. Give the goalies a chance and force the shooters to make real shots. That would make it way more interesting to watch than seeing goalies just guess left or right before the shot is even taken.
Wednesday, July 30, 2008
Team Awards for Le Tour
The Tour de France just finished and Team CSC's Carlos Sastre won it. Once again, the rider with the best team won. Unfortunately, the tour does little to recognize the winning teams. The team with the best overall time (top 3 finishers from each stage) gets to stand on the platform, but they get no named trophy. The teammates of the yellow jersey don't even get that.
It would be nice if the winning teams could get a named trophy so they could be known for the rest of their careers as winners of that trophy. For example, if the teammates of the yellow jersey got a yellow cap, Carlos Sastre's CSC teammates could be 2008 yellow cap winners. George Hincapie would be an 8 time yellow cap winner. Teammates are a key part of winning the Tour de France and they ought to be recognized.
It would be nice if the winning teams could get a named trophy so they could be known for the rest of their careers as winners of that trophy. For example, if the teammates of the yellow jersey got a yellow cap, Carlos Sastre's CSC teammates could be 2008 yellow cap winners. George Hincapie would be an 8 time yellow cap winner. Teammates are a key part of winning the Tour de France and they ought to be recognized.
Thursday, July 24, 2008
Claudio Reyna Retires
Claudio Reyna was probably good at some point in his career. But he was crap for the New York Red Bulls. He was too old, too hurt and too bad. Thankfully, he's finally retired. Enjoy your retirement Claudio. Red Bull fans will be enjoying it too.
Friday, July 18, 2008
Suicide Work
... is work that makes you want to kill yourself. For example, if you working for or with IBM, even indirectly, there's a significant chance you're doing Suicide Work.
Sunday, July 06, 2008
Microsoft is writing another OS?
In this article, The Economist describes how Vista is struggling against XP and isn't as good. This may be true but it's an unfair comparison. XP wasn't very good when it was first released either. Businesses didn't upgrade, it used too many resources, it didn't work on old hardware. All the same problems for Vista. Microsoft OSes always struggle at first. 98 wasn't good until 98 SE (Second Edition), NT users didn't upgrade to 2000, and 2000 users didn't upgrade to XP.
In each case, the older OS was better than the new OS when first released. The reason XP has been so successful is that Microsoft spent 5 years rewriting Windows XP as Vista. While Vista was being built, XP was getting better. In 5 years, Vista will probably be much better than XP.
And now Microsoft is rewriting their OS again? In all this time, Linux just keeps getting upgrades. It's the natural path for software to be upgraded, not rewritten. That Microsoft has to rewrite their OS in order to create sales exposes the flaw in Microsoft's model from the consumer's perspective and conversely, an advantage of using Linux.
Hopefully Microsoft does write a new OS from scratch that isn't backwards compatible. It would be great to see Microsoft try to compete with Linux when it doesn't have the advantage of the huge backwards compatible software library to push sales.
In each case, the older OS was better than the new OS when first released. The reason XP has been so successful is that Microsoft spent 5 years rewriting Windows XP as Vista. While Vista was being built, XP was getting better. In 5 years, Vista will probably be much better than XP.
And now Microsoft is rewriting their OS again? In all this time, Linux just keeps getting upgrades. It's the natural path for software to be upgraded, not rewritten. That Microsoft has to rewrite their OS in order to create sales exposes the flaw in Microsoft's model from the consumer's perspective and conversely, an advantage of using Linux.
Hopefully Microsoft does write a new OS from scratch that isn't backwards compatible. It would be great to see Microsoft try to compete with Linux when it doesn't have the advantage of the huge backwards compatible software library to push sales.
Le Tour!
The Tour de France started on Saturday. Unfortunately Astana was banned so Alberto Contador and Levi Leipheimer are out. It's pretty good after the first 2 days and the mountains start early this year.
Funnily, Tom Boonen is out of this year's tour for testing positive for a banned substance: cocaine. Too bad they banned him for that, it's not exactly a performance enhancing substance.
Tivo it out on Versus (channel 603 on DirecTV) in the mornings, usually 8:30am eastern time.
Funnily, Tom Boonen is out of this year's tour for testing positive for a banned substance: cocaine. Too bad they banned him for that, it's not exactly a performance enhancing substance.
Tivo it out on Versus (channel 603 on DirecTV) in the mornings, usually 8:30am eastern time.
Saturday, May 17, 2008
git!
I (like many others) have started using git recently. It's pretty nice. Merging, which is difficult in CVS and SVN, is easier and more natural with git. If you look at the repository with gitk after doing some concurrent development, you'll see what I mean by merging being more natural.
git is still a little rough with the interface. It gives a lot of access which makes it powerful, but also gives more opportunities for confusion.
If you're coming from CVS or SVN, I recommend checking out the git glossary. Getting the git terminology figured out was a big help for me in learning git.
New Artisans also wrote a good document for learning git. In the 9th section, it explains how branches and merges aren't handled specially by git. If a commit has multiple children, it's a branch. If a commit has multiple parents, it's a merge.
Check out gitorious or github for online repository hosting. gitorious is focused on open source projects. github allows open source projects, but also offers private, paid repositories and has some nice visualization tools. github also hosts Rails.
So far no git support from Jira or Fisheye or any other tools like that that I know of, but hopefully it's soon on the way.
git is still a little rough with the interface. It gives a lot of access which makes it powerful, but also gives more opportunities for confusion.
If you're coming from CVS or SVN, I recommend checking out the git glossary. Getting the git terminology figured out was a big help for me in learning git.
New Artisans also wrote a good document for learning git. In the 9th section, it explains how branches and merges aren't handled specially by git. If a commit has multiple children, it's a branch. If a commit has multiple parents, it's a merge.
Check out gitorious or github for online repository hosting. gitorious is focused on open source projects. github allows open source projects, but also offers private, paid repositories and has some nice visualization tools. github also hosts Rails.
So far no git support from Jira or Fisheye or any other tools like that that I know of, but hopefully it's soon on the way.
Oracle 10g Client on Ubuntu
I recently got a new laptop at work and put Ubuntu on it. Unfortunately my company uses Oracle, so that means I somehow had to get the Oracle client tools on there. I was quite dismayed to see Oracle has a requirement that it only installs on Suse and Red Hat.
Luckily This Broken World had already figured it out and posted these helpful instructions for how to get it to work. The instructions target Ubuntu 7.10 (Gutsy Gibbon), but they worked just fine for my 32-bit 8.04 (Hardy Heron) install.
Luckily This Broken World had already figured it out and posted these helpful instructions for how to get it to work. The instructions target Ubuntu 7.10 (Gutsy Gibbon), but they worked just fine for my 32-bit 8.04 (Hardy Heron) install.
Wednesday, March 19, 2008
168-116?
My Sonics lost to the Nuggets 168-116 on Sunday.
How can you score 116 and still lose by 52? PJ Carlisimo is the worst coach in the league. He should get a lifetime ban from the NBA after this. He has the Sonics playing zero defense. And his offense is horrible too.
The offensive strategy goes: pass it around, if Durant catches it, he shoots. Durant is a great player, but he's not the only good player they have and he needs coaching to learn how to play within the offense. Until he can play within the offense, he should come off the bench as a 6th man so he can shoot as much as he wants. And #5 draft pick Jeff Green is pretty much ignored by the offense.
The Sonics are lost to Oklahoma, which probably makes it hard to focus, but PJ Carlisimo makes it worse than it needs to be. He is however succeeding at his job of making the team so bad that no one will care when they move.
How can you score 116 and still lose by 52? PJ Carlisimo is the worst coach in the league. He should get a lifetime ban from the NBA after this. He has the Sonics playing zero defense. And his offense is horrible too.
The offensive strategy goes: pass it around, if Durant catches it, he shoots. Durant is a great player, but he's not the only good player they have and he needs coaching to learn how to play within the offense. Until he can play within the offense, he should come off the bench as a 6th man so he can shoot as much as he wants. And #5 draft pick Jeff Green is pretty much ignored by the offense.
The Sonics are lost to Oklahoma, which probably makes it hard to focus, but PJ Carlisimo makes it worse than it needs to be. He is however succeeding at his job of making the team so bad that no one will care when they move.
Monday, March 17, 2008
Backwards Economic Policy
Enough with these namby-pamby rate cuts. It's time for Ben Bernanke to be a real man and do what the economy needs: raise rates! He's cut rates time after time and none of them have yet had an effect on the economy.
The core problem of this economic downturn is that there's not enough credit supply. Rate cuts increase credit demand, but don't help supply. Banks don't lend (and provide credit supply) for two reasons:
1) They don't have cash to lend
2) They don't think they'll get their lent cash back
Raising interest rates will address both of these problems:
1) Higher rates will motivate more investors to put money in deposits. Tax cuts on interest on bank deposits for this year will further motivate investors to put cash in banks.
2) Higher rates mean banks get more money back for lending. When rates are low, they get less money back for lending, reducing motivation to lend. Raise the potential payback for lending, and you raise motivation to lend.
Conversely, cutting rates makes both problems in credit supply worse.
Bernanke is cutting rates when he should be raising them. We're still in trouble after multiple rate cuts, including the one this weekend. And the government should be cutting taxes on deposits, not sending blanket rebates. Higher rates will hurt some people and businesses, but it's better to hurt some for the short term than to hurt everyone for the long term by pushing us all into stagflation.
Good luck everybody. Bernanke's driving backwards.
The core problem of this economic downturn is that there's not enough credit supply. Rate cuts increase credit demand, but don't help supply. Banks don't lend (and provide credit supply) for two reasons:
1) They don't have cash to lend
2) They don't think they'll get their lent cash back
Raising interest rates will address both of these problems:
1) Higher rates will motivate more investors to put money in deposits. Tax cuts on interest on bank deposits for this year will further motivate investors to put cash in banks.
2) Higher rates mean banks get more money back for lending. When rates are low, they get less money back for lending, reducing motivation to lend. Raise the potential payback for lending, and you raise motivation to lend.
Conversely, cutting rates makes both problems in credit supply worse.
Bernanke is cutting rates when he should be raising them. We're still in trouble after multiple rate cuts, including the one this weekend. And the government should be cutting taxes on deposits, not sending blanket rebates. Higher rates will hurt some people and businesses, but it's better to hurt some for the short term than to hurt everyone for the long term by pushing us all into stagflation.
Good luck everybody. Bernanke's driving backwards.
Tuesday, January 22, 2008
Save My Sonics!
Ok, that's a bit melodramatic. The Sonics will probably do just fine in Oklahoma. But they need to be saved for Seattle.
The Sonics are being threatened because the owner wants a new arena. And the voters & government don't want to build a new arena. Well, with the economy now going in the tank, governments are looking for ways to stimulate the economy.
See where I'm going here? A new basketball arena would be a big stimulus. If the state needs to dump a bunch of money into the economy anyway, why not dump it into an arena? It'd be better than spending it on more highways, although probably not as good as spending it on more new trains.
The Sonics are being threatened because the owner wants a new arena. And the voters & government don't want to build a new arena. Well, with the economy now going in the tank, governments are looking for ways to stimulate the economy.
See where I'm going here? A new basketball arena would be a big stimulus. If the state needs to dump a bunch of money into the economy anyway, why not dump it into an arena? It'd be better than spending it on more highways, although probably not as good as spending it on more new trains.
Thursday, January 17, 2008
Executive Glory Hypothesis
After reading about so many absurdly rich executives, I've developed a hypothesis about them. Maybe someone has already come up with it, but it is that at some point, executives get paid so much and are so confident in a gigantic golden parachute that they stop being motivated by money. Once this happens, the only motivation left to them is executive glory, getting to be seen as the great leader.
This provides incentive to be excessively risky without having to balance the consequences of failure. If the risky strategy fails horribly, executives will be let go with a giant golden parachute guaranteeing them & their children incredible wealth for the rest of their lives. If the risky strategy succeeds however, the executive will be seen as a great hero of business, like Jack Welch, and will be idolized by CEOs around the world. Great success rarely happens, but because executives have no penalty for failure, spectacular crashes are way too common.
This provides incentive to be excessively risky without having to balance the consequences of failure. If the risky strategy fails horribly, executives will be let go with a giant golden parachute guaranteeing them & their children incredible wealth for the rest of their lives. If the risky strategy succeeds however, the executive will be seen as a great hero of business, like Jack Welch, and will be idolized by CEOs around the world. Great success rarely happens, but because executives have no penalty for failure, spectacular crashes are way too common.
Subscribe to:
Posts (Atom)