{"id":5079,"date":"2026-08-10T10:59:44","date_gmt":"2026-08-10T14:59:44","guid":{"rendered":"https:\/\/www.wholetomato.com\/blog\/?p=5079"},"modified":"2026-08-10T11:16:02","modified_gmt":"2026-08-10T15:16:02","slug":"untangling-legacy-mfc-codebase","status":"publish","type":"post","link":"https:\/\/www.wholetomato.com\/blog\/untangling-legacy-mfc-codebase\/","title":{"rendered":"Untangling a Legacy MFC Codebase: One Engineer&#8217;s Refactor"},"content":{"rendered":"<h1 data-pm-slice=\"1 1 []\">Untangling a Legacy MFC Codebase: One Engineer&#8217;s Refactor<\/h1>\n<p><em>How Roger Swann took a sensor-testing system from unmaintainable spaghetti to a stable, object-oriented codebase, without rewriting it from scratch.<\/em><\/p>\n<p data-pm-slice=\"1 1 []\">When C++ developer Roger Swann took over the development of a sensor-testing software, the engineer who wrote it was no longer available to explain any of it\u2014a situation that has been happening more and more frequently when inheriting older codebases.<\/p>\n<p>The original author was a C programmer, not a C++ or object-oriented specialist. He&#8217;d built the first iteration to address one practical question: <em>we need to automatically test this sensor, how do we do it?<\/em> His approach worked.<\/p>\n<p>But as the customer grew from a single sensor into a whole range of them, the software grew too, one feature request at a time. There was no time in between fast dev cycles to plan a design. It ran on Microsoft Visual C++ 6 with MFC, with an MS Access database holding every test result the company had ever recorded.<\/p>\n<p>Roger, who is now director at <a href=\"https:\/\/cigol.com\/\">Cigol Controls<\/a>, came in at arguably the worst possible moment for a handover. The UK-based electronics engineering and manufacturing company\u00a0was moving to a much larger site with a much bigger sensor-testing system, so the software needed major changes. At the same time, the original developer had fallen sick and was no longer available.<\/p>\n<p>There was not even an opportunity, as Roger puts it, &#8220;to answer questions on &#8216;how does this function work?'&#8221;<\/p>\n<p>There was also a deadline. Without working software, the customer can&#8217;t test sensors, and if they can&#8217;t test sensors, they can&#8217;t ship them.<\/p>\n<p>&#8220;I almost didn&#8217;t take the job on,&#8221; Roger says.<\/p>\n<h2 data-pm-slice=\"1 1 []\">What &#8220;spaghetti&#8221; actually meant<\/h2>\n<p>The word gets thrown around, so it helps to be specific about what Roger walked into.<\/p>\n<p>&#8220;Everything was done with large numbers of &#8216;case&#8217; statements or &#8216;if \/ else&#8217; statements,&#8221; he says. &#8220;For any particular sensor type it was unbelievably painful to follow through exactly what the program flow was.&#8221; The logic that drove the test hardware (the digital inputs and outputs he now had to change for the new site) was completely tangled into the operating code. You couldn&#8217;t touch one without reaching into the other.<\/p>\n<p>The coupling had teeth. &#8220;Changes that affected one type of sensor could (and did) accidentally have an unwanted change to the way other sensor types were tested.&#8221; Fixing a problem for one product quietly created one for another.<\/p>\n<p>On top of that, the customer was reporting a steady stream of bugs and had built up their own cumbersome workarounds. The software needed regular restarts. Roger could see the day-to-day users getting close to losing confidence in the whole system.<\/p>\n<p>An even bigger problem was that almost none of it could be tested off-site. There was no simulation of the sensor hardware and no unit tests, so running the code meant you had to be physically in the factory, interrupting operations and requiring development engineers to do it. There wasn&#8217;t even a Windows installer. A build compiled as &#8220;release&#8221; would run on the development PC but fail on the customer&#8217;s target machines (for reasons Roger never fully got to the bottom of even now).<\/p>\n<h2>The first move was small on purpose<\/h2>\n<p>Roger was a new supplier trying to make a good impression, on a deadline, with a codebase he didn&#8217;t write and couldn&#8217;t fully test. So he didn&#8217;t start with a full and grandiose rewrite.<\/p>\n<p>He started with minor feature changes. Small, low-complexity work that, in his words, &#8220;in effect paid for me to get to know the code.&#8221; It also showed him how hard the move to the new factory was going to be. He was still in Visual C++ 6 at this stage. He began pulling the I\/O-related code (the part that talks to the test hardware) out of the tangle, so he could modify it for the new site without disturbing everything around it.<\/p>\n<p>His method was what experienced engineers eventually converge on when working on legacy code. &#8220;With spaghetti code you do have to try to make as small a change as possible and then re-test,&#8221; he says, &#8220;even if re-testing means lengthy time on site and inconveniencing the customer.&#8221; One change, one test, repeat, even when a single test cost him a trip to the factory.<\/p>\n<p>That discipline is also what earned him the room to do more. Only after he&#8217;d delivered the factory move and the software was working did he feel the customer trusted him enough to take on the bigger job.<\/p>\n<h2>Migrate, don&#8217;t rewrite<\/h2>\n<p>The bigger job was a move to Embarcadero <a href=\"https:\/\/www.embarcadero.com\/products\/cbuilder\">C++ Builder<\/a> and VCL. The central change was structural: a class hierarchy for the different sensor types.<\/p>\n<div id=\"attachment_5082\" style=\"width: 1034px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Figure-1.png?ssl=1\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-5082\" data-attachment-id=\"5082\" data-permalink=\"https:\/\/www.wholetomato.com\/blog\/untangling-legacy-mfc-codebase\/figure-1\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Figure-1.png?fit=1672%2C941&amp;ssl=1\" data-orig-size=\"1672,941\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Nodes hierarchy\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;Before, a change to one sensor type could reach into another. After, each sensor type is its own class, new ones drop in without disturbing the rest.&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Figure-1.png?fit=300%2C169&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Figure-1.png?fit=1024%2C576&amp;ssl=1\" class=\"size-large wp-image-5082\" src=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Figure-1.png?resize=1024%2C576&#038;ssl=1\" alt=\"Before-and-after diagram: a flat sprawl of switch\/if-else blocks with red cross-links, versus a clean SensorBase class tree where a new green child node is added without affecting its siblings.\" width=\"1024\" height=\"576\" srcset=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Figure-1.png?resize=1024%2C576&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Figure-1.png?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Figure-1.png?resize=768%2C432&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Figure-1.png?resize=1536%2C864&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Figure-1.png?resize=360%2C203&amp;ssl=1 360w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Figure-1.png?w=1672&amp;ssl=1 1672w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" data-recalc-dims=\"1\" \/><\/a><p id=\"caption-attachment-5082\" class=\"wp-caption-text\">Before, a change to one sensor type could reach into another. After the structural shift, each sensor type is its own class and new ones drop in without disturbing the rest.<\/p><\/div>\n<p>That one decision fixed the problem that had made the old code so dangerous. &#8220;I quickly got to the point where when a new sensor type was introduced it could be done without unwanted (disastrous) side effects for other sensor types,&#8221; Roger says. The object-oriented structure made the system far more stable, in his words &#8220;now regarded as completely stable.&#8221;<\/p>\n<p>The rest of the modernization followed from there. He built a way to simulate specific sensor types, so the software could finally be run in full on a development PC instead of only in the factory. He added unit tests, especially around the low-level code, where he finds it easier to debug against a test than by hand. The bonus is that the tricky code stays checked from then on. He added a proper Windows installer.<\/p>\n<p>Later, when years of accumulated test results pushed the MS Access database past its limits, he migrated the whole thing to PostgreSQL. Because the data layer already went through FireDAC by then, even that went smoothly.<\/p>\n<p>None of this was a from-scratch rewrite. It was a running system carried forward in pieces, each one replaced only once he understood it well enough to replace it safely.<\/p>\n<h2>The discipline underneath all of it<\/h2>\n<p>Ask Roger what advice he&#8217;d share with another engineer inheriting a mess like this and the advice is pretty straightforward.<\/p>\n<p>&#8220;Don&#8217;t think you can re-write completely from scratch. Rather, work with little sections of code and migrate bit-by-bit. Add unit testing or other forms of higher level simulation testing as you go along. By migrating (rather than completely re-writing) you keep the small (but important) bug fixes that exist without you seeing them in the code base.&#8221;<\/p>\n<div id=\"attachment_5083\" style=\"width: 1034px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Figure-2.png?ssl=1\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-5083\" data-attachment-id=\"5083\" data-permalink=\"https:\/\/www.wholetomato.com\/blog\/untangling-legacy-mfc-codebase\/figure-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Figure-2.png?fit=1536%2C1024&amp;ssl=1\" data-orig-size=\"1536,1024\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Figure 2\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;The loop never changed \u2014 small change, then test, then repeat. What changed is that testing moved from slow factory visits to simulation and unit tests.&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Figure-2.png?fit=300%2C200&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Figure-2.png?fit=1024%2C683&amp;ssl=1\" class=\"size-large wp-image-5083\" src=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Figure-2.png?resize=1024%2C683&#038;ssl=1\" alt=\"A change-test-repeat loop with the test step highlighted, and an evolution axis showing testing move from slow on-site checks to faster hardware simulation and unit tests.\" width=\"1024\" height=\"683\" srcset=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Figure-2.png?resize=1024%2C683&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Figure-2.png?resize=300%2C200&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Figure-2.png?resize=768%2C512&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Figure-2.png?resize=360%2C240&amp;ssl=1 360w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Figure-2.png?w=1536&amp;ssl=1 1536w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" data-recalc-dims=\"1\" \/><\/a><p id=\"caption-attachment-5083\" class=\"wp-caption-text\">The loop never changed \u2014 <em>small change, then test, then repeat.<\/em> What changed is that testing moved from slow factory visits to simulation and unit tests.<\/p><\/div>\n<p>Don&#8217;t underestimate the invisible bug fixes that you inherit. A legacy codebase collects tiny corrections nobody documented: e.g. a guard against an input that only appears at random, a workaround added for one customer&#8217;s hardware.<\/p>\n<p>Rewrite from scratch and you throw all of them away without ever knowing they were there. It&#8217;s the same argument Joel Spolsky made in <a href=\"https:\/\/www.joelonsoftware.com\/2000\/04\/06\/things-you-should-never-do-part-i\/\"><em>Things You Should Never Do<\/em><\/a>, which we lean on in the <a href=\"#\">survival guide that spurred this discussion<\/a>. Roger just arrived at it the hard way, on a real system, with a more real-world pressure (a literal factory).<\/p>\n<p>He also has a test for whether someone is any good at this. &#8220;You can tell a good software engineer,&#8221; he says. &#8220;Their first question is always &#8216;how am I going to test this?&#8217; rather than the more common &#8216;how am I going to write this?'&#8221;<\/p>\n<h2>The tools that earned their keep<\/h2>\n<p>For most of the grind, Roger managed with the limited Visual C++ 6 IDE. The heavy lifting was surgical methodology and patience more than tooling.<\/p>\n<p>More recently, working in C++ Builder, he&#8217;s been introduced to the Whole Tomato tooling built into that IDE: the refactoring (renaming, mostly), find references, and jump-to-definition. On a codebase where following the program flow was the original nightmare, being able to jump straight from a call to its definition, or find every place a function is used, is exactly the kind of help that pays off. &#8220;I&#8217;d love to see more,&#8221; he adds, which we&#8217;ll take.<\/p>\n<h2>If you&#8217;re the one who just inherited the mess<\/h2>\n<p>Roger&#8217;s story is specific to sensor-testing rigs, but the shape of it is not. Someone before you built something that worked, under pressure, without a plan. Now it&#8217;s yours, and the person who understood it isn&#8217;t around to ask.<\/p>\n<p>The way through is the way Roger went: small, tested, reversible changes; a structure you introduce gradually; and a bias toward migrating what exists over rewriting it from nothing. If you want the longer version of that playbook, it&#8217;s the whole argument of our field guide, <a href=\"#\"><em>Inheriting a Legacy C++ Codebase<\/em><\/a>. It walks through the first 90 days, from surviving the hectic initial phase to shipping changes without drama.<\/p>\n<p>And when the codebase itself is the thing slowing you down, when jumping to a definition or finding every caller has become a stall instead of a reflex, that&#8217;s what Visual Assist does for Visual Studio. It&#8217;s the Visual Studio counterpart to the Whole Tomato tooling Roger leans on in C++ Builder, built for the same large, tangled C++ that makes inheriting a codebase hard in the first place.<\/p>\n<div class=\"actions\">\r\n\t<a href=\"https:\/\/www.wholetomato.com\/downloads?utm_content=blog-\" class=\"button secondary\">Try Visual Assist<\/a>\r\n<\/div>\n<hr \/>\n<p><strong><em>With thanks to Roger Swann, Director of Cigol Controls Ltd, for sharing his story.\u00a0<\/em><\/strong><\/p>\n<h2><\/h2>\n","protected":false},"excerpt":{"rendered":"<p>Untangling a Legacy MFC Codebase: One Engineer&#8217;s Refactor How Roger Swann took a sensor-testing system from unmaintainable spaghetti to a stable, object-oriented codebase, without rewriting it from scratch. When C++ developer Roger Swann took over&#8230;<\/p>\n","protected":false},"author":213500340,"featured_media":5081,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_newsletter_tier_id":0,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[726360701,726360007],"tags":[2426,726360594,726360715,726360687,726360713,726359786],"class_list":["post-5079","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dev-tools","category-success-story","tag-c","tag-case-study","tag-code-migration","tag-legacy-code","tag-mfc","tag-refactoring"],"jetpack_publicize_connections":[],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Header.png?fit=1672%2C941&ssl=1","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pfpLS4-1jV","aioseo_head":"\n\t\t<!-- All in One SEO Pro 4.9.7.2 - aioseo.com -->\n\t<meta name=\"description\" content=\"How Roger Swann took a legacy MFC sensor-testing system from unmaintainable spaghetti to a stable, object-oriented codebase by migrating, not rewriting.\" \/>\n\t<meta name=\"robots\" content=\"max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n\t<meta name=\"author\" content=\"Tristan Soliven\"\/>\n\t<meta name=\"google-site-verification\" content=\"DtHrwoEjg0KG_fbuPSp5j_wNIf-g5hSh4EH6tZBoCIw\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.wholetomato.com\/blog\/untangling-legacy-mfc-codebase\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO Pro (AIOSEO) 4.9.7.2\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Visual Assist Blog - C++ Tips, Release Notes &amp; Developer Guides\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Untangling a Legacy MFC Codebase: A Refactor - August 2026\" \/>\n\t\t<meta property=\"og:description\" content=\"How Roger Swann took a legacy MFC sensor-testing system from unmaintainable spaghetti to a stable, object-oriented codebase by migrating, not rewriting.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.wholetomato.com\/blog\/untangling-legacy-mfc-codebase\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-08-10T14:59:44+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-08-10T15:16:02+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/wholetomatosoftware\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@visualassist\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Untangling a Legacy MFC Codebase: A Refactor - August 2026\" \/>\n\t\t<meta name=\"twitter:description\" content=\"How Roger Swann took a legacy MFC sensor-testing system from unmaintainable spaghetti to a stable, object-oriented codebase by migrating, not rewriting.\" \/>\n\t\t<meta name=\"twitter:creator\" content=\"@visualassist\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/untangling-legacy-mfc-codebase\\\/#blogposting\",\"name\":\"Untangling a Legacy MFC Codebase: A Refactor - August 2026\",\"headline\":\"Untangling a Legacy MFC Codebase: One Engineer&#8217;s Refactor\",\"author\":{\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/author\\\/tristansoliven\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/www.wholetomato.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/08\\\/Header.png?fit=1672%2C941&ssl=1\",\"width\":1672,\"height\":941,\"caption\":\"From case-statement spaghetti to an ordered class hierarchy, the shape of Roger Swann's refactor.\"},\"datePublished\":\"2026-08-10T10:59:44-04:00\",\"dateModified\":\"2026-08-10T11:16:02-04:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/untangling-legacy-mfc-codebase\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/untangling-legacy-mfc-codebase\\\/#webpage\"},\"articleSection\":\"Dev Tools, Success Story, c++, case study, code migration, legacy code, MFC, refactoring, English\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/untangling-legacy-mfc-codebase\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/category\\\/success-story\\\/#listItem\",\"name\":\"Success Story\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/category\\\/success-story\\\/#listItem\",\"position\":2,\"name\":\"Success Story\",\"item\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/category\\\/success-story\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/untangling-legacy-mfc-codebase\\\/#listItem\",\"name\":\"Untangling a Legacy MFC Codebase: One Engineer&#8217;s Refactor\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/untangling-legacy-mfc-codebase\\\/#listItem\",\"position\":3,\"name\":\"Untangling a Legacy MFC Codebase: One Engineer&#8217;s Refactor\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/category\\\/success-story\\\/#listItem\",\"name\":\"Success Story\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/#organization\",\"name\":\"Tomato Soup\",\"description\":\"C++ Tips, Release Notes & Developer Guides\",\"url\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/\",\"email\":\"info@wholetomato.com\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":0,\"maxValue\":100},\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/www.wholetomato.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/WT_symbol.png?fit=112%2C112&ssl=1\",\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/untangling-legacy-mfc-codebase\\\/#organizationLogo\",\"width\":112,\"height\":112,\"caption\":\"visual assist main tomato symbol icon\"},\"image\":{\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/untangling-legacy-mfc-codebase\\\/#organizationLogo\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/wholetomatosoftware\",\"https:\\\/\\\/twitter.com\\\/visualassist\",\"https:\\\/\\\/www.youtube.com\\\/c\\\/Wholetomatosoftware\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/whole-tomato-software\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/author\\\/tristansoliven\\\/#author\",\"url\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/author\\\/tristansoliven\\\/\",\"name\":\"Tristan Soliven\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/untangling-legacy-mfc-codebase\\\/#webpage\",\"url\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/untangling-legacy-mfc-codebase\\\/\",\"name\":\"Untangling a Legacy MFC Codebase: A Refactor - August 2026\",\"description\":\"How Roger Swann took a legacy MFC sensor-testing system from unmaintainable spaghetti to a stable, object-oriented codebase by migrating, not rewriting.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/untangling-legacy-mfc-codebase\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/author\\\/tristansoliven\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/author\\\/tristansoliven\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/www.wholetomato.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/08\\\/Header.png?fit=1672%2C941&ssl=1\",\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/untangling-legacy-mfc-codebase\\\/#mainImage\",\"width\":1672,\"height\":941,\"caption\":\"From case-statement spaghetti to an ordered class hierarchy, the shape of Roger Swann's refactor.\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/untangling-legacy-mfc-codebase\\\/#mainImage\"},\"datePublished\":\"2026-08-10T10:59:44-04:00\",\"dateModified\":\"2026-08-10T11:16:02-04:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/\",\"name\":\"Tomato Soup\",\"description\":\"C++ Tips, Release Notes & Developer Guides\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.wholetomato.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO Pro -->\r\n\t\t<title>Untangling a Legacy MFC Codebase: A Refactor - August 2026<\/title>\n\n","aioseo_head_json":{"title":"Untangling a Legacy MFC Codebase: A Refactor - August 2026","description":"How Roger Swann took a legacy MFC sensor-testing system from unmaintainable spaghetti to a stable, object-oriented codebase by migrating, not rewriting.","canonical_url":"https:\/\/www.wholetomato.com\/blog\/untangling-legacy-mfc-codebase\/","robots":"max-snippet:-1, max-image-preview:large, max-video-preview:-1","keywords":"","webmasterTools":{"google-site-verification":"DtHrwoEjg0KG_fbuPSp5j_wNIf-g5hSh4EH6tZBoCIw","miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/www.wholetomato.com\/blog\/untangling-legacy-mfc-codebase\/#blogposting","name":"Untangling a Legacy MFC Codebase: A Refactor - August 2026","headline":"Untangling a Legacy MFC Codebase: One Engineer&#8217;s Refactor","author":{"@id":"https:\/\/www.wholetomato.com\/blog\/author\/tristansoliven\/#author"},"publisher":{"@id":"https:\/\/www.wholetomato.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Header.png?fit=1672%2C941&ssl=1","width":1672,"height":941,"caption":"From case-statement spaghetti to an ordered class hierarchy, the shape of Roger Swann's refactor."},"datePublished":"2026-08-10T10:59:44-04:00","dateModified":"2026-08-10T11:16:02-04:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.wholetomato.com\/blog\/untangling-legacy-mfc-codebase\/#webpage"},"isPartOf":{"@id":"https:\/\/www.wholetomato.com\/blog\/untangling-legacy-mfc-codebase\/#webpage"},"articleSection":"Dev Tools, Success Story, c++, case study, code migration, legacy code, MFC, refactoring, English"},{"@type":"BreadcrumbList","@id":"https:\/\/www.wholetomato.com\/blog\/untangling-legacy-mfc-codebase\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.wholetomato.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.wholetomato.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.wholetomato.com\/blog\/category\/success-story\/#listItem","name":"Success Story"}},{"@type":"ListItem","@id":"https:\/\/www.wholetomato.com\/blog\/category\/success-story\/#listItem","position":2,"name":"Success Story","item":"https:\/\/www.wholetomato.com\/blog\/category\/success-story\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.wholetomato.com\/blog\/untangling-legacy-mfc-codebase\/#listItem","name":"Untangling a Legacy MFC Codebase: One Engineer&#8217;s Refactor"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.wholetomato.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.wholetomato.com\/blog\/untangling-legacy-mfc-codebase\/#listItem","position":3,"name":"Untangling a Legacy MFC Codebase: One Engineer&#8217;s Refactor","previousItem":{"@type":"ListItem","@id":"https:\/\/www.wholetomato.com\/blog\/category\/success-story\/#listItem","name":"Success Story"}}]},{"@type":"Organization","@id":"https:\/\/www.wholetomato.com\/blog\/#organization","name":"Tomato Soup","description":"C++ Tips, Release Notes & Developer Guides","url":"https:\/\/www.wholetomato.com\/blog\/","email":"info@wholetomato.com","numberOfEmployees":{"@type":"QuantitativeValue","minValue":0,"maxValue":100},"logo":{"@type":"ImageObject","url":"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/05\/WT_symbol.png?fit=112%2C112&ssl=1","@id":"https:\/\/www.wholetomato.com\/blog\/untangling-legacy-mfc-codebase\/#organizationLogo","width":112,"height":112,"caption":"visual assist main tomato symbol icon"},"image":{"@id":"https:\/\/www.wholetomato.com\/blog\/untangling-legacy-mfc-codebase\/#organizationLogo"},"sameAs":["https:\/\/www.facebook.com\/wholetomatosoftware","https:\/\/twitter.com\/visualassist","https:\/\/www.youtube.com\/c\/Wholetomatosoftware","https:\/\/www.linkedin.com\/company\/whole-tomato-software"]},{"@type":"Person","@id":"https:\/\/www.wholetomato.com\/blog\/author\/tristansoliven\/#author","url":"https:\/\/www.wholetomato.com\/blog\/author\/tristansoliven\/","name":"Tristan Soliven"},{"@type":"WebPage","@id":"https:\/\/www.wholetomato.com\/blog\/untangling-legacy-mfc-codebase\/#webpage","url":"https:\/\/www.wholetomato.com\/blog\/untangling-legacy-mfc-codebase\/","name":"Untangling a Legacy MFC Codebase: A Refactor - August 2026","description":"How Roger Swann took a legacy MFC sensor-testing system from unmaintainable spaghetti to a stable, object-oriented codebase by migrating, not rewriting.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.wholetomato.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.wholetomato.com\/blog\/untangling-legacy-mfc-codebase\/#breadcrumblist"},"author":{"@id":"https:\/\/www.wholetomato.com\/blog\/author\/tristansoliven\/#author"},"creator":{"@id":"https:\/\/www.wholetomato.com\/blog\/author\/tristansoliven\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2026\/08\/Header.png?fit=1672%2C941&ssl=1","@id":"https:\/\/www.wholetomato.com\/blog\/untangling-legacy-mfc-codebase\/#mainImage","width":1672,"height":941,"caption":"From case-statement spaghetti to an ordered class hierarchy, the shape of Roger Swann's refactor."},"primaryImageOfPage":{"@id":"https:\/\/www.wholetomato.com\/blog\/untangling-legacy-mfc-codebase\/#mainImage"},"datePublished":"2026-08-10T10:59:44-04:00","dateModified":"2026-08-10T11:16:02-04:00"},{"@type":"WebSite","@id":"https:\/\/www.wholetomato.com\/blog\/#website","url":"https:\/\/www.wholetomato.com\/blog\/","name":"Tomato Soup","description":"C++ Tips, Release Notes & Developer Guides","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.wholetomato.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Visual Assist Blog - C++ Tips, Release Notes &amp; Developer Guides","og:type":"article","og:title":"Untangling a Legacy MFC Codebase: A Refactor - August 2026","og:description":"How Roger Swann took a legacy MFC sensor-testing system from unmaintainable spaghetti to a stable, object-oriented codebase by migrating, not rewriting.","og:url":"https:\/\/www.wholetomato.com\/blog\/untangling-legacy-mfc-codebase\/","article:published_time":"2026-08-10T14:59:44+00:00","article:modified_time":"2026-08-10T15:16:02+00:00","article:publisher":"https:\/\/www.facebook.com\/wholetomatosoftware","twitter:card":"summary_large_image","twitter:site":"@visualassist","twitter:title":"Untangling a Legacy MFC Codebase: A Refactor - August 2026","twitter:description":"How Roger Swann took a legacy MFC sensor-testing system from unmaintainable spaghetti to a stable, object-oriented codebase by migrating, not rewriting.","twitter:creator":"@visualassist"},"aioseo_meta_data":{"post_id":"5079","title":"Untangling a Legacy MFC Codebase: A Refactor #separator_sa #post_month #post_year","description":"How Roger Swann took a legacy MFC sensor-testing system from unmaintainable spaghetti to a stable, object-oriented codebase by migrating, not rewriting.","keywords":null,"keyphrases":{"focus":{"keyphrase":"legacy MFC codebase","score":51,"analysis":{"keyphraseInTitle":{"score":9,"maxScore":9,"error":0},"keyphraseInDescription":{"score":3,"maxScore":9,"error":1},"keyphraseLength":{"score":9,"maxScore":9,"error":0,"length":3},"keyphraseInURL":{"score":5,"maxScore":5,"error":0},"keyphraseInIntroduction":{"score":3,"maxScore":9,"error":1},"keyphraseInSubHeadings":{"score":3,"maxScore":9,"error":1},"keyphraseInImageAlt":{"score":3,"maxScore":9,"error":1},"keywordDensity":{"score":0,"type":"low","maxScore":9,"error":1}}},"additional":[{"keyphrase":"refactor legacy C++ code, MFC to C++ Builder migration, migrate don't rewrite, class hierarchy refactor, legacy C++ modernization","score":27,"analysis":{"keyphraseInDescription":{"score":3,"maxScore":9,"error":1},"keyphraseLength":{"score":3,"maxScore":9,"error":1,"length":18},"keyphraseInIntroduction":{"score":3,"maxScore":9,"error":1},"keyphraseInImageAlt":{"score":3,"maxScore":9,"error":1},"keywordDensity":{"score":0,"type":"low","maxScore":9,"error":1}}}]},"primary_term":{"category":726360007},"canonical_url":"https:\/\/www.wholetomato.com\/blog\/untangling-legacy-mfc-codebase\/","og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"BlogPosting","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"seo_analyzer_scan_date":null,"breadcrumb_settings":null,"limit_modified_date":false,"open_ai":null,"ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":[],"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"created":"2026-08-04 13:41:49","updated":"2026-08-10 15:16:56","reviewed_by":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t<a href=\"https:\/\/www.wholetomato.com\/blog\" title=\"Home\">Home<\/a>\n<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t<a href=\"https:\/\/www.wholetomato.com\/blog\/category\/success-story\/\" title=\"Success Story\">Success Story<\/a>\n<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\tUntangling a Legacy MFC Codebase: One Engineer\u2019s Refactor\n<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.wholetomato.com\/blog"},{"label":"Success Story","link":"https:\/\/www.wholetomato.com\/blog\/category\/success-story\/"},{"label":"Untangling a Legacy MFC Codebase: One Engineer&#8217;s Refactor","link":"https:\/\/www.wholetomato.com\/blog\/untangling-legacy-mfc-codebase\/"}],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts\/5079","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/users\/213500340"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/comments?post=5079"}],"version-history":[{"count":7,"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts\/5079\/revisions"}],"predecessor-version":[{"id":5092,"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts\/5079\/revisions\/5092"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/media\/5081"}],"wp:attachment":[{"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/media?parent=5079"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/categories?post=5079"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/tags?post=5079"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}