Another Java Learning Experience
Oct. 16th, 2015 11:55 pmSo one of the other programmers in the group thought he'd found a bug in some of my code. I asked if he could set up a screen share so that I could watch him step through the failing code. And after a little bit of research, I recoiled in horror.
In some code that I had written fairly early in my Java development, I had pretty grotesquely mishandled the immutable DateTime class from the Joda Time package. I'd called a method on a DateTime that would return a new DateTime, but I hadn't assigned it to anything, with the net result that it pretty much did nothing. Since I wanted it to do something, that was a bad thing. Apparently, I'd assumed I was modifying the immutable class.
Not so much.
So I fixed that and then went on a snipe hunt through the rest of the code to find the places where I'd used the library badly. There were only a couple of actual bugs, but there were several places that I could -- and now have! -- improved things substantially.
I guess the good news is that I'm learning. :)
In some code that I had written fairly early in my Java development, I had pretty grotesquely mishandled the immutable DateTime class from the Joda Time package. I'd called a method on a DateTime that would return a new DateTime, but I hadn't assigned it to anything, with the net result that it pretty much did nothing. Since I wanted it to do something, that was a bad thing. Apparently, I'd assumed I was modifying the immutable class.
Not so much.
So I fixed that and then went on a snipe hunt through the rest of the code to find the places where I'd used the library badly. There were only a couple of actual bugs, but there were several places that I could -- and now have! -- improved things substantially.
I guess the good news is that I'm learning. :)