Do you, like me, have multiple Windows Live ID's? Or old passport accounts? Want to link them? Now you can!

Windows Live now has a service that let's you link multiple ID's together. The site offers the following explanation of the service:

About Linked IDs

If you have a Windows Live ID that you use for work and one that you use at home, you can link them. When you link more than one Windows Live ID, you can sign in to a Windows Live site or service with one account and still have access to information related to the linked accounts.

Basically it allows you to have access to both ID's and their respective contact lists etc, while signed in with one of them.

Click here to explore the Linked ID service.


 
Categories: Misc | Tools and Toys


I was recently refactoring some code in a Web Service that is called by numerous external consumers as well as internal clients. As we all know when you publish an interface you are more or less signing a contract not to change that interface. This becomes even more of an issue when clients outside of your organization are calling your code.

Or perhaps you have written and distributed an SDK or API that is used by others to access functionality in your application. Either way, you change such public facing interfaces at your peril! It's why you often see method names like the following in public SDK's:

ShinyMethod
ShinyMethod2
ShinyMethod3
NewShinyMethod

This results from having realized, after the fact, that your public interfaces were unable to do something you want/need them to. Or perhaps something you are calling changed and now you need more information or different parameters than before. Whatever the reason since you signed the contract, you had to implement different methods leaving the old ones intact so that you don't break every caller instantly during your next update.

This is a legitimate response to a common problem. Now don't start screaming at me about better design, overloading methods etc. I know there are dozens of ways to tackle issues like these. I am using this as an example about how to notify your callers that you are about to "renegotiate" your contract in a gentle kind manner!

So, let's say you have a method, called MyShinyMethod that takes two integers and a string as parameters. For 6 months or so that method has sufficed to handle it's intended function. Then one day you get a call from accounting telling you that now you need to handle two integers, 1 string and a double! Ah, you say, no problem and add an overload to your method.

Then, sometime later accounting and marketing call, now the calling programs need to be able to pass 2 doubles, 3 strings, and a boolean and return an XML file.

Ok, you see where this is going, you really can't continue to handle this with overloads, and what you really want to do is change your public interface. But you can't do that, at least not immediately. So we need a way to tell all our callers that we are going to change our interface. In comes the "Obsolete" attribute.

You build a new version of you service, with the existing public methods you had, and you add a new even shinier method called MyNewShineyMethod that is designed to take just about anything and return even more!

Now we need a way to notify existing clients that there is a new method in town, and that the old method will soon be leaving!

Your old method would look something like this:

Public Function MyShinyMethod(ByVal int1 As Integer, ByVal int2 As Integer, ByVal str1 As String) As Boolean
     'do something cool here
     Return True
End Function

 So now you add your new method, and need a way to tell your callers that they should start to use the new method, and get ready to stop using the old one:
 <Obsolete("This method is not so shiny anymore, start using: MyNewShinyMethod")> _ 
Public Function MyShinyMethod(ByVal int1 As Integer, ByVal int2 As Integer, ByVal str1 As String) As Boolean
'do something cool here
Return True
End Function
Public Function MyNewShinyMethod(ByVal params As Collection) As String 
'do something cooler here
Return ""
End Function

Now when users compile their applications that call your service, they will get a warning error if they are using the old version with the text you supplied with the Obsolete attribute. They can still compile run and call the method, but they will begin to see the "error of their ways" in the form of compiler warnings.

Now, eventually you want to be able to "retire" the not so shiny method. Change the attribute as shown below, and instead of warnings, the caller will get Errors!

 <Obsolete("This method is no longer available, use: MyNewShinyMethod instead.", True)> _ 
Public Function MyShinyMethod(ByVal int1 As Integer, ByVal int2 As Integer, ByVal str1 As String) As Boolean
'do something cool here
Return True
End Function
Public Function MyNewShinyMethod(ByVal params As Collection) As String 
'do something cooler here
Return ""
End Function

By adding the "true" parameter we are telling the IDE in the calling applications to flag this as an error and not allow compilation. But the error message shows the caller what to use instead!

Hope this helps!

Cheers,

Robert Porter


 
Categories: .NET | Agile | Programming | Visual Studio


October 26, 2007
@ 11:45 PM

For the last two years I have had a UTStarcom PPC 6700 Smartphone. It was great, I enjoyed it and I would recommend it to anyone. Mine finally developed terminal touch screen failure. Certain parts of the screen would no longer react to being touched no matter how hard.

ppc6700

It came with Windows Mobile 5 and I had added a half dozen or so must have utilities that I always seem to find. AIRoboForm for PPC, SplashID for PPC and Battery Pack Pro were on top of the list, as well as Windows Live Search. The phone happily sync'd with Outlook and other programs keeping my appointments, tasks and contacts in order.

