20 Years of Visual Studio: “Petzold C”

A decade before Microsoft released the first version of Visual Studio, programmer Charles Petzold set out to document the right way to build Windows applications. His seminal book, Programming Windows, was updated over several editions and versions of Windows. And it was for many years my bible.

I’ve never met Charles Petzold—this isn’t an interview, sorry—though I did briefly interact with him via email in 2000. But his impact on my life was substantial, and it neatly dovetails with the story I detailed about the start of my own writing career in 20 Years of Visual Studio: Visual Basic. That is, like Gary Brent, who started me down this path, Mr. Petzold demonstrated ably that technical writing could be educational, entertaining, and, above all, precise. I think I’ve read, and re-read, Programming Windows at least 20 times over the years, and across various editions. To this day, I’m struck by the singular focus of this work.

(Programming Windows was the second book I ever owned about this topic. The first was a curiously-titled from Woody Leonard, which I believe was called the original edition of Hacker’s Guide to Word for Windows. Looking at the book now online, I don’t recognize the cover, but that must be it.)

Given the timing, I believe I got started with Petzold with Programming Windows 3.1, which was the 3rd edition of the book: In 1993-1994, I was in Phoenix but unable to get in-state tuition to Arizona State University (I had moved to go back to school to become a programmer), so I went to Scottsdale Community College part-time and worked at a bank during the day. (I had previously worked in banking.) At off-times—during lunch or slow periods—I would crack open Petzold, as I thought about it, and study up. Seeing me read this 1000-page hardcover book, my co-workers thought I was nuts. (“What do you have there, Paul? The bible?” was a typical comment. But they had no idea how close that was to the truth.)

Petzold was—and still is, I suppose, he’s still writing—old school in a way that should draw a smile to anyone involved with software development. He believed strongly in getting a firm foundation, in reading writing and code over and over again to understand it better, and in skipping over IDE tools in favor of hand-coding. And he focused on the basics, not the high-level fluff that so many other books chased.

Consider these examples.

In that 3rd edition of the book that got me started, Petzold spent over 150 pages (!) discussing low-level graphics programming (like GDI primitives). And by the time that NT started happening, Chapter 2 of the sixth edition had shifted its focus, entirely, to be about Unicode. That most lighthearted of topics. 🙂

My God.

Petzold correctly rejected Microsoft’s terrible Microsoft Foundation Classes (MFC), an attempt to bring Object Oriented Programming (OOP) principles to Windows development with the C++ language, and instead focused on what we all now call Petzold C instead: Straight-up C programming using what became, over time, the Win16 and Win32 APIs.

He referred to this style as “classical” Windows programming, “plain old C programming” without any C++-style “wrappers.”

“This book shows the hard way to to do Windows programming,” he explained in the introduction to the fifth edition, which focused on Windows 95. “But it is also the most basic, fundamental, versatile, and powerful way … Learning classical programming using C you the raw APIs, you can more clearly understand how Windows and your applications interact, and this can often be very useful knowledge. This approach establishes a firm foundation that you will never forget.”

Petzold didn’t just ignore wrappers and other fluff, he also ignored the niceties of Visual Studio and other IDEs, at least until the turn of the century. His rationale for this was firm, too: These tools often “hinder rather than aid the learning of classical Windows programming … I don’t want to teach you how to fill in IDE dialog boxes; I want to teach you how to design your own dialog boxes.”

Brilliant.

In the years since this time, Petzold of course evolved with the technologies he taught. He wrote several books about managed code programming—Programming Microsoft Windows with C# (2001), Programming in the Key of C#: A Primer for Aspiring Programmers (2003), Programming Microsoft Windows Forms (2005), and others. And the 6th edition of the book brought Programming Windows out of semi-retirement and focused on Windows 8, C#/XAML, and Windows Store apps. He even brought his expertise to Windows phone with Programming Windows Phone 7 in 2010.

I owned them all. And read them all. Delighting along the way that this genius, this trailblazer, was still teaching us after all these years.

As part of an ongoing and personal online learning initiative, I switched from Android development back to Windows development back in January, and this book will be part of my efforts in 2017. (I’ve also joined Bob Tabor’s excellent Developer University and am going through all of his relevant video-based courses now as well. More about that later.)

