Life went from really good to really complicated. I got a call from my parents tonight with the dreaded (but expected) news that my Grandpa Joe had passed away. The funeral is Friday - which meant I could fly to Beacon, NY on Thursday and (hopefully) fly back on Friday night and make it to the conference on Saturday morning. Then I looked at the agenda and found that the conference actually starts on Friday at noon. So I sent an e-mail to Jay in hopes of getting my money back. Hopefully this is an option and I can just spend the weekend in NY and then join Julie in Florida next week. Oh well, no conference, but it'll be great to see the whole fam in NY.
This seems to be a matter of personal preference, but I'm interested in hearing how other programmers do their loops. Here's how I do it most often:
List users = dao.getUsers();
for (int i=0; i < users.size(); i++) {
User user = (User) users.get(i);
// do something with user
}
I've seen others do it with an Iterator, and I've done it this way myself, but for some reason I prefer the for loop:
List users = dao.getUsers();
Iterator userIter = users.iterator();
while (userIter.hasNext()) {
User user = (User) userIter.next();
// do something with user
}
I usually add a null check as part of the loop as well. They both seem pretty much the same to me - is one more performant than the other? John Watkinson points out that in JDK 1.5, the for loop will be even easier:
List users = dao.getUsers();
for (User user : list) {
// do something with user
At least that's how I interpreted it - please correct me if I'm wrong. Also, enlighten me if I should be using an Iterator - or at least let me know what advantages it has over a for loop.
Today is and has been an awesome day - Julie's Birthday. It's actually tomorrow - but I screwed up and thought it was today. Her birth certificate, driver's license and all other legal documents say today (yeah - she's tried many times to get it fixed), but she was actually born on May 13th - so I do have an excuse for getting the date wrong. Anyway, I surprised her on Saturday night with a birthday party at our house with friends - a couple of deep fried turkeys made the night scrumptious. I surprised her again today by leaving for work, and then coming back 30 minutes later with bagels and coffee. This is after I cooked her breakfast in bed yesterday for Mother's Day.
So I played hookie today and we all went to the Denver Zoo - which is awesome. Julie bought a season pass for her and Abbie. Now we're home and a Masseuse is coming over at 4 to give her a massage. Pheewww - it's tough being married to a woman who (frequently) has her birthday and Mother's Day very close together.
This week has started off terrific, and will only get better. Julie takes of Thursday for West Palm (FL), Reloaded opens on Thursday, and No Fluff is this weekend. After the conference - which should be a blast, I'll be meeting Julie in Florida for a week of relaxation and sunshine. Life is good...
Yakuu provides a good comparison of abstract classes versus interfaces. This is an interested read for me, since I've only started using both of these in the last year - and only because I've seen/copied/extended other programmer's code. After using them for that long, I have to say that there's still doesn't seem to be much of a point. Of course, I'm rarely using mutliple inheritence and none of my projects have gone through a major refactoring. I'm willing to bet that Dave is happy he decided to use interfaces in Roller. The Castor -> Hibernate conversion probably would've sucked without them - or did they create more work?!