I was also able to use the Spring EV-DO network, or any handy WiFi access point to surf the web or send and receive email when away from my office. All in all I was pretty satisfied with the phone. So I was sad when I realized that the screen failure was rendering it less than useful.

Off to Sprint I went, after all I was paying 7 bucks a month for the "Total Equipment Protection" plan right? Well much to my surprise the Sprint rep took one look, said yep, "It's broken", and "we don't sell those anymore, is it okay to give you a PPC 6800?"

"Of course!" says I, with a grin from ear to ear! So now I am the proud owner of an HTC Mogul PPC 6800 with Windows Mobile 6.0 Professional, all Vista looking and shiny! A quick zap of my data off the old PPC

ppc6800

6700 and a sync with my 6800 and I was right back in action!

The new phone sports a few other improvements, like WiFi G and B instead of just B, my home router is now happily set to "G Only" and pumping much faster connections than when it was running in mixed mode. The form factor is nicer too, no more stubby antenna to worry about. And the keyboard slide is spring loaded so when it opens it does so with a satisfying "thunk"!

It came with Windows Live out of the box, and had a newer version of Messenger as well. So now I can happily IM whenever I want again! And lo! The screen works! Everywhere! It, like the 6700 has Windows Media Player, and can play music just fine. But I mostly use it to listen to podcasts. The audio quality is fine for me, and it paired easily with my Bluetooth headset.

All in all, the 6800 is the 6700 done right in my opinion! A great device that combines the best PDA features with a decent phone. And as a bonus I can easily write my own programs for it so it is a geek toy all the way. Oh yeah, it came with Java pre-installed as well and I still have over a Gig of RAM/ROM left counting the storage card, so plenty of room to add programs in!

Cheers,

Robert Porter


 
Categories: Mobile | Reviews | Tools and Toys


October 25, 2007
@ 10:38 AM

Ever been stepping through code using F10 and F11 and forget to step over something that you did not want to step into? Like a whole series of Get/Set calls on a bunch of properties for a class that you know is fine?

You can control what the debugger steps into by using method attributes and decorations. Using these you can essentially make parts of your code invisible to the debugger.

The first one I want to discuss is the <DebuggerStepThroughAttribute>. Using this attribute will prevent the debugger from stepping into the code it is applied to.

VB.NET

Private ReadOnly Property LastName() as String
     <DebuggerStepThroughAttribute()> _
     Get
           LastName = m_LastName
     End Get
End Property

C#

private string LastName
{
    [DebuggerStepThroughAttribute()]
    get
    {
         LastName = m_LastName;
    }
}

With the above you can still set a breakpoint inside the methods and execution will stop when the breakpoint is reached. If you want to make the code completely invisible to the debugger including not being able to set breakpoints then use the second attribute.

<DebuggerHiddenAttribute>, This attribute will essentially hide the methods it is applied to from the debugger entirely. 

 

VB.NET

Private ReadOnly Property LastName() as String
     <DebuggerHiddenAttribute()> _
     Get
           LastName = m_LastName
     End Get
End Property

C#

private string LastName
{
    [DebuggerHiddenAttribute()]
    get
    {
         LastName = m_LastName;
    }
}

Note that in order to get the debugger to honor these attributes you need to turn off the "Just my Code" option in Tools|Options|Debugging Options.

Oh, and finally you need to import the System.Diagnostics namespace for this to work at all.

Hope this helps, I know I use it a lot, once I knew it existed.

Cheers,

Robert Porter


 
Categories: .NET | Programming | Visual Studio


October 24, 2007
@ 02:16 PM

I recently signed up for (again), a Google Adsense account. The idea is simple and straightforward, you sign up, inject some code into your web site or blog, and adsense ad's are delivered via Google. Google tracks the click through's from your site, and depending on a number of factors you begin to earn revenue.

The ad's will gradually adjust so that they are relevant to the content of your blog. This is accomplished by some arcane algorithm that Google uses as they index Adsense enabled sites and blogs. At the moment, the ad's on my blog seem to have developed a fixation with my name, "Bob" and I have ad's for "Bob The Builder Pajamas" and "Bob Dylan Art".  And somehow it decided that my blog was the perfect forum for selling woman's underwear last night and I had tall "skyscraper" images of scantily clad women all over my blog. (Try explaining that one to your wife!!!)

As of yet, I have earned a grand total of... Drum roll please.... ZIP, Nada, Zilch! But it has been only a few days. I also signed up for the affiliate program with my webhost, and if someone clicks on their banner ad's on my site, and meets some other conditions, I can earn referral fee's etc.

So if you need a good, .NET enabled, dasBlog friendly webhost, please come to my site, and click on the banner for WebHost4Life, and then sign up for a year of no hassle, worry free, low cost webhosting!  My wallet will thank you!

Cheers,

Robert Porter


 
Categories: dasBlog | Misc


October 24, 2007
@ 01:51 PM

