Friday, May 16, 2008

An interesting use for using

A college of mine came to see me the other day with a question about some code he had stumbled across. He wasn't exactly sure what it did, or more importantly, if it's something that he should be doing in his code. The code in question was a using block. Now, I'm right up there, telling people that they should have using blocks in their code for any object that implements IDisposable.. The problem was, the object in the using block didn't..













Now, I found this to be very interesting.. myObject was an instance of an object that clearly didn't implement IDisposable. Performing a cast like this would actually result in a null reference. The compiler was happy, the cast was invalid, and it ran without any problems at all.

I took a peek at the IL generated, and was pleasantly surprised to see that there is a check for nulls before the call to dispose.

I'm not sure if there is any benefit from doing this, and I'm sure I wont be recommending this to anybody, I just thought I'd mention it as an interesting tidbit.

Cheers

Vista and Office 2007

I just wanted to go on the record.. I really really really like Vista and Office 2007...

See, when both Vista and Office 2007 came out, I upgraded.. I've done this for every version of Office/Windows (except for Win ME...) since Windows 95. So far, I can't say I've ever had any major problems with an upgrade.

Back to Vista and Office.. The dev machine I had at home was a little under powered. I also play games, and the machine was struggling under the load. So, I did the right thing and built a new computer. It wasn't all singing, all dancing.. It was just a nice system. I met all the recommended requirements etc, 2 gig of ram, a decent video card etc. The end result was a system that ran fine, and for a smidge over $1000.. (This was just the computer, not the monitor etc..)

To date, I still haven't disabled UAC.. I've deliberately left it on.

Anyway, the point of my post is that I have not encountered any problems with this system to date, no stability problems, no performance problems, nothing.. Well, not completely try, I have had 1 driver problem, but that was with a Netgear NAS (very cheap.. And sucked under XP anyway..) that didn't have drivers for over a year after the release of vista.. This is clearly a problem with the vendor (or the people that made the re-badged toaster looking NAS box they sold)..

As for Office, wow.. Sure it was a shock at the start. The ribbon is a big change, but once I spent time to actually use it, I fell in love.. Back at work, I'm still running on XP and Office 2003, and I have to admit, I find now that I miss the ribbon....

I'm glad the upgrade process for both Vista and Officer is underway at work ;)

Thursday, May 08, 2008

WCF and Inheritance

Anybody who has had the pleasure of working with WFC, or in fact any messaging based programing will understand the issues related to messaging and inheritance. For those that don't, here is a quick rundown.

Take this situation:
I have a person class with:
  • First Name
  • Last Name
  • Age

When serialised, I get something like this:

FirstName: Eddie
LastName: de Bear
Age: 30

Now this so far does not cause any problems. It's designed to work like this. When a service receives this message, it knows exactly what it is dealing with.. A Person.. That's what the contract defines, that's what it gets and deals with.


Now, Imagine I now have a new class Employee which inherits from Person and adds a single attribute, EmployeeId.

Now, when this gets serialised, what do we see:

FirstName: Eddie
LastName: de Bear
Age: 30
EmployeeId: XXX-123-XXX


(This assumes that the new Employee class still has the same contract name etc..)
Now, if this was passed to a Service that expects a person, the service has a little heart attack. It has no idea what to do with the new attribute EmployeeId.. It's not part of the person class..

There are a number of solutions to this, such as Method Overloading. But one of the solutions I find the most interesting is the mechanism WCF uses for Contract Versioning. IExtensibleObject.

In the example above, you could easily implement IExtensibleObject on the original person class. IExtensibleObject basically provides a property bag for dumping extra information that is encountered at deserialisation time. This allows the service to continue to treat the Employee object as a person, without loosing the additional information added by the employee class.

A great article on the use of the IExtensibleObject interface can be found Here

Improving output

So, a while ago I found myself getting a little behind with my work. I found myself constantly caught up in meetings, spending a large amount of time communicating with team members and stakeholders. In fact, I found that more of my time was taken up with this that I could really afford, something had to be done.

So far, I have actually had little success in reducing the number of meetings that I need to attend. This is something that I'm sure keen to work on, but find that getting these meeting taken offline (email, IM etc) still has a great deal of resistence in the workplace, people like face to face contact.

What has changed though, is my productivity.. No, I still refuse to use code generators.. But I have found myself adding Code Snippets to Visual Studio at an absolutely astonishing rate. I find that code snippets provide me with the best of both worlds, I don't need to continually waste time writing the same templated code repeatedly, and the overhead of creating them in negligent.

So, what sort of things do I use the Snippets for.. The answer is easy.. Any repetitive work.
  • Properties with Change Notification
  • Data Access
  • Service Contracts
  • Data Contracts
  • Exception Handling
  • Anything else I type repeatedly

