I’ve always been a big fan of peer reviews. I enjoy both giving them and receiving them. However, I find there is generally a developer resistance to them. Which is unfortunate. I hate reposting what someone else has already written, but I think Jeff Atwood really hit this right on the nose: Who’s Your Coding Buddy?. I think with a decent unit testing framework combined with code reviews, it should be possible to deliver software virtually defect free.
Archive for the ‘Uncategorized’ Category
debugging code
Posted by kevinup on February 23, 2009
I was helping another developer debug some code the other day. We had an if statement, that when it was true, it should throw an exception. The problem was the exception was being throw every time even when we knew the expression should have been evaluated to false. I had to laugh when I saw the code and realized what was going on.
bool some_expression_that_evaluates_false = false;
if (some_expression_that_evaluates_false);<-------------
{
Console.WriteLine("Why is this code executing?");
throw new Exception();
}
Posted in Uncategorized | Leave a Comment »
CodeMash 2009 Followup
Posted by kevinup on January 15, 2009
CodeMash is over. I should probably say something about it before the events are stale and forgotten.
For me, I started attending topics pertaining to .Net and Agile. They were all okay nothing great. It was suggested to me by James that I should attend an Erlang session. I was skeptical at first, so I sat near the door so I could bail once it got boring. It was awesome. I was fascinated by the language, especially because it seemed to be built for performance and multi-threading; something that I have a sweet spot for. The lesson learned here is: Try to look at the sessions as a buffet, and try and get a wide variety of everything, don’t just stick with the stuff you do 9-5.
I didn’t checkout the open spaces till I missed a bunch of good ones. I did attend a good session on getting started on speaking, which is something that I’d like to start doing in 2009. Here a picture of my back during the open space, I’m wearing the green shirt on the left
http://www.flickr.com/photos/sadukie/3185385499/
Carrie and Julia really enjoyed the water park. It was nice that CodeMash provided a Cabana for the CodeMash families. Julia dragged me into the tree house one night which was pretty freaking awesome.
I’ll definitely have to get up there next year.
Posted in Uncategorized | Leave a Comment »
FUSLOGVW.exe
Posted by kevinup on December 16, 2008
I was recently tasked with deploying some code I had written. I consider myself a good heads down developer, and prefer to let deployment issue and problems be covered by someone else. Its definatly a weak point on my resume.
The deployment wasn’t too complicated, I had a little console app, that would call two different WCF services. The problem was the box I was using had different versions of the the same WCF services, and several common libraries already in the GAC. Some things were signed, some stuff wasn’t. I was about ready to jump off a cliff with amount of DLL problems I was having then someone told me about FusionLog.
FusionLogvw.exe is probably one of the coolest tools in the .Net Framework. It basically gives you a bunch of data about your DLLs as they are loaded. You can set it up to log exceptions, or just log everything. It took me all of 15 minutes to figure my problems using FusionLog. Here are some screen captures and roughly some of the information that it spits out:

By clicking settings you can set up what you want to log:

