06.27.07

Finally, some sanity…

Posted in General at 5:58 pm by BestFriendChris

Beware the Magical IPhone

06.13.07

Builds suck

Posted in Software Development at 6:42 pm by BestFriendChris

Builds suck. Normally I’d rag on Ant, but I don’t really blame the tool (even if it does suck…). Ant doesn’t kill kittens, developers do. I think the fundamental problem is that nobody (ESPECIALLY developers) take a build seriously. The sad reality is that we treat a build system the same way we used to treat regular code. We write it once, maybe throw in a few echos, and run the build. We check to see that the files we expect it to create are there, and then we forget about it. That is, of course, until we notice that it stops working (usually LONG after it really stops working). This is ridiculous. There’s a reason we have jUnit.

I was talking with my partner in crime, Nilanjan about this. The project we are on has an insane build system. The last couple of days I’ve had to immerse myself into it. Ick. The sad thing is that it is not even close to being the exception to the rule. So, we started talking about what we think the best way to avoid this kind of intertwining dependencies and properties nested an insane number of imports away… Here’s the list we came up with (keep in mind that a fair number of things here we haven’t tried, they just seem to make sense. If you try any/all, please let me know. I’d love to know how they work out):

Your build is code. Treat it as such.

  • Your build has pretty set requirements that show up over the course of your project. For example:
    • given a java file, create a class file
    • given this war file and this running app server, deploy the war to the app server
  • We need some sort of unit testing framework that allows you to verify that your build still works as expected
    • should allow you to fake out all calls to the os and the filesystem so it will be fast and nondestructive (when testing a task to deploy to your production server, you should mock out the sftp call in some way)
    • should mock out all other imported build files. I think it would get too complex to test when your build file depends on another build file that depends on another build file… This probably is debatable, however.
  • Refactor mercilessly. Please.

Nested builds are a tree

  • Nested builds are when you have multiple sub-projects, each with their own build file.
  • You should only be able to call build files down the tree, or siblings (more on this in a bit)
  • A fair amount of the complexity I personally have seen deals with any build file being allowed to call any other.
    • It hurts to figure out who exactly depends on a specific task.
  • Following this rule, at least gives you a smaller set to look towards when debugging your build.

All projects should have the EXACT same public interface.

  • By public, I mean the tasks that other build files can call
    • not just what can be called from the command line
  • If one project has a “jar” task, all should. And the jar task should do the same thing, in a common build file (see below)
    • That way, when project A requires a jar from project B, it knows that all it needs to do is call the “jar” task and it will be in a known place.
  • This doesn’t mean that all build files are limited to the same interface, just that if you need to call a task in another build file, all build files need to provide that task in a consistent way.
  • This is probably the weakest suggestion of all of them. Just something I came up with. Blame me, not Nilanjan. :-)

Refactor out commonality.

  • When factoring out common tasks, the common build file can not depend on any other files.
    • Trust me. One off is best.
    • This means that if your pull up the compile-unittest task that depends on the compile task, both need to be pulled up.
  • Only use one common build file.
    • Again, even though it might seem to make sense, debugging becomes hell, especially when you factor out the common tasks between two common files. Arg.
  • If a task to be pulled up is not used in EVERY build file, turn the task into a function (or macrodef in ant) and call it.
    • Functions are much easier to test than tasks with dependencies (any of which could possibly be overridden)
    • They should not depend on the state of any sort of global variables or properties. Only on arguments passed in.
  • No global variables/properties
    • This will drive you mad if you depend on an imported build file to define your state.
    • Insanely hard to debug.

Due to the fact that I’m not suicidal and don’t like to cry (it really hurts your credibility as a consultant… I’ve… heard…), my initial stab at writing a unit testing framework for a build system will be using rake. I’ll post something when I have anything even started…

Comments?

06.05.07

The Big Apple

Posted in General at 3:23 pm by BestFriendChris

This last weekend I went to New York for the first time EVAR. Here’s what happened:

