Internet Hearts: 112,000 Lines of Code


On Monday I asked for guesses on the size of the Internet Hearts source base, and the highest (public) one was 45,000 lines of code.  The answer: approximately 112,000 lines of code!  51,000 are client-specific, 35,000 are server-specific, and 26,000 are shared by both.


Higher than you expected? Well, there's a lot of functionality on the server end. And the application is actually a general-purpose game client & server designed to support multiple games (Internet Backgammon/Checkers/Hearts/Reversi/Spades).  For the purpose of turning this app into a shareable sample, I've already removed the non-Hearts pieces, but the generic nature of the architecture definitely contributes to the code size.


When I apply today's technologies to this older code base, I'm pretty sure I'll be able to "do more with less":  Less lines of code, less time & effort, less bugs, etc.  So we should see the application shrink.


Here are some diagrams to illustrate how the baseline Internet Hearts application is structured (prior to any improvements).  The orange-colored components involve UI, so they're candidates for an Avalon makeover.  The indigo-colored components involve networking, so they're candidates for... you guessed it... Indigo!


The Client:


The Server:

Comments (5)

  1. Steve Hall says:

    Since I’ve never seen the source code distributed as part of the Platform SDK or VS7.x (or did I miss it somewhere?), would it be possible to bundle the original source with the new source — when that time comes around? Judging from the above diagrams, this would be a good app to provide the old source code for comparison purposes.

    I would even go so far to say that a case study could be written (maybe an MSDN Magazine article, or a few chapters in a book…hint! hint! hint!) that detail your design decisions about not only what and how code was changed, but why. I usually don’t like reading case studies, mainly because the complexity of the business logic gets in the way of understanding the design techniques and rationale.

    I would even go so far to say that this is exactly the kind of complex app that a lot of us have as legacy apps, and would be very interested to do a post-mortem on this conversion process. But that would require the old source code! This example could become a standard sample which could be presented at MSDN quarterly events and sales calls. Sort of a "reference sample" of an "icky legacy app" getting a make-over to showcase new technologies.

    Since this is a "make-over" (er, conversion), the business logic is simple enough and shouldn’t get in the way of understanding the conversion process as you’ll detail it. (I’m hoping you’ll keep a diary of your thoughts while you’re whacking on it, so we can gleen some insights…)

    I look forward to seeing more of this project! Thanks!

  2. You’ve got it exactly right, Steve. We’ve never distributed the source code before, but we’re planning to distribute both the original source code and the final source code.

    And we are planning to use it as a case study for a talk at the PDC in September and for a written document of some sort (maybe with other apps as well). On the PDC website right now, the talk is called "Better Together: Building New Application Features Using Win32 and WinFX" but that will probably change shortly. 🙂

    I am indeed keeping a diary of my thoughts, and will share them here!

  3. Atul says:

    Excellent job Adam. On a related note, are we free to use the source code to write our own card games (for non-commercial purposes of course)?

  4. min_tao says:

    adam, i look out source code.nice code for me!but i can’t found the part of link sql server, whether any code not distributed?

Skip to main content