By clicking on each row on the main screen here’s the type of information you can see:
—-
*** Assembly Binder Log Entry (12/16/2008 @ 2:01:38 PM) ***
The operation was successful.
Bind result: hr = 0×0. The operation completed successfully.
Assembly manager loaded from: c:\WINNT\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable C:\Documents and Settings\My Documents\Visual Studio 2008\Projects\FindGoodGuids\FindGoodGuids\bin\Debug\FindGoodGuids.exe
— A detailed error log follows.
=== Pre-bind state information ===
LOG: User = KevinUp
LOG: DisplayName = Oracle.DataAccess, Version=2.111.6.20, Culture=neutral, PublicKeyToken=89b483f429c47342
(Fully-specified)
LOG: Appbase = file:///C:/Documents and Settings/My Documents/Visual Studio 2008/Projects/FindGoodGuids/FindGoodGuids/bin/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : FindGoodGuids, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Documents and Settings\My Documents\Visual Studio 2008\Projects\FindGoodGuids\FindGoodGuids\bin\Debug\FindGoodGuids.exe.Config
LOG: Using machine configuration file from c:\WINNT\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Publisher policy file is found at C:\WINNT\assembly\GAC_32\Policy.2.111.Oracle.DataAccess\2.111.6.20__89b483f429c47342\Policy.2.111.Oracle.DataAccess.config.
LOG: Publisher policy file redirect is found: 2.111.6.20 redirected to 2.111.6.20.
LOG: ProcessorArchitecture is locked to x86.
LOG: Post-policy reference: Oracle.DataAccess, Version=2.111.6.20, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86
LOG: Found assembly by looking in the GAC.
LOG: Binding succeeds. Returns assembly from C:\WINNT\assembly\GAC_32\Oracle.DataAccess\2.111.6.20__89b483f429c47342\Oracle.DataAccess.dll.
LOG: Assembly is loaded in default load context.
Posted in Uncategorized | Leave a Comment »
CodeMash 2009 – I’ll be there
Posted by kevinup on December 15, 2008
I just booked my hotel for code mash!. See everyone there!