Ok, I know I promised I would post about but to be honest I am not sure I myself fully understand the difference or need. Mock objects are easy to understand, but I have yet to find two people that agree on the definition of Virtual vs. "regular" Mocks.

Wikipedia has entries for both Mocks and Virtual Mocks, but at least at the time I write this there was little to no content on the Virtual Mock entry. The main difference would appear to be that Virtual Mocks can Mock a concrete class, while normal Mocks are used to simulate the interface only.

More on this as I learn more. But my use of Mocks in TDD has been pretty much limited to interface level work. There is a huge and at times, nasty debate in the blogosphere relating to Mocks, particularly as they relate to coupling issues, Dependency Injection (DI) and issues. Which also ties into the growing debate on "design for testing", which means that you write your code to facilitate testing from the start.

I honestly don't have the required background to register a viable defensible opinion on all of these issues. What I can say is that using TDD and Mock's has enabled me to produce better quality software, faster than I ever have before. With fewer debugging sessions, and as an added benefit it tends to make me write code that is easier to refactor later to introduce new features etc.

One of my most memorable moments in my journey along the TDD path of discovery was when I had to add significant new functionality to an existing application that I had written. The application had existing tests, with probably close to 80% coverage.

I made the first round of changes, ran the tests, had two failures, refactored the new code to get the tests to pass, added a couple of new tests related to the new functionality, fired the tests one last time, all green! Turned the code, with confidence, over to QA and testing and was done! It was a personally very satisfying moment. Previously I would have held onto the code for at least another two or three days trying various combinations of simulations and debug stepping and then been still unsure of the state when I turned it over.

Mocks come in very handy for me when I want to decouple the system under test from dependencies that are expensive (Database calls, Web Service Calls), or ones that don't exist in any form except for production. (I have worked for clients that could not or would not set up a complete DEV/TEST/PROD triad of environments, and in some cases, some systems only existed as production instances.)

Remember, when you are testing and developing you are testing your code, not performing integration testing of the whole system. That comes later.

Mocks also come in handy for cases when you need to test your codes response to what is in essence a "black box call" to a component or system for which you don't have code, or don't have the access etc. In short Mocks help me focus on my code and the system under test and not someone else's.

In an upcoming post I will show some examples of how and when I have used Mocks. And attempt to explain the thinking I went through in deciding to use a Mock, and how to implement the Mock etc.

Meantime, keep the questions coming!

Cheers,

Robert Porter


 
Categories: Programming | TDD


October 22, 2007
@ 11:47 PM

I am taking the advice of two good friends and attempting to begin making money off my blogging efforts. So I have signed up for an Google Adsense account, and as you can see am already advertising for my hosting provider.

Ken Spry, a good friend and fellow geek, has been using Adsense for sometime, and as he puts it, not doing it is like throwing money away.

Ted Demopoulos has written several books on the subject of blogging in general and covers podcasting as well. If you have not read his books and are serious about blogging then you are hurting yourself! Save some serious skull sweat and effort and buy his books!

(And no, I am not getting paid to plug these books! I am recommending them on their own merits! However in the interests of disclosure, I am an Amazon affiliate!)

 


 
Categories:


Scott Hanselman and ScottGu did a recent public presentation on the new Model View Controller Framework implementation that Microsoft is developing.

Scott has a post with some links to videos of the presentations as well as some great background information.

Roy Osherove has a post about this as well, it can be found here. While MVC has been around for quite awhile now, this is the first time Microsoft has officially supported the concept as opposed to their own Frameworks. I think it is worth reading up on, especially if you are a web developer.

Cheers,

Robert Porter


 
Categories: .NET | ASP.NET | Programming | Visual Studio


According to Wikipedia a Mock Object is defined as:

In object-oriented programming, mock objects are simulated objects that mimic the behavior of real objects in controlled ways. A computer programmer typically creates a mock object to test the behavior of some other object, in much the same way that a car designer uses a crash test dummy to test the behavior of a car during an accident.

So a Mock object is in essence a replacement for a real world object or process. A Mock object has the same interface as the real objects they are standing in for. But these Mock objects typically simulate the actual operations of the real world objects. This means that instead of calling an expensive, in terms of time and complexity, object like a web service, they can simulate the call and respond in realistic ways without the overhead of database interaction or network latency.

This allows the unit tests being written against the Mock to focus on the actual behavior but without the penalty of the real overhead. In a fairly complex application with potentially hundreds of unit tests, speed of test execution becomes a real issue. Mocks help keep that interaction realistic but not punitive. 

Eventually in the testing of a system, the Mocks will need to be replaced by their real world counterparts, this is typically done in the integration or system testing phases of the project.

Mocks, Fakes and Stubs