Basically, I find that by removing the tedium of these repeated tasks, I can spend more time focusing on the actual business specific problems.

Productivity ++

Friday, May 02, 2008

It helps to read the manual..

I've had my i-Mate Jasjam for a little over a year now, and for the most part it's been very reliable. As of late, I've been having a little bit of battery problems. In particular, it's because most applications continue to run even after clicking on the little X in the top right hand corner.

Over the last year, I've slowly added more and more applications, and tend to spend more time surfing the web (or just have programs like tinytwitter running).

Anyway, today I stumbled across a little feature that I'm sure was not on the original WM5 rom that was loaded when I got my phone, but was added by I-Mate in the WM6 rom. Basically, it actually closes the application when you hold the X button for a few seconds. This avoids constant trips to the task manager and clicking the "Stop All" button..

Monday, April 21, 2008

Keeping Busy

It's been a few weeks since I last posted here, but being so quiet has nothing to do with the reality of my life. The last few weeks have been an absolute whirlwind. I've had 30th birthdays, an old friend from Ireland visit, work on getting my divorce finalised and a lot of golf in my spare time.

Oh yeah, I've also started back at the gym..

Throw in Work, spending time with the kids as well as my wonderful new girlfriend and you can see that life has just been extremely busy.. I just haven't had the time I'd like for playing with new Toys and Technologies..

Anyway, the fast life is starting to slow down again, and I should now have plenty of time to start to get back into playing and learning again.. I'm looking forward to it :)

Thursday, March 27, 2008

WM6 Daylight Savings Update

Just read this over on Rog42 about the update for WM6 daylight savings settings.. Anyway, there are a few links for both the MSI and CAB updates. The MSI is to updated from a PC and the CAB directly from your Mobile Device.

Anyway, short story is I'm at work and can't connect m phone to my PC, so I'm stuck with the CAB update.. So it was off to TinyURL.com to shorten that ghastly download link. This made it heaps easier on my phone. For anybody else who needs it, http://tinyurl.com/2b67p4 should do the job nicely :)

Happy Updating...

Apple Pushing Safari

So, last night I got home and turned on my computer. Just wanting to kick back and do a bit of reading that I didn't manage to finish at work. Within a minute of turning on my computer, the apple updater popped up. The apple updater?? Yep, It got installed along with iTunes for my daughter's IPod.

Anyway, when I thought it I first thought to myself, cool, a new iTunes update. This must be good.. I was just glad I took the time out to read what the update was... It was Safari 3.1... WTF?? I don't want Safari 3.1... I have a browser that I use and am very happy with. Why would I want another vendors browser pushed on my just because my daughter has an iPod...

Anyway, it only took me around a minute to work out how to block the download, but it really left me thinking.. How many people will accidental end up downloading safari (there are lots of iTunes users out there..).. And more importantly, once it's downloaded, does it install and set itself as the default??

If the answer to this is yes, is this possibly an example of a company using it's dominance in a market (music) to work it's way into another market?? Possibly.. It's not the first time it's been done...

Either way, I'm going to be interested to see how many windows users will be running safari 3.1 in the near future..

Wednesday, March 05, 2008

Misinformation in the Media

As a kid, I used to sit in front of the TV and watch the news, or even pick up a news paper and read an article or two. I was taught at school that this information should be used to keep up to date with current affairs and the likes.

Unfortunately, like most people, there is a point in your life when you start to realise that the information provided in these mediums is far from accurate. It's not that they go out of their way to lie, it's more that the people reporting may accidentally forget to include something in their articles.

Yet another example of this appeared today in The Age. Basically, the article is about a "Security Specialist" who found a "security hole" in windows, and Microsoft did nothing to fix it. The truth of the matter is that it's a flaw in the Firewire specification which can be used to exploit any OS that has support for Firewire. In fact, the flaw is actually a "Feature" that allows connected firewire devices to access (read/write) directly to system memory. This can be used to do anything on a running computer you can possibly think of. The only limit is the attackers imagination.

I'm not sure that this omission was completely deliberate, it's probably more just a case of the author not actually knowing any better, which really begs the question about why they are in that job in the first place. In this case, they are probably there because they follow the current trends in the technology media. Bag out Microsoft, and Rave about Apple.

My real question is, how long is it going to take before someone finally gets fed up with this sort of Misinformation and actually does something about it. At the end of the day, companies need to rely on their image in the community, and when the media continually effects the image of a single company, there is only so much those companies will take..

Thursday, February 28, 2008

Mac vs. PC vs. Linux - South Park Style

Tired of all the commercials.. Check out this take on them..

Wednesday, February 27, 2008

Windows Live Writer

As part of the whole getting back into blogging thing, I've decided to start using Live writer from now on. This is the first post, and I have to say it's been an absolute sinch so far.

LiveWriter

