Exceptions

Exceptions – 1

As much as exception-handling is pretty much part-and-parcel of any modern programming language, resources and guides on how to most effectively and correctly use them is fairly thin on the ground.

I noticed recently that when I throw exceptions, or catch them, there is a sort-of-almost-there structure and pattern to the way I use them. But what bothered me is that I didn’t have a strong underlying philosophy regarding why I was using them in that way (and I bet my usage hasn’t been 100% consistent either).

So on this holiday I’ve kinda set out on some self-study to try and formulate what I think is the best way to use exceptions in C#/.NET … there’s some resources that provide good basic information in this matter, but none of them go to the point of taking it to the logical conclusion of fully thought-through recipes that will result in correct and consistent use; so that’s my goal at the end of this series of posts: an article that conclusively formalises my opinion on throwing and handling exceptions.

The initial materials that form the basis for these posts are as follows:

GoldCoast2011

Gold Coast

After Brisbane flooded it sounded like an absolutely stupid idea to go anywhere near Queensland. Well, it must have sounded stupid because more than one person asked me with some concern in my voice whether we were still going. Yes, we did… and I’m glad we did, because it turned out absolutely wonderful.

The Name of Our Hotel

The Name of Our Hotel

We managed to get ourselves a great deal online for “Circle on Cavill”; a fairly new hotel in Surfers Paradise with modern serviced apartments. Our booking said room 1351, so I foolishly assumed we’d be on a lofty 13th floor with a great view. Turns out we were on the vertigo-inducing 35th floor; the leading ‘1’ indicates we were in tower 1. The view was amazing… the floor-to-ceiling windows throughout were… unsettling.

Our Hotel

Our Hotel

Our room was in the slightly shorter tower on the left, about 2/3 of the way towards the top. The name of the hotel derives from the circular square at the foot of the towers that houses a number of fashion shops, a bakery, a few restaurants and a supermarket. As well as a grassy field looking towards the huge television suspended between the two towers (not visible in picture). You can get a good look at the layout in Google Maps.

Our "Room"

Our “Room”

The “room” we got was rather roomy… really quite a waste of space considering we didn’t spend great quantities of time inside. Or at least it didn’t feel like it. Master bedroom overlooking the ocean and a second bedroom in the back overlooking the river. Both views amazing.

Our Neighborhood

Our Neighborhood

This is the view from our room looking down… oh god… vertigo. We spent quite a few days traveling along the road in the middle of the frame sheltered under trees and ducking in and out of shops. It was quite amazing to exit the hotel and walk to the beach in 10 minutes or so. The location of these hotels in Surfers is just amazing. We saw some of the motels around the area, but if you can at all afford it, avoid them… the luxury of the hotels doesn’t come at a very big premium and the difference in luxury makes it more than worth it.

Sunrise

Sunrise

And one morning we decided to be silly and wake up to numbers on the clock that should never be seen… by anyone… I think it was before 5am. We waited patiently for the sun to rise so we could take pictures. It would have been great to get a shot without the band of clouds just above the horizon, but we decided we weren’t going to give it a second shot. After this we went back to bed again.

The Pool in The Sun

The Pool in The Sun

And then there is the weird pool… also on level 4. Doesn’t that pool look sunny and inviting? Sparkly and refreshing? Everything a visitor could possibly wish for? … Except that due to its positioning in the afternoon it disappears into the shadow of the taller tower. Now, the water was pretty cold to begin with, but swimming in a cold pool in the shade is not the best of experiences.

Getting Doused

Getting Doused

Still… in the direct sunlight my radiant white skin does heat up quite quickly. And it was *almost* worth the shock of the cold water on my back. For some reason none of the pools or waterfalls were heated… not the slightest bit. Now, if you have a pool in the full sun all day, I can imagine it stays warm enough regardless, or perhaps you’d welcome the icy water. But when it gets maybe 3 hours of full sun early in the morning, some heating would have been nice.

Stepping out of the cold water does feel kinda refreshing though in the sun. Even with the ocean breeze coming through. I didn’t look nearly as much as a drowned rat as I feared.

But when you sit down in the shade, the breeze does tend to cool the excitement a little. Not quite gritting my teeth, but I think we moved back into the sun further down the gardens shortly after this shot was taken. There were some lovely grassy areas with reclining seats that we made some use of. But again, not for long… when my skin starts looking pink it’s time to move on.

Lunch on the Last Day

Lunch on the Last Day

The final day was spent out on the shopping streets. We had some lunch. Nothing too exciting (Nando’s), and luckily we didn’t need to lug all our belonging along, because the owner of the apartment had given us an opportunity to leave our bags on the lounge of our room to be picked up a bit later the same day. Just our valuables with us… laptops… cameras.

The Strange Drunk

The Strange Drunk

When we got to the beach we had a few final wistful looks at the sand and the water, before spotting a rather peculiar figure out on the beach. You can see him just to the right near the edge of the photo. Hunched.

He was reading a paper next to a little pile of his belongings. And the waves started rolling in further. He occasionally glanced at the waves approaching, but didn’t think much more of it. Then when the next wave reached him he came to a rather startled jolt that prompted him to get up to evacuate… or so we thought.

It turned out he was rather remarkably drunk. He proceeded to construct a little sand-castle-mound next to his paper, on which he perched his shoes. And then he staggered around railing at the waves. We spent some ten minutes looking at the scene hoping a wave would take out his shoes to see what he’d do next, but it never got to that. Still, a highly amusing scene.

Laptop at The Beach

Laptop at The Beach

And then, a final walk along the sand for us. I easily could have spent another week doing nothing more than repeats of what we had been doing up till then. I still miss the rushing sound of the waves that continuously fills up the background there. Wafting in through the open bedroom window.

Anyway, it was a short but excellent trip. And Bronte was by all accounts a very good boy with Ab’s parents. Although he was quite over-excited to see us when we went to pick him up. But after 4 nights without us, I think he was allowed.