Thursday night

  • I took the train from Philly to Manhatten. It was not too expensive, so I went first class. I’m a huge fan of the train. You get on, like, 5 minutes before it leaves, you can use your phone/computer the entire trip, and there’s no crazy “Must have your explosive liquids in a ziplock bag before we can let you thru security” crap going on.
  • Reshma picked me up at the station and we went to her place to pick up her best friend Shaun. He’s a cool guy, even if he does work for the enemy…
  • We all met up with Tiffany and [insert other members of our party here] ;-)
  • We decided to go to a restaurant that is super old and has old (sometime famous) people’s pipes on pretty much every wall and the entire ceiling. It was super-tasty
  • Went and saw times square at night. I mean, I assume it was night based on my watch and tiredness level, but it was so brite I’m not convinced.

Friday

  • Slept in to around 10-ish and then took a shower. Pretty much everybody I knew in NY was going to be working, so I was on my own for the touristy stuff.
  • I decided to go to the WTC site (more on that below)
  • Next I went to the statue of liberty. I had a phone call I had to be on at 2, so I didn’t take the farie over there, but I did see it from a distance. Turns out, in that case, the photo’s do it justice just fine
  • I started walking around the financial discrict, had a street vendor hot dog, and saw the brooklyn bridge
  • All in all, it was a good site seeing trip
  • I headed back for my phone call, and then I took a nap. :-) I was up a little late chatting the nite before, and Chris needs his beauty sleep

Friday Night

  • Had a hot date. :-)
  • We went to [insert name of place I can’t remember here]. It had awesome food. I was way impressed.
  • Next, we had tickets to see Mary Poppins on Broadway. Now, if you know me well at all, you know that the Mary Poppins movie is consistantly in my top 2-3 favorite moves of all time. I have to say, I was impressed. They took out a few things from the movie, and added a few things from the book (there’s a book?!), and technically it was pretty amazing. Bert even walked all the way up the arch on stage right, along the top of the arch and down on stage left. It was pretty sweet.

Saturday

  • Got up and took care of some email and errands I needed to do. Reshma woke up at 2pm. Yes, 2. Seriously.
  • Headed to brunch (If you can call 2:30 brunch-time) with Shaun and Reshma. We ate at a french restaurant (they were out of quiche. :-( )
  • Next we decided to go to the Museum of Modern Art. I wish I could say it was amazing, but by the time we got over there it was only going to be open for another hour.
  • Instead, we went to Central Park, stopping on the way to see the coolest apple store in the world. Awesome.
  • We walked thru Central Park for a while. This place is awesome. I was seriously blown away. The insane contrast between how packed and fast paced the city is, compared to the open and mellow park is exquisite (I even looked up how to spell exquisite. That’s how much I love this park)
  • We headed back to get ready to meet up with some other friends later that night.
  • Met up with the other friends. For the record, Julia is the funniest person in the world. Seriously. I haven’t laughed that hard in a very long time. (Now it’s on the internet, so it must be true)
  • We had wine on the terrace (with an amazing view I might add), and then headed out for sushi. Good stuff.
  • We went to a little bar in some area or another (I know, very specific, eh?) and had a few drinks.

Sunday

  • Went out for brunch again, this time to a place called Cafeteria. It was pretty fun. Good food.
  • Next, I was on my own again since my friends had to go back in to work (insane, right?). I decided to go to the moma for real this time.
  • Didn’t go to the moma again. :-) I got there, realized that in order to get back to get ready for my train I was only going to have 1 hour to see the museum again, and decided not to (again). Instead, I walked in the park. I totally [heart] Central Park.
  • I decided I was going to walk the long way thru the park. I get all the way thru it and reach the street. I was pretty impressed with myself. That was, of course, until I discovered that I had gotten turned somehow and ended up on the west side of the park, only about half way thru it. Dang. I decided to give up, since time was slim and it was starting to sprinkle.
  • On my way back, I get a voice mail (phone didn’t ring for some reason) saying my train was canceled. So, I get back to the apartment and find my ticket and get the time changed.
  • Went to dinner with Reshma and Tiffany at a chinese restaurant they call Room (only because the chinese characters look like the letters “Room”). It was pretty good.
  • Went to the train station and headed back to Philly (after another hour of it being delayed…)

World Trade Center
I have to say that the thing that surprised me the most about this trip was seeing the world trade center. The entire time I was looking at the site, or at the pictures that were on the fence, or the timeline that was there, I didn’t feel a thing. I was really expecting some sort of emotional flailing, but nothing. My guess is it is a little bit of me being out of touch with my emotions (what, me?) and a little bit of complete desensitization by mainstream media, but it really did surprise me. It felt like just another construction site. Weird.