Mocks are different than Fakes. A Fake is simply an object that implements the interface of the object it replaces, usually with predetermined responses to each method call. A Mock goes further in that it is often coded to contain it's own assertions, and track state perhaps as well. In this way a Mock can determine and respond appropriately if its methods are called out of order, or prior to some initialization call etc.

A stub is typically even simpler than a Fake. A typical stub for example, could be a boolean function call, that is replaced with a simple "Return True" line of code. The functions parameters are not examined or validated, every call to the stub simply returns "True".

Why use Mocks?

Among many other reasons to use Mocks, one reason comes to my mind from recent experience. We were testing a system that was time of day sensitive. Meaning that we needed to know during testing that several different portions of the system responded appropriately when the time of day was between certain time periods. With Mocks it was easy to provide this kind of functionality whereas with the real objects we would have had to reset clocks on 3 different systems, over and over, in order to achieve repeatable results.

Next post: Virtual Mocks


 
Categories: Programming | TDD


For those of us old enough to remember the pre-Windows era, the arrival of 3 technologies marked a turning point in history. One that was not immediately recognized by some of the biggest technology and software companies until it was to late. And I think we are witnessing a repeat of that event.

Some History

I began programming computers professionally in 1979. I worked at Travelers Insurance company in Hartford Connecticut programming an number of different IBM mainframes in COBOL and Assembler. In 1981 I began writing code for the Zilog Z80 running CP/M and later the 6502 chip made famous by the Commodore Vic and later the 64 and 128 models.

Sometime after that I began writing assembler code for early Intel processors including the 4004, 8008 and finally the 8086 and all of it's descendants. These programs were all character based, typically with a monochrome screen with 80 columns and 25 rows.

I made a fair amount of money writing what were called TSR's for the IBM/Microsoft DOS platforms. A TSR was a Terminate and Stay Resident program, it was designed to run, install itself, hook a keyboard interrupt, and then go to sleep. It could be awakened by pressing the key combination associated with it. Sort of an early attempt at multitasking.

In 1990 Microsoft released Windows 3.0. I had played with Windows 1.0 in 1983 a little, and Windows 2.03 later, and was unimpressed. I saw potential but the hardware of the day just did not allow for an affordable system that was capable of running these earlier versions. But 3.0 and later 3.1 and 3.11 were stunning! I took one look and never looked back. I knew this was the future of PC's and corporate computing.

At the time WordPerfect was the dominant Word Processing application and Lotus 1-2-3 was the dominant Spreadsheet application in the DOS world. And Novel was the dominant Network OS for PC's. And they (and most of the rest of us) assumed they would continue in those roles.

What they did not realize was that Windows heralded a true paradigm shift in the world of the PC. I know that phrase is over used, but it really fits. Both Lotus and WordPerfect were slow to offer versions of their applications for Windows, and when they finally did, they were terrible products that did not work well, lacked features their DOS versions had, and just did not "fit" in the Windows environment.

Microsoft had already had a lot of experience writing applications for a graphical environment, courtesy of their work for Apple. Word, and especially Excel, were great applications for their time, and took full advantage of the Windows environment, and WYSIWYG formatting and editing. Not surprising perhaps considering they also created the OS.

Novel, on the other hand did not seem to take the threat of Windows seriously. Yet NT was on the horizon and Windows for Workgroups was already making huge inroads into the lower end of the networking market.

In a few short years WordPerfect all but disappeared, Lotus lost it's dominant position in its market and eventually was subsumed into the original "Borg" of the software industry, IBM. Novel limped along longer, but it too is a shadow of its former glory.

All of them missed the proverbial boat when Microsoft brought it's triple whammy to the market, Operating System, Applications, and it's own Network Operating System. All more or less integrated, all capable of working well together and all "good enough" for most users and small to midsize business.

Flash Forward

Are we watching another watershed moment in computing history now? I think so, but I am not sure what to call it. It's not a new concept, but technology and infrastructure have caught up and now the model is actually workable. It's leading representatives are Google Office and Microsoft Live Office. Neither are quit there yet, but it sure looks like they are heading in the right direction.

Network bandwidth is increasingly available at ever cheaper rates. The concept has several names, but they all describe a similar set of concepts. Zero or low touch install of applications, a browser based experience but with a much richer more desktop type user experience. Usage licensing, (Software as a Service?) as opposed to shrink wrap licensing.

There are still some huge barriers to adoption, security, trust, access and reliability, etc. But these issues are slowly getting worked out. I still prefer a locally installed desktop application over the available web based alternatives, but the feature and experience gap is steadily narrowing. The economic model has yet to prove itself either, but concepts such as Micro Payments, services such as PayPal and others are all aiding that effort as well.

So what do you think? Who will be the casualties of this shift? Who will be the winners? How far are we from a truly major change in how and where we we get the applications we use in our daily lives?

Think about it!

Cheers,

Robert Porter


 
Categories: Misc | Programming | Ramblings