Anyway, here is a little picture of it Live Writer running. As you can see, I've actually taken a screen shot of me writing this post ;)

Friday, February 15, 2008

A feature I'd like

It's really simple, but I think it's something that is really needed. You guessed it, HTML support in outlook for items other than emails.

I'd like to be able to paste HTML into appointments for example, or even better, have outlook render the HTML Description stored in exchange for an appointment instead of having it converted to RTF (very badly might I add...)..

It's just a small little feature I'd like to see one day in outlook...

Thursday, February 07, 2008

Sorry to hear guys

Sure the writing was on the wall, but it's still sad to see happen. I learned this morning that a large department has just terminated a large number of contractors due to budget over runs and a whole heap of other excuses.

Unfortunately, this is just what happens in IT, and it's part of the reasons contractors get payed that extra bit of money. Having said this, it's still not the sort of thing you want to see happen to our friends, especially when many people knew there were problems, yet nobody wanted to listen.

This raises a very interesting question. Why won't people listen.. Sure, sometimes it may just seem like people are having a whine, I know, because I enjoy having a whine with the best of them. Other times, it's just a game of self promotion at the cost of everything and everybody else. I still to this day do not know the answer to stopping this, short of just letting those people hang themselves..

Unfortunately this time, some very nice people, many good friends of mine have been hurt and left in a bad situation. So, I'm putting up this post to let them all know that I feel for them, and to wish them all the best of luck in moving forward.

Take care guys and gals..

Tuesday, February 05, 2008

C'mon guys

I'm a bit of a geek, I like to have all the new sparkly bits and pieces whenever they are released. One of the things I'm currently trying to do is replace all the boring old desktop apps I have with nice new .Net bits and pieces that I can. I've got myself a replacement for notepad, use Paint.NET and a few other bits and pieces. In general it's been a pretty good experience.

That is except for two things that I'm really keen to take a good peek at. MSDN Reader and Architecture Journal Reader. Both of these are based on the News Reader SDK and have been created by the kind guys at MS.. Unfortunately it looks like they didn't even bother putting in support for Proxy Authentication.. Now while I haven't looked at the News Reader SDK, I'm fairly confident that Authentication shouldn't be any harder than it is with the existing framework.. See the two lines below.. Either one will work depending on the enviroment..

Credentials = CredentialCache.DefaultNetworkCredentials;
Credentials = new System.Net.NetworkCredential("UserName", "Password", "Domain")

Please guys, fix this up...

Thursday, January 31, 2008

Scrabble

So, along with a whole heap of other changes lately, I've been plaing quiet a lot of scrabble lately. Actually, saing that I'm plaing is a bit of an understatement. It's been getting so serious that I've just ordered a copy of the official scabble dictionary. Hopefully this will put an end to the arguments.. And just for the record, Qi and Fa are real words...

Friday, January 11, 2008

Catching up with life

As I'm sure many of you already know, the last year has been particularly hard for me. I've had a few personal issues that needed to be taken care of, and with that, I also took a bit of a back seat in the world in general, content to just let everything take it's course.

Somewhere along the way, I realised I was missing something. My Mojo.. I lost my mojo.. When I realised this, I decided to do something that I probably should have done a little earlier. I changed jobs, getting me out of my comfort zone and also did my best to get rid of some other baggage.

So here I am now, start of a new year, looking to get back on top of everything. So keep an eye out on the blog, and I'll keep you all up to date with the what's, how's and why's..

Thursday, January 03, 2008

If I hear it one more time

"Why don't we use code generation"...

I'm going to put it very very simply.. I HATE CODE GENERATION.

Why? It's simple. Code generation CAN help developers get applications to market quicker. I won't argue that point at all. My argument against code generation is all about abstraction and workflow.

Abstraction
I've worked in many environments, but one thing seems to remain the same. At some point, you will have to integrate with an older system. More often than not, that integration will be done at the database. Yes, I know the whole point of SOA is to re-use the services, but how many places are in a position to do that yet?

Anyway, back to the point. Over the life time of an application, entities in a system tend to change. They acquire new attributes, they change their behaviour and many other subtle changes. The end result, a person for example is could originally be stored with just an Id, a few fields for their name and maybe a data of birth. Over time, more information gets added. The person may now be an Employer, an Employee, a Client.

As these entities gain more attributes and new meaning, business rules will be applied to each different incarnation. A person is no longer a person.

Now you may think I've gone off track a little. What does this have to do with code generation. It actually has 2 things.

The first is that Code Generator Fanatics will just point their favorite tool at the database and let it do all the work. The problem, is that you now have services and a UI that are just a representation of a person with lots of other information. This is how you end up with applications with 20 tabs and a few hundred fields that all need to be populated before the user can press save. It's hideous and not very user friendly.

