10.09.2009

How To Win Civil Rights

From this CNN interview yesterday between Anderson Cooper and Cleve Jones:
You know, any one thing you do isn't going to get you where you want to go. A march won't do it; electing a friendly legislator won't do it; writing a check won't do it; signing a petition won't do it; clicking a mouse won't do it; picketing won't do it; getting arrested in civil disobedience won't do it. But if you do all of those things, over and over, relentlessly, with determination, that's how we win.
You also have to love Anderson Cooper's description of Barney Frank as "highest ranking gay member of Congress."

9.06.2009

Don't look back, don't look forward. Look at where you are.

Yesterday was my last first gameday ever. The last time that I will ever, as a student and as a member of the Trojan Marching Band, experience the thrill of that very first day of USC football. There are more gamedays to come of course, but only a handful of them, and there is nothing like the first game: No substitute for seeing the Coliseum full of cardinal and gold, for the first time since a November or December game that seemed like years ago.

There are going to be a lot of "last" moments this year, and I know that at certain times, it's going to be tough not to get a little disappointed. From my very first band camp, I could already tell how important the band was going to be, and I knew the years would fly past me way too fast. I was right.

I was going to write a whole post about not taking things for granted, because if you do they will be gone before you know it. And I do think that every single day, you should think about all the great things in your life, and how lucky you are to have them. I was going to list all the things that I'm grateful for, from big things like being admitted to USC, to small things like the amusing little running jokes we have in the band, and everything in between.

But I'm beginning to think that won't be an issue for me this year. I'm beginning not to worry that I will take anything for granted. The greater risk for me, I think, is that I will go too far in the opposite direction. That I will spend too much time thinking about how quickly it's all slipping away from me; picturing what it will be like when I march my last step on the field; anticipating how that last finals week in May will feel; picturing commencement and realizing that I may be seeing some people for the last time.

So my goal is to strike the right balance. For every great moment that happens this year, I will mentally detach myself, just for an instant, to realize how lucky I am to be part of it. And then I will try to let the instant pass, clear my mind, and simply live in that moment. It's all about finding the right balance between reflecting on events, and simply living through them.

Fight on, Trojans.

8.11.2009

My email to the National Organization for Marriage.

I will let you know when I get a response. Should you become inspired to write your own email to NOM, the address is contact@nationformarriage.org

On Tue, Aug 11, 2009 at 6:47 PM, Tyler Breisacher wrote:
Hi there!

I've been reading the material on your website, and I'm particularly interested in the "talking points" page on your website. I'm a Californian and I was very involved in the gay marriage battle in this state last year. It's great to see the best arguments against gay marriage summed up in one place. Of course, this issue is far from settled, and is still being debated all over this state and country, so I want to continue to be as informed as possible in the event that the issue comes up when talking with my friends and family. In particular, I have a question about this point:

“Religious groups like Catholic Charities or the Salvation Army may lose their tax exemptions, or be denied the use of parks and other public facilities, unless they endorse gay marriage."

Of course it's usually hard to prove or disprove statements about what "may" happen so normally I would accept this as a very real possibility. But as Californians we have the unique perspective of a state that had gay marriage for a few months last summer, before we restored the traditional definition of marriage. I think pro-gay activists might jump on this point: "No one will lose their tax exempt status. Gay marriage was legal last year, and no one lost their tax exempt status, did they?" I wouldn't know how to respond to this. Do you have any news stories about churches losing their tax exempt status over this issue, either in California or elsewhere? I seem to remember a case from New Jersey but my understanding is that it was a fairly complicated situation, so it would be nice to see all the facts of that case laid out somewhere.

Whenever I'm discussing this kind of thing with my friends I like to be armed with as much information as possible, so if you could point me to more information on how gay marriage has negatively affected churches I would greatly appreciate it.

Thank you!

Tyler

8.09.2009

TDD with Infinitest

As I posted last time, I'm writing a game in Java called Flood It, copied from inspired by the game of the same name by Lab Pixies. I encourage you to play it and if you find any bugs, or would like to request enhancements, add an issue in the issue tracker. In fact, if you do play it, you'll probably understand this post better.
One of the most important classes in the game is called Grid: It represents the big grid of squares and also keeps track of which ones are in the upper-left group. Because it's so important, I decided to write some unit tests for it, because that's supposed to be the best way to write great code and all that. I'm also using a great little tool called Infinitest which continuously runs your tests for you in the background, all the time. What happened just now is, I think, a great example of why everyone says unit testing is so important.

The constructor for Grid takes a width, a height, and a number of colors. It picks some colors and then populates the grid with a random assortment of squares. So far, so good. But I'm trying to implement an undo/redo feature so I think I'm probably going to need to override clone(). In this case, the constructor will fill the grid with a bunch of incorrect squares, only to have the clone() method overwrite all that data. I decided not to worry about it. Here was my original clone() method:

protected Grid clone() {
Grid clone = new Grid(this.getWidth(), this.getHeight(), this.colors.size());
clone.colors = this.colors;
for (int x=0; x<getWidth(); x++) {
for (int y=0; y<getHeight(); y++) {
clone.data[x][y] = this.data[x][y].clone();
}
}
clone.update();
return clone;
}
The update() method just checks for any squares that may have suddenly become part of the upper left group because the player changed the color of the group, and adds them to the set. Can you see the bug yet? There are actually two bugs, very closely related. I might have caught both of them eventually by playing the game itself, but this method isn't called anywhere in the actual game yet so that might not be until a few days from now. Luckily, I thought to write a unit test:


private void testClone(Grid orig) {
Grid clone = orig.clone();

System.out.println("Original:");
System.out.println(orig);
System.out.println("Clone:");
System.out.println(clone);

assertEquals(orig.getWidth(), clone.getWidth());
assertEquals(orig.getHeight(), clone.getHeight());
assertEquals(orig.getColors().size(), clone.getColors().size());
assertEquals(orig.getNumInUpperLeftGroup(), clone.getNumInUpperLeftGroup());

for (Color color : orig.getColors()) {
assertTrue(clone.getColors().contains(color));
}

for (int x=0; x<orig.getWidth(); x++) {
for (int y=0; y<orig.getHeight(); y++) {
Square origSquare = orig.get(x,y);
Square cloneSquare = clone.get(x,y);
assertNotSame(origSquare, cloneSquare);
assertTrue(origSquare.sameColor(cloneSquare));
}
}
}

Actually, it was the comparison of the toString() outputs that led me to the first bug. Then I decided to add the getNumInUpperLeftGroup() method and use it in the unit test, which led me to the second bug. Which is why you shouldn't put information in toString() that's not accessible somewhere else. But anyway. The first bug was that clone.update() was not adding anything to the upper left group. I knew this because the toString() showed squares in the upper left group as capital letters and others in lowercase. In the clone, it was all lowercase. What was wrong with the clone's update() method? Nothing, actually. For a Grid constructed normally, the last thing in the constructor is upperLeftGroup.add(get(0, 0)); and then update(); My new grid needed that first square to "seed" the update method. So I added clone.upperLeftGroup.add(clone.get(0,0)); to the bottom of the clone() method, before the update, and ran the test again. This time the toString() outputs matched perfectly, but the test still failed.

I leave it as an exercise to the reader to find the second bug. And by that I mean I'm tired of typing so I'll post it later. But suffice it to say that without this unit test having caught the second bug, I might have had some very strange behavior that only showed up in a very particular case. It might have gone uncaught for weeks and when I did find it, it would have driven me crazy and taken me quite a long time to figure out.

This is why everyone says unit testing is so important. I think I get it now.

8.06.2009

New project: Flood It

Through a stroke of luck, I managed to gain possession of an iPhone for a few days, and I downloaded a game I really liked called Flood It. Knowing I'd only have the iPhone for a few days, and not knowing whether any implementations of the game existed online anywhere, I decided to try and make my own, and try to learn a little about Swing and GUI programming as I go.

If you have Java, download it and play it and let me know what you think. Hopefully I will continue working on it at least a little every day so try it out and if you have any suggestions or bug reports, put them in the issue tracker (I don't know if you need a Google account or what).

Enjoy!

7.20.2009

Windmills do not work that way!

Not everyone is a scientist, but there is a certain amount of science that everyone should know. If I were going to start a new blog where I explain scientific topics in laymen's terms, with the goal of improving the general public's scientific literacy, I would call the blog "Windmills do not work that way." Maybe I will do that someday. Like I'll maybe update this blog more often some day.

The line comes from the episode of Futurama I'm watching right now.

6.29.2009

OpenCongress.org

A group called the Sunlight Foundation is trying really hard to take the Good Idea That Everyone Agrees On, that the activity in government should be open and visible to everyone, and turn it into a Cool Website You Can Actually Visit.

It's called OpenCongress.org and it's as Web-2.0-y as you could possibly want. You can leave comments and discuss bills. There's a Facebook app. You can track things. Etc., etc.

Check it out!

6.28.2009

Stonewall

As you may know, today is the 40th anniversary of the Stonewall riots, which are often seen as the beginning of the gay rights movement. I was going to try to do a little reading on the history of the movement, and talk about how far we've come and how much further we have yet to go. But my friend Kyle basically did all that already, so instead, I encourage everyone to read his excellent post.