20 Years of Visual Studio: “Petzold C”

Posted on March 6, 2017 by Paul Thurrott in Dev with 11 Comments

20 Years of Visual Studio: "Petzold C"

Photo credit: Charles Petzold

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.

And he’s still doing it.

In 2014, Xamarin announced, in a cheeky way, that it had “acquired” (hired) Mr. Petzold to write a new book called Creating Mobile Apps with Xamarin.Forms. And with Microsoft itself acquiring Xamarin last year and turning its development products into a key part of its developer story going forward, that book is now available for free. For free, folks.

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.

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!

Register or Subscribe

Join the discussion!

BECOME A THURROTT MEMBER:

Don't have a login but want to join the conversation? Become a Thurrott Premium or Basic User to participate

Register

Register for this Webinar

How Replication Supports Your Company’s RTOs & RPOs
Join us for this free webinar

Can you have your workloads running within the agreed RTOs? Join this webinar with expert speakers from Veeam to exceed business objectives with an RPTO<15 min for ALL of your application and data.

Thursday, December 14, 2017 at 11 a.m EST