Posted in Uncategorized | 1 Comment »
code coverage
Posted by kevinup on October 20, 2008
I was recently talking to another developer about code coverage and it made me re-think about code coverage.
I had asked him what his code coverage was on this project, and he replied it was probably pretty bad, but that coverage didn’t matter. The quality of the tests mattered. His argument was that if you had good tests that is all you need.
At first I agreed, I love high quality tests. I like the idea of having 2 high quality tests over 10 medium to poor quality tests. Depending on the quality of your developers that isn’t always possible to have high quality tests. I’d rather take over a project with 70% coverage with average quality tests than one with <20% coverage with high quality tests. A high coverage number gives you a lot more confidence about your source code, and any potential changes.
I recently was on a project where we were adding items to a shopping cart. There were around 150 tests built around adding items to the shopping cart, and it broke all the time. The team was around 10 developers, and the issue was that developers didn’t have the time to run all 150 tests, which could take up to 5 minutes. So they would check in and move on without running the tests. (Yeah I know, not a good practice)
I went through and identified 3 tests which captured most of the base functionality. I asked all the developers to at least run those tests before checking code in. Coverage-wise they were probably only hitting 60% of the shopping cart logic. But because they were higher quality tests, and could be run in <30 seconds, we were able to have the best of both worlds.
Posted in .net, C#, Uncategorized | Leave a Comment »
Follow up : Case of the Mondays
Posted by kevinup on October 9, 2008
thought I’d follow up briefly to my Case of the Mondays post.
I’ve got some other pics which I might add to Picasa later, but this is probably the best one. The cop said the damage didn’t look so bad, once they put the car right side up. He thought a lot of energy was expended lifting our car up and turning it during the collision. The crater in our car was probably 20 inches at the deepest part. Part of the other drivers license plate was embedded in the crater as well.
The other driver was sited for ‘Failure to Yield’. When the cop was taking her statement she insisted that she had come to a full stop before accelerating again. The cop tried to explain to her that it was impossible to be at a full stop accelerate 20 feet, collide with another car and flip it. Some people are just stupid, ignorant or both. He estimated that her 2003 Impala was going at least 45 MPH, and due to the lack of skid marks, he felt she didn’t even try to stop.
After looking through the court records online, I found she had to pay a fine of $80 dollars. Eighty freaking dollars! Are you freaking serious!??. She could have killed the three of us. She had a Indiana license. I thought initially that she was from out of town and unfamiliar with the area. . But through the court records I found that she lives less than a half mile from our house. Give her no excuse for her reckless driving.
Of course she was unemployed and uninsured, so our insurance is covering our medical expenses, and car replacement. State Farm has been really good to us, so I’m probably a customer for life now. State farm is planning on going after her for the money its cost them so far, I estimate its probably almost 20k. I doubt they’ll get anything. One state farm rep suggested that they could help us sue her for ‘pain and suffering’. I think I’m just happy that we’re all ok, so we’re going to pass on that.
We bought a new Rav42008 last weekend. So in my mind we’ve been made as close to whole as possible.
Posted in Uncategorized | 5 Comments »
How do you implement a feature?
Posted by kevinup on October 7, 2008
I just got off an interesting interview with a potential client. It went ok. We had some intelligent conversations about WCF, Link, web services, a general work up. One questions that he kept circling around too left me baffled and struggling to understand what he wanted to here. He kept asking ‘How do you implement a feature.’
Typically I like the vague, open-ended questions. I felt like I could see where he was coming from. Some developer he’d probably worked with would over think a solution, gold plate it, and deliver it, and the end result was nothing that satisfied the specs. I know I’ve seen that happen to projects I’ve been on.
My answer, while I didn’t think was wrong wasn’t the answer he was looking for. I would write some unit tests that satisfy the requirements for the feature as best that I could. I would then create the classes that would be needed to pass those tests. I would then create and DB tables or fields as needed, or mock out any other dependencies that my code depends on. And wolah, feature implemented. Obviously there are some things you would do differently depending on your architecture or UI changes. But I think you could follow that methodology 80% of the time.
He didn’t like my answer. ‘Yeah but how would you implement a new feature?’ he would reiterate. I tried to rephrase or expand on what I was saying, but it didn’t seem to satisfy him. He rephrased his question a couple times and each time I couldn’t come up with something significantly different than what I had already told him.
So my question to anyone out there is ‘How do you implement a new feature’. What should I be doing differently? What am I missing?
Posted in Uncategorized | Leave a Comment »
Case of the Mondays
Posted by kevinup on September 19, 2008
We, as well as most of Cincinnati, were plunged into darkness Sunday when remnants of Hurricane Ike blew through. On Monday power was still out at home. Carrie Julia and I decided to head out to Old Spaghetti Factory. On the way back we managed to get within 2 lights of our house uneventfully.
At the second to last light we were turning left. The light was totally out, and everyone was treating it like a 4 way stop. Or maybe I should say almost everyone treated it that way.
When our turn came, I was careful to make sure everyone had stopped and I committed to my turn. In mid-turn I looked right out the passenger side to see a car about ten yards away and flying towards us. I had zero time to react. The thought that crossed my mind was ‘Why didn’t she stop?’. I tried to use my non-existent telekinetic powers to slow down her car and move us out of the way to no avail.
When the car blasted into us, Carrie, who was in the back seat with my daughter, screamed at me “KEVIN” in a tone I’d never heard before. It wasn’t a ‘Kevin please help me with dinner’ tone. It was a “Kevin, are you aware that there is a car slamming into us?” I hope to never hear that tone again. Hopefully I’ll just be helping out with dinner from now on.
After the car blasted into us, it seemed like she just kept coming. She got up under us, and I could feel that side of the car lift into the air. I braced my arms against the roof of the car as we began to roll. After we were rotated 90 degrees, the driver side window shattered. I felt like the window behind me shattered, but later I found out it was still intact. We started to roll more, but didn’t make the complete rotation to get upside down. We rolled back and settled with the driver’s side resting on the ground. My next thought was “Wow, the car engine seems to be really loud.” I realized that the engine was still on, and my foot was still hitting the gas. I took my foot off and turned the car off. Simultaneously Carrie was in the back saying ‘Oh my God’ over and over again.
It seemed like an eternity before I heard Julia start to cry in the back. In a way I was somewhat relieved to hear her, but we were still sitting on our side in what seemed to me a pretty serious crash. Some people outside the car had come up and were asking if we were okay. My wife and I pretty much ignored answering that question directly. I think I screamed “Call 911!”, and my wife screamed that we had a baby. Time was going very slow, but I think I was probably getting hit with a bunch of adrenaline at the time.
I unbuckled my seat belt and stood up on the side of our car. I reached back to try and get Julia’s car seat out. Her seat was in the middle of the back, and my wife was in the passenger side in the back. Someone had managed to open the back door on our Rav4 and was encouraging us to come out that way. I took out the headrest to the seat behind me to make room to get out. Someone on the outside suggested we unbuckle Julia and pass her out to which Carrie and I replied “No, she’s staying in the seat until a doctor can see her.
Carrie, who was suspended in the air, couldn’t get her seat belt undone. I reached up and slid my hand to Carrie’s buckle to release her. She slid past Julia seat’s seat and then got out the back. I got to work then trying to release Julia’s seat. The whole time Julia is not happy. She a good cross between terrified, pissed off and potentially in pain. I kept telling Julia that we were going to be okay. I got her car seat unlatched, at which point someone had pried open the door above us. I lifted Julia, who was still in the car seat, up to the guy reaching down at us. I tell him one more time to keep her in the seat. After Julia was out I scrambled out the back. I found Julia still in her seat crying, and Carrie sitting in front of her trying to soothe her.
Everyone seemed to be out of their cars asking if we were okay. I guess with the sight of our 2004 Rav4 on the side it was hard to fathom that my wife, daughter and I were inside just moments ago. The EMTs seemed like they were there within 60 seconds.
I told the first police officer I saw that we were leaving to take my daughter to the hospital. He took a quick statement from me, gave his card, and asked where I wanted the car towed to, which was kind of funny because that was the least of my worries. I asked if he could figure it out, and he said he would. I jumped into the ambulance, and we were off. The whole thing seemed like it lasted less than 10 minutes.
So yeah, I think I had a case of the Mondays….
The doctor at the ER checked Julia out and gave her a tentative all clear but suggested we follow up with her pediatrician. The pediatrician gave Julia the all clear as well. She ended up with one scratch on her stomach and bruises around her legs, but she seems to be back to 100% with her walking, talking and personality.
I took Carrie to urgent care the day after the accident because she was having head pain. The doctor there said we should go straight to the ER and get a cat scan to rule out a brain injury which we did. We were at the ER for 6.5 hours. The CT was negative, which was good. The doctor diagnosed her with a concussion and gave her some meds to help with the headaches. She also ended up with bruises on her legs.
I just ended up with some sore muscles, so I’ll live. I’ll try and post some pictures, and some more information in a follow up post.
Posted in Uncategorized | 3 Comments »
How to screw up an interview
Posted by kevinup on August 28, 2008
I’ve been doing some reflecting recently about an interview that I had within the last year. There were various things that went wrong, so he’s my analysis of what I screwed up.
I didn’t do the proper research into the company. They had a software product, and when asked about it, I couldn’t intelligently talk about it. That didn’t really convey that I actually wanted to work there.
My next piece of advice is: brush up on computer science concepts and definitions. When asked about a semaphore, the only thing I could think about was, it had something to do with threads. I was sitting right next to my laptop, thinking I could easily get onto Wikipedia. But the little angel on my shoulder was telling me not to do it.
I remember talking about how NHibernate was freaking awesome, or at least better than writing your own custom DAL. The person interviewing me stopped and said something like ‘We write our own DAL, what do you think about that?’ I wasn’t sure what to think about that. It felt like a step backwards, and my answer to his question reflected something along those lines. He then asked, tell me how you implement a datareader. ‘Crap’ It had been so long that I’d had to think about what NHibernate was doing for me, that I couldn’t properly describe it. I fumbled out something about an IDataReader, and a command object, but the question was pretty much going down the tubes. I could practically hear my resume flying into the trashcan.
The moral of the story; don’t go into an interview thinking you know everything. Spend a little time preparing for it, because it will go a long way.
Posted in Uncategorized | Leave a Comment »