The second part is to do with the "We can just rebuild the whole thing" mentality. In this world of source control, managed change etc, at what point did it become acceptable to just blow away half a project and re-generate it just to add an extra field to an entity. Ooops.. Did someone change that file..

Workflow
Next up on my list of gripes is to do with workflow. I touched upon it just above. I'm a big fan of services guiding workflow. I don't know how often I end up on a project where the services are just a set of GetXX(), AddXX(), UpdateXX() DeleteXX() methods. I hear developers talking about CRUD (you know, create, read, update, delete).. This stuff works fine in small projects, but when you start having to add workflow into the picture, it very quickly becomes messy.

Lets look at a simple problem with this. Imagine that within the database we have Users and Contacts. Both a user and Contact have Addresses. Some smart cookie along the way realised that this could be normalised and they both have a relationship with the same "Address" table. Now you need a SaveAddress() method. That's cool and all, but should you be saving an address without some sort of context as to why it exists.

In this situation, I tend to go for AddAddressToContact(Contact, Address), AddAddressToUser(User, Address). This is clear what is happening and you no longer have confusion about why your wonderful OO design doesn't work in a messaging environment.

One Final word
I'll also throw in another little issue I have, and that is when devs take it just that little extra step. They also code gen their unit tests. C'mon... What point are unit tests if they are always going to succeed. You are making our unit tests so they only call your code the way YOU WANT OUR CODE TO BE CALLED. It's not testing for the unusual cases.. Unit tests are supposed to test the unusual cases as well..

Anyway, that's my little rant for now. Feel free to drop a comment about how wrong I am on the subject and I'll buy you a beer while I argue with you until I'm blue in the face :)

It's done and dusted for another year

Yep, that's right, the party season is over, it's time to sit down behind the computer and get back to the hard work. Projects don't finish themselves. Actually, this is what my post is about. Projects not finishing themselves.

I often find it ammusing how often I find myself on the critical path of a project, not that I find this a problem, quiet the opposite. I find I work best under pressure. For me, this is the one thing that keeps me motivated. However, working as a team lead, I often find that more and more of my time is taken up with meetings. You know the type, talking to project managers, talking to busniess reps, talking to BAs. It's the communications.. All projects need communications.

The problem though is this. I spend more time communicating and less time coding. Sure, others in my team are still busy working away, yet my work seems to be getting left behind. This leads me to believe that there is a problem. I don't think that there should be less communications, I just think that I need to find a more effective way to communicate with all the other people in the project. Meetings are a nice break, but I'm sure they are not the most effective way to communicate...

Anyway, I'm going to post more about this over the next few days, but lets jsut say that it's not going to be easy considering the tools I have at my disposal. Stay tuned for all my fun adventures...

Thursday, December 20, 2007

IE8 passed ACID2

Ok, if you haven't heard it yet, the dev guys working on IE8 have just announced they have checked the code into source control allowing IE8 to pass the ACID2 Test.

As you can imagine, this seems to have created a massive buzz around the web. It's an important step to having IE8 "standard" compliant, though all it really means at the moment is that IE now renders a large set of CSS2 and 2.1 correctly AND handles errors gracefully. I'm sure there is still more work to go before IE8 fully supports the full set of standards (Pick a standard, any standard.. there are plenty of them..).

Interestingly, IE8 will need a special DOCTYPE tag to indicate it's should be processed in "Standards" mode. Why does it do this, it's pretty simple. It means IE8 won't break the web. It will continue to render everything the way it does in IE7.

What it means though. especially for all of us developers, we will now need to start paying a little more attention to web standards (By Us I mean everybody else, if you've ever worked with me or talked to me, I don't do web dev...), but hopefully, we won't need to write web sites differently for all the different browsers.

Anyway, after reading this, it took me a little bit to work out what it really means to me as a non web developer. The answer was actually really simple. I'll hear less complaining from web developers. This is a good thing. Second of all, the only web site that I've ever had trouble with in IE6/7 (Slashdot) may now actually render correctly. This is great as I can now enjoy reading their tripe and constant complaining the way it is intended..

Thursday, July 05, 2007

A quick catch up

New Job
So, here I am, sitting at my desk, enjoying the challenges of a new contract, learning all the faces, the project and investigating why things are done the way they are. This last part for me is probably the part I both enjoy and hate the most. I always enjoy looking at processes and technology to see how they have been used in creative ways, yet at the same time find it sad that some opportunities go begging for seemingly small petty reasons. I have to say though that so far the I have not found any of these things yet, which is really exciting.

Blogging Friends
I'd also like to just throw out a quick shout to Dave and Glenn, two of the great guys I worked with on my last contract who are both now blogging (for a few weeks, I just haven't had time to say anything yet).

Leaving Friends
And then there is Kyle, yet another of the talented developers I've been lucky to work with. He's all set for the UK to see what mysteries await. Good luck dude, make sure you stay in touch.