Which means that it’s all coming around for me. Petzold was my first formal introduction to Windows programming—as he was for so many other developers—and I’m delighted that he’s still showing the way. I can’t wait to get started with Xamarin, and will do so soon.

Thanks, Charles Petzold. You are one in a million, for sure.

MEMBER LOGIN:

Elevate the Conversation!

Join Thurrott Premium to enjoy our Premium comments.

Premium member comments on news posts will feature an elevated status that increases their visibility.
This tab would allow you to participate in Premium comments with other premium members.
Register to join the other Premium members in elevating the conversation!

Downloaded Petzold's book. Reads well. Very clearly written. One little problem with a book at least 1,162 pages long. There's NO INDEX! Yeah, you can search it. But an index is an organized, weighted, structured guide with subtopics and cross-references that helps the untutored reader begin to master a subject and makes using the book as a reference so much easier on the user even when he/she becomes an expert just needing a little refresher on a key point. But as Paul says, you can't argue with FREE! Thanks for the tip

I remember that Windows programming was something I just couldn't get. I tried first with Borland's ObjectWindows (Borland C came with our computer), but just couldn't get what the manual was talking about (mind you, I was 14 at the time). I eventually switched to VB 3 (and later 4), although I tried to go back to ObjectWindows periodically and never made any sense of it. Then, during my freshman year in high school, there was a not-for-credit Windows programming course. I went to the first class and decided it was total waste of time, as the instructor was just reading notes and knew nothing. What i did get, though, was free Visual Studio 6 and Charles Petzold's Programming Windows (latest as of early 2000). And it was wonderful. I read the whole thing cover to cover, and then again as I was porting my app from Visual Basic. It was so much more powerful and exactly what I needed for my app to overcome some problems VB just didn't support. I maintained the app in plain c++/Win32 for the rest of its life. It was wonderful

I've been around for a long time. I wrote my first program in 1965. And I started reading Petzold's stuff first with his column in PC Magazine, and then graduated to the first edition of Programming Windows (and bought literally all his other books). And when his WPF book (Applications = Code + Markup) was about to be available, I counted down the days until it came out. But when the published date came and Amazon still didn't have it, I took the bold step of sending him an unsolicited email that went something along the lines of "Where the hell's the book that was supposed to be out today?!?". Or something like that. OK, just kidding. I was much politer and more respectful than that. But he nicely replied and pointed out that a publication date was when the book started to be physically printed and that it would take a week or two to actually get to stores, Amazon, etc. So I started checking Amazon each day (probably about every 5 minutes it seemed) until it finally was available and, of course, ordered it for next day delivery. And when it came, I had a friend take a picture of me holding up the book then sent the picture to him. "It's now out in the wild!" And then the thrill. He mentioned on his blog that he had confirmation that his book was now available, that his "number-one fan" (moi!!!!!) sent him a picture. (Tim Sneath from Microsoft only then volunteered himself for the position of number-two fan.)

I ultimately graduated to being a technical reviewer on some of his books. Another thrill! I actually included that on my resume. And when I mentioned that I'd be driving past the town he has his summer home in, I actually got invited in for a couple of hours. And the thrills just keep on coming! And I made sure I got pictures of the two of us in front of one of his bookshelves.

Are you getting the feeling I'm a fanboy? Absolutely. I have a tendency (note the phrasing of this very sentence) to qualify things I say. But I state flat out, with no hesitation, that in my experience, he's the best programming author. Ever!

I can't honestly say that I keep in touch with him very much any more. He's got more than enough co-workers to do technical reviews on his Xamarin stuff. (Although when Microsoft bought Xamarin, I emailed him and congratulated him for finally joining Microsoft, even though he "came in through the back door".)

But I do have to say this. I've been extremely disappointed in Xamarin.Forms. No fault of Charles'. But everything keeps breaking. Every single pre-release of Visual Studio 2017 has had Xamarin.Forms broken in a different way each release!!! I'm just hoping that the RTM release tomorrow makes it usable again!

With all these blast from the past articles i get impression that Paul is about to leave his profession or putting together all the material he will need to write a book when some product or entire company fails...like end of Windows.

MEMBER LOGIN:

Elevate the Conversation!

Join Thurrott Premium to enjoy our Premium comments.

Premium member comments on news posts will feature an elevated status that increases their visibility.
This tab would allow you to participate in Premium comments with other premium members.
Register to join the other Premium members in elevating the conversation!