As I mentioned in my interview with George London, I have too many hobbies. Long-time readers of this blog know that I started a second blog, Fabulous Adventures in Casting, because I was building a backyard foundry to learn how to cast aluminum. Starting a new job on top of everything else was too much and so I decided to put that hobby on hold for a year or so, but I’ve started up again recently. And since this is not just my MSDN-hosted work blog anymore, I’m going to gradually move that content over here and occasionally post about stuff I’m doing that does not involve C#, like casting and woodworking. (UPDATE: As promised, those posts have been integrated into this blog; see the Foundry category.)
Continue reading
Monthly Archives: November 2013
The A-star interviews
Tech blogger George London is running an interesting series of video podcasts wherein he interviews programmers about their jobs and then asks them to recommend other programmers to interview. On his ninth hop through the social network he managed to get to me. If you have 75 minutes to spare, here’s our long and rambling interview from the ukulele storage room in the new Coverity office. Subjects covered include Coverity, Roslyn, the Commodore SuperPET 9000, rocket ships, Zork, woodworking, sailing, monads and teaching trigonometry to youngsters, and many more.
The new Seattle office
As I mentioned earlier, we spent the past weekend moving the Seattle office from temporary space on the north side of the 42nd floor of Columbia Center to the south side of the 12th floor. I initially thought that this would be downgrading my fabulous view but no, it turns out to be an upgrade! Here’s the non-Mount Ranier side of the view from my office: (click for full size)
ATBG: non-nullable reference types
Today on the Coverity Development Testing Blog‘s continuing series Ask The Bug Guys, a question I’ve gotten many times in person over the years but never blogged about: just how difficult would it be to retrofit non-nullability into the .NET type system? Pretty hard, it turns out.
As always, if you have questions about a bug you’ve found in a C, C++, C# or Java program that you think would make a good episode of ATBG, please send your question along with a small reproducer of the problem to TheBugGuys@Coverity.com
. We cannot promise to answer every question or solve every problem, but we’ll take a selection of the best questions that we can answer and address them on the dev testing blog every couple of weeks.
Coverity analysis and FXCOP
This has been a crazy busy week and its only Tuesday. I spent the weekend helping set up the new Coverity office on the 12th floor of the Columbia Center — more on that on Thursday, after I’ve had a chance to take some photos — and schmoozing with my old team at Microsoft as part of the MVP summit. I am super-excited to be a C# MVP, though it is a bit odd to be on the audience side rather than the presenter side for the summit. “Thank you Eric for holding onto the microphone for us for the last half hour” was Anthony‘s wry comment after one marathon Q&A session yesterday. Old habits die hard.
One of the questions I’ve gotten frequently, both here at the summit and at other events, is how Coverity’s analysis of C# programs compares to FXCOP. My “Ask the bug guys” colleague Jon has just written an article about that very subject, so check it out. The short version: by design, they do not overlap at all. We want these tools to be complementary, not competitors. (And in fact you can import FXCOP warnings into Coverity Connect to track them alongside of defect reports discovered by Coverity’s analysis.)
A practical use of multiplicative inverses
Last time we showed how you can take any two coprime positive integers x
and m
and compute a third positive integer y
with the property that (x * y) % m == 1
, and therefore that (x * z * y) % m == z % m
for any positive integer z
. That is, there always exists a “multiplicative inverse”, that “undoes” the results of multiplying by x
modulo m
. That’s pretty neat, but of what use is it?
Continue reading
Math from scratch, part thirteen: multiplicative inverses
Here’s an interesting question: what is the behavior of this infinite sequence? WOLOG let’s make the simplifying assumption that x
and m
are greater than zero and that x
is smaller than m
. Continue reading
ATBG: de facto and de jure reachability
In the latest episode of the Coverity Development Testing Blog‘s continuing series “Ask the Bug Guys”, I dig into an interesting question about inconsistencies between de facto and de jure unreachability — that is, the difference between code that is actually unreachable and the smaller set of code that the C# compiler detects as unreachable. The difference can cause some interesting inconsistencies in the compiler’s behavior. And my colleague Jon ponders the wisdom of fixing fragile, hard-to-understand code even if it is at present correct.
As always, if you have questions about a bug you’ve found in a C, C++, C# or Java program that you think would make a good episode of ATBG, please send your question along with a small reproducer of the problem to TheBugGuys@Coverity.com
. We cannot promise to answer every question or solve every problem, but we’ll take a selection of the best questions that we can answer and address them on the dev testing blog every couple of weeks.
Math from scratch, part twelve: Euclid and Bézout
Now that we have an integer library, let’s see if we can do some 2300-year-old mathematics. The Euclidean Algorithm as you probably recall dates from at least 300 BC and determines the greatest common divisor (GCD) of two natural numbers. The Extended Euclidean Algorithm solves Bézout’s Identity: given non-negative integers a
and b
, it finds integers x
and y
such that:
a * x + b * y == d
where d
is the greatest common divisor of a
and b
. Obviously if we can write an algorithm that finds x
and y
then we can get d
, and x
and y
have many useful properties themselves that we’ll explore in future episodes.