Posts

Happy Holidays!

So - you want a happy holidays messages for everyone you know but don't have the time to personalize it for each recipient?  Try this newfangled song writer class!  It's C# but should be easy to port to Java, C++, C, and pretty much any other object oriented language.  Enjoy, and have a wonderful holiday season! Holiday Song Writer

Please COM down

As part of our VB to C# conversion, we created an assembly compiling with the .NET 4.0 Framework.  One method in the converted class had a signature like: void MethodName(ref object p1, ref object p2, ref object p3, ref object p4) The first two paramenters are input parameters and the latter two are output.  p1 and p3 are really arrays of strings, and p2 and p4 are two dimensional arrays of strings, 16 and 32 bit ints, date/time, and potentially null values.  The ASP code worked fine on top of this. Then, we realized we want to use this component from an ASP.NET site currently compiling with the .NET 3.5 Framework.  We weren't using any 4.0 specific code so simply changed the compile type, deployed and regasm'ed the new assembly.  Strangely, when the ASP code tries to call the method above, it occasionally chokes, claiming that the "Variable uses an Automation type not supported in VBScript" followed by the method name.  What's odd is that it...

Conversion excursion

My team's applications rely on a large array of assemblies, some C++, some VB6, and some C#. The front end is largely a web site that is a mix of ASP and ASP.NET. We also have some Windows services - mostly C++ with a few newer ones in C#. A few of the C# assemblies are COM enabled to be usable from the C++/VB code, ASP pages, and services while others are only used by the ASP.NET. We're trying to migrate away from the VB6 code so I helped compile a list of which of the assemblies are in use by which other components. Our first pass will be to perform a direct port with COM wrappers so existing code can simply point at the new object with no API or behavior change. As we do so, we'll make a note of places where we think there are existing bugs or room for performance improvements. Have you ever performed a massive migration or upgrade? How did your team go about it? What pitfalls did you encounter as you went? With the one assembly we've ported so far, we fo...

On-time, thoroughly tested, and on budget: pick two

I'm sure many of you in the the corporate would know the age-old conundrum of the post subject. It's difficult to deliver all the right fixes on the original schedule and budget for pretty much any project. No matter how much we expect the unexpected there will always be even more unexpected issues to derail the schedule. So how do you decide when to ship? We are performing a major rewrite of a component for our upcoming release and discovered an existing issue that would be very costly to fix. Now, we have three options: (1) fix it poorly, likely breaking something else in the process, (2) fix it correctly and delay the release, or (3) don't fix it in this release but slate it for future work. My manager and I have opted for number three after careful consideration. The driving factors were the value of the other improvements to the component even without this fix and the time constraints on other work included in the release. As soon as slipping the timeline became ...

Flow of control

I'm sure most experienced programmers already know that using exceptions for flow of control in a program is highly inefficient. The time it takes to unwind the stack alone is ridiculous, let alone the fact that compilers don't tend to optimize for exception paths. The question is then what to replace it with? Do you set status and return an empty or a null? Do you always return a "result" object that includes both the result state and any return types? My team is working on updating our shared components' architecture and are considering this question as we go. We've decided to move towards returning a result object and having "out" parameters for most of the new methods we're writing. While not ideal, this does mean we always use the same type of return value. We could also create subclasses of that return type with more propoerties instead of using out parameters. At the same time, I'm working on creating some unit tests for our new...

Moving up

The Duke Health Technology Solutions has offered me a full time position and I have decided to accept! This is a marvelous step forward and I'm very excited to join the team. It does mean that I'll have to pass off my current project to another contractor as I'll be shifting my job responsibilities, but I'm confident that the codebase is well commented and clean enough that it should be relatively easy for another software engineer to pick up where I'm leaving off. It's been a very interesting transition. The work environment here is much different than what I experienced at Microsoft. Here, the expectations and pressures seems to be much more reasonable whereas at Microsoft I would have been in dire straits if I did not work at least 50 hours a week. This could partly be my aptitude, but I think that everyone in the local office worked at least that much so I certainly wasn't alone. At Duke, while there will still be pressures of deadlines and deliver...

WCF and Silverlight debugging

As part of my latest updates to my current project, I made a change to the underlying WCF service that provides much of the information to our Silverlight application. In one of my DataContract classes, I started passing a child class to one of its DataMembers (i.e. the DataMember is a property on Foo, I passed in a Bar which is a subclass of Foo). Then, when Silverlight called the asynchronous version of that method, I started getting an ambiguous error: "The remote server returned an error: NotFound" I stepped through both the Silverlight side and my WCF side - no errors apparent either place. However, just after the return statement in WCF and method exit, the Silverlight's service reference would pop up the "NotFound" error. Strange, I thought... what's the problem? Other web searched seemed to direct me to update the buffer size, to delete and re-add the service reference, all to no avail. Finally, I changed the type on my datacontract's datamem...