About 10 years ago, I was working on a UNIX-based application written in C. This was a fairly large program written by a team of developers that were no longer with the company. While trouble-shooting a bug, we found something odd within the code.
My first indication of something wrong was the presence of a "goto" statement. Never a good sign. It took a while to figure out the problem because this routine was over 1000 lines long. Eventually, we cut it apart and analyzed it enough to realize that it had the following structure. (Names have been changed to protect the guilty.)
void SomeDumbRoutine(...)
{
switch (a)
{
...
case 2:
myvar = 34;
// do some other stuff
goto SKIP_MIDDLE_PART;
...
}
switch (b)
{
...
case "BLANK":
myvar = -2;
SKIP_MIDDLE_PART: myvar += x;
...
break;
...
}
}
It was bad enough that they used a "goto", but that wasn't the worst part...
It was even worse that they jumped OUT of a switch statment, but that still isn't the worst part...
They actually jumped from within one switch into a case for a DIFFERENT SWITCH STATEMENT!!!
Even understanding all that, the results just didn't make sense. It didn't look like the program was going where it was supposed to after the "break" was reached.
Here is the deal. The C compiler on that system was implementing the "switch" statement as though it was a subroutine. When it hit the beginning of the switch, it pushed the address for the bottom of the switch onto the stack. Then, when it hit a "break" statement, it just poped the address off the stack. This resulted in the following sequence of events.
- The routine begins.
- The first switch is reached and the address for the bottom of that switch is pushed.
- The "goto" statement is hit and the program jumps into the second switch statement.
- The "break" statement is hit. This pops the address off of the stack. (OPPS! That's for the other switch statement!)
- The program jumps to the point just AFTER THE FIRST SWITCH.
- The program then continues on into the second switch AGAIN.
At first I thought, "Oh! They just got confused because this routine is so long. That must be causing the error." Nope. We traced through it and eventually figured out (by reading assembly code) that the person who wrote this was INTENTIONALLY using this strange behavior of the compiler!!!! The problem was being caused by a minor change we had made a few weeks ago that didn't take that behavior into account.
I would like to personally thank the unnamed programmer who wrote that peice of garbage for entertaining the entire office that day. We laughed about it for months.
See you in Boston!!!!
Hi everyone!
My new job includes a chance for me to open my big mouth right away. MSI has partnered with MS to create a series of MS Vision Centers. We are the only partner that has them. I won't bother going into a lengthy description of what an MVC is here. If you are familiar with MS's own Tech Centers, you get the idea.
I will be talking about collaboration solutions at the Omaha and St. Louis openings on 11/30/2005 and 12/8/2005, respectively.
For more information and registration, go to: http://www.msiinet.com/events/
Well, my return to plaNet last Febrary didn't work out as I hoped. I am once again moving on.
This time I am headed to Midland's Systems Integrators (MSI). MSI is a Microsoft Gold Partner with locations both in Omaha and throughout the US.
http://www.msiinet.com/
I will be a Microsoft Architect specializing in BizTalk Server solutions.
ASP.NET 2.0 supports a new Wizard functionality. This is done with the <asp:Wizard> tag. You declare steps within this tag that define the pages of the wizard. All of the state is retained across the pages.
In VS2005, there is a new DataSet designer. In previous versions, DataSets were designed in the XML Schema Editor. In addition to making it easier to work with DataSets, it simplifies extending the generated DataSet classes.
In the past, you would create the XSD schema and the tool would generate a set of classes in a code-behind file. If you wanted to extend or customize these classes, you could really only derive a class from the dataSet and add methods to it. The ability to override key behaviors required a lot more effort.
In VS2005, there is a new code-behind file (code-beside?) along side the generated file that allows you to add code directly into the classes that were generated. Very nice!
I spent the last couple of days at the Heartland Developer's Conference 2005 in Cedar Rapids. Small regional conferences like this are sometimes hit-or-miss in terms of content but, overall, I was happy I went. I learned several things I didn't know before, so I thought I would post them here.
Congratulations to Joe Olsen who directed the conference. Nicely done.
Enough said!
http://www.techweb.com/showPressRelease.jhtml?articleID=X333718
Microsoft platforms (ASP.NET, ASP): 43.6% Java platforms (J2EE, JSP, WebLogic, WebSphere, Tomcat): 12.2% PHP: 5.2% ColdFusion: 2.7% Perl: 2.3% Python (Zope): 0.1%
Microsoft IIS: 53.7% Apache: 22.7% Other Web servers: 12.8% Netscape Enterprise: 10.8%
I think I made the right decision in my career path!
There has been an online petition (http://classicvb.org/) recently to try to
convince Microsoft to continue the development of VB6. When I first heard this,
I thought it was a joke. I have been using VB.NET and C# for about 3 years now
and I would seriously quit my job before working in VB6 again.
Some background about myself, so you won't think I am a Java or C++ guy. In my
career, I have worked in many languages. Here is a recap and some commentary.
BASIC (TRS-80 & Commodore) - 3 years - OK, this was before my career but that's
when I learned to code.
Ada (original) - 6 years - The original Ada was a lot like VB6 in syntax and
support for OOD concepts. Where VB6 is component-based, Ada is "package"-based.
Neither is object-oriented. I was fairly fond of the syntax but the tool
support around 1990 wasn't very good. It was about what you would expect for a
language designed by and used only by the U.S. government.
APL - 1 year - If you are a mathematician or statistian by trade, APL might
appeal to you. Otherwise, YUCK!
C - 3 years - I have always loved C's syntax. Crisp, clear and terse. Also,
it's as fast as anything you'll find.
C++ - 2 years - I never really liked C++ all that much. I think it was because
I was doing it in VC++ with Win32 and MFC. It just never felt like a coherent language.
If everything in your code is a macro, then you aren't really using the language
anymore.
VB (versions 3-6) - 8 years - By far, the majority of my gainful employment has
been in VB. I never cared for the syntax much because I am not fond of typing
and it is hard to find your logic in amongst all of those keywords. It's the
same problem I have with COBOL.
VB.NET - 3 years - It's just similar enough to VB6 to be confusing, but not
different enough to be worth learning, IMHO. If you are switching to .NET
anyway, learn C#. It will be easier to learn without all the VB baggage.
C# - This is where I found my true love. C# has the syntax of C, the power of
C++ and RAD environment of VB. I'm home.
Reading the FAQ on the petition web site, it seems like they are complaining
about several different things.
1. The end of "mainstream support". Obviously, Microsoft should be making bug
fixes and security fixes to VB6 as long as there is a significant install
base. The patches should be free and easy to get. As for free phone support,
you've had that for a long time now. It has to end sometime. 3 years after it
is superceeded is plenty long enough. Many appliances cost about the same as a
VB6 license and they only come with 60 or 90 DAY warranties.
2. "Microsoft made my data obselete." This is an obvious attempt to get the
attention of business decision-makers. No "data" has been made obselete. Some
CODE has. There is an argument on the site that code and data are the same
thing. Sorry, I must say bullhockey to that!
3. Existing VB6 applications may not run on future versions of Microsoft's
operating systems. I haven't heard Microsoft announce the end of COM support in
Longhorn, so I don't think that is going to happen in the next 5 years or so.
Further out than that, you're on your own. Just like you always were.
4. VB6 code won't be able to access all of the platform features introduced in
later versions of Windows. Of course not! It wasn't designed to run on that
platform. If you want new features, you have to upgrade. No surprise there.
What this all boils down to is that these folks want Microsoft to treat VB6 as
though it were an entirely different product from VB.NET, not just its predecessor. If
Microsoft felt they could make money doing that, I am sure they would, but they
don't. The vast majority of pre-VB.NET apps have already been written. Now they
are just being maintained. Therefore, the license revenues will drop sharply
over the next few years regardless of how much money is poured into it.
I spent years defending VB against the VC++ bigots who considered it a "toy"
language. There are a few things VB6 can't do that VC++ can. How often do most
of us do them? Most of the VC++ code I have ever seen was written in VC++
because the guy writting it knew VC++ and didn't want to use VB.
VB.NET is finally a full citizen among MS languages
and that's great. I can do anything in VB.NET that I can do in C#. I just like
C# better.
If you are concerned about supporting existing applications, by all means, push
MS to supply bug fixes, but don't expect full support. It just isn't practical.
Get involved in the online communities and solve your own problems. Don't
expect Microsoft to solve them for you.
If you are concerned about new language and platform features, you shouldn't be
using VB6. Sorry to be blunt but there it is. VB6 isn't dead yet, but it is
retired.
If you really feel that Microsoft is missing the boat on this, here is my
suggestion. Get together with some like-minded friends and come up with a
business plan. Contact some venture-capitalists and propose to buy the product,
including support commitements, from Microsoft. (I'm sure Bill G. would be
thrilled.) You could continue selling the product, developing new features and
providing ongoing support for its customer base. The problem you will run into
is that your business will NEVER show a profit. That's why MS isn't doing it
itself.
I just got this e-mail from E-Week to renew my subscription. I don't feel like they really know me. They also seem to have some trouble with dates.
-------------------------------------------
03-18-05
Dear Variable Name,
Because of your industry involvement, you have been selected to apply for a FREE (No fee whatsoever) subscription to eWEEK – The Enterprise Newsweekly.
Please apply online:
by Month 18, 2005
eWEEK (formerly PC Week) is an award winning newsweekly brought to you exclusively by Ziff Davis Media.
Sincerely,
eWEEK Circulation Department
I downloaded Firefox today out of curiosity. It seems pretty straight-forward and stable so far. I like the downloadable themes (mostly because I don't like the default one).
What have other people thought of it?
Here is a Dice ad I saw today:
Why would anyone try to recruit programmers with an ad composed of badly formatted C code with a GOTO statement in it? The GOTO isn't even syntactically correct.
I just found out that a background check being done on me has revealed a felony arrest in Frederick, Maryland.
I lived in Frederick in the early 1990's, but I can't for the life of me remember being arrested. Maybe I took one too many night-sticks to the head?
They say crime doesn't pay and I have to agree. I didn't get anything out of the deal and I might lose a job!
According to the Frederick Circuit Court, the only record they have is for a Steven Paul Wright who was arrested for a felony in 2002. Fortunately, I haven't been to Frederick since we moved to Jersey in 1993 and my middle name isn't “Paul”. Now I just have to get those crack(-smoking?) investigators to admit they screwed up.
I am now reconsidering my opposition to a national ID system. This could have been avoided if they used Social Security Numbers as an identifier on criminal records but they aren't allowed to do that I guess.
Well, I have some good news and some bad news.
Bad news: My job at Avanade didn't work out.
The problem was the travel. The job was great and the resources available to Avanade are awsome. My family just couldn't handle me traveling so much. It's a shame, but when it comes to choosing between work and family the decision became an easy one to make.
Good news: I am going back to Planet.
That's right! I am headed back to the same company and job I had before. It's nice to know that you CAN go home again. I start on 2/14. I wonder if Janet will accept that as her Valentine's Day present?
In case you missed it, EntLib was released on 1/28. Here is a link: http://www.microsoft.com/downloads/details.aspx?FamilyId=0325B97A-9534-4349-8038-D56B38EC394C&displaylang=en
You will have to register, but that's life.
According to sources close to the project, Enterprise Library should be made publicly available on January 28th.
It has taken a long time, but the first book on BizTalk 2004 is finally out. It is written by Scott Woodgate, et. al. If there is anyone that knows BizTalk, it's Scott. He has been running the product team since I was at Microsoft back in 2000!
I got my copy from Amazon last week and what I have read so far is great. For anyone interested in getting up to speed on BizTalk or looking for a good reference, this is highly recommended.
http://www.amazon.com/exec/obidos/tg/detail/-/0672325985/qid=1101825868/sr=8-1/ref=pd_csp_1/102-2299673-1078554?v=glance&s=books&n=507846
Avanade and MS have teamed up to reengineer the Patterns and Practices group's Application Blocks. The new release is called “Enterprise Library”. Avanade gets to use them exclusively for 90 days starting 10/27/04. After that, they will be made available under the same terms as the App Blocks have been.
Since I work for Avanade, I have had a chance to see and load them up. I haven't gotten through all of it yet, but it looks very nice. It will be good to have all of these parts made consistent and interoperable.
For more info:
http://www.microsoft.com/resources/practices/comingsoon.mspx
I have been at home recently waiting for my next assignment. Yesterday, an amazing series of events occurred:
10:00 AM - Hey Steve! We need you in Tampa tomorrow. Can you get there tonight? Sure
10:15 - Flights are booked for 4:15.
11:00 - Underwear are washed
11:15 - Bags are packed.
11:30 - Underwear are dry (remember to stick them in the suitcase, bozo)
1:00 PM - Hotel and car are booked even though I have no idea who the client is or where I am supposed to go in the morning.
2:00 - Head to the airport
2:20 - Park in Long Term lot.
2:30 - Check-in
2:45 - Get through security to the gate area
2:50 - Go take a potty break
2:51 - With my pants (literally) around my ankles, the phone rings and I am told that the client has decided to POSTPONE!!!!!!!!!
(I am told that the resulting stream of profanity was quite entertaining)
4:00 - Arrive back home exhausted from a day of traveling without actually going anywhere.