{"id":3321,"date":"2023-08-15T18:26:25","date_gmt":"2023-08-15T22:26:25","guid":{"rendered":"https:\/\/blog.wholetomato.com\/?p=3321"},"modified":"2025-11-17T06:53:57","modified_gmt":"2025-11-17T10:53:57","slug":"summer-codefest-what-the-hex-ports-and-adapters-architecture-with-c-recap","status":"publish","type":"post","link":"https:\/\/www.wholetomato.com\/blog\/summer-codefest-what-the-hex-ports-and-adapters-architecture-with-c-recap\/","title":{"rendered":"Summer CodeFest: What the Hex? Ports and Adapters Architecture with C++ [Recap]"},"content":{"rendered":"<p><strong>This session has concluded <a href=\"https:\/\/youtu.be\/RqYgyYVeZPQ\">watch the replay<\/a> or download the slides below.<\/strong><\/p>\n<h2><span style=\"font-weight: 400;\">Common pitfalls when scaling applications<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">When scaling applications, two common pitfalls often arise: spaghetti code and a lack of proper testing. This can occur for various reasons, but one of the most common reasons is the lack of a coding style guide or an overarching design structure.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">For instance, when starting a project, it\u2019s fairly simple. An input and one or two outputs. However, as the project grows or the requirements expand, programmers can resort to an experimental approach each time a new component is added. They can also resort to using manual testing\u2014which works for simple <a href=\"https:\/\/www.wholetomato.com\/blog\/2023\/10\/31\/ensuring-code-quality-why-every-c-developer-needs-unit-tests\/\">unit tests<\/a> for small projects but overtime becomes too cumbersome.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The lack of a design structure makes projects prone to gradually growing complexity. As a result, the experimental app ends up in production as an inefficient system that demands continuous maintenance. To avoid breaking essential business logic and harming the overall business, developers allocate unnecessary development time to making one-off solutions.\u00a0 The time and effort is compounded due the previous iteration\u2019s shortcomings.<\/span><\/p>\n<div id=\"attachment_3324\" style=\"width: 750px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-What-the-Hex_-Ports-and-Adapters-Architecture-with-C-Webinar-Recap-12-41-screenshot.png?ssl=1\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-3324\" data-attachment-id=\"3324\" data-permalink=\"https:\/\/www.wholetomato.com\/blog\/summer-codefest-what-the-hex-ports-and-adapters-architecture-with-c-recap\/summer-codefest_-what-the-hex_-ports-and-adapters-architecture-with-c-webinar-recap-12-41-screenshot\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-What-the-Hex_-Ports-and-Adapters-Architecture-with-C-Webinar-Recap-12-41-screenshot-e1692137978548.png?fit=1670%2C940&amp;ssl=1\" data-orig-size=\"1670,940\" 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=\"Summer CodeFest_ What the Hex_ Ports and Adapters Architecture with C++ Webinar Recap 12-41 screenshot\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;Using hex architecture can help address scaling issues.&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-What-the-Hex_-Ports-and-Adapters-Architecture-with-C-Webinar-Recap-12-41-screenshot-e1692137978548.png?fit=300%2C169&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-What-the-Hex_-Ports-and-Adapters-Architecture-with-C-Webinar-Recap-12-41-screenshot-e1692137978548.png?fit=1024%2C576&amp;ssl=1\" class=\"wp-image-3324\" src=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-What-the-Hex_-Ports-and-Adapters-Architecture-with-C-Webinar-Recap-12-41-screenshot.png?resize=740%2C417&#038;ssl=1\" alt=\"\" width=\"740\" height=\"417\" data-recalc-dims=\"1\" \/><\/a><p id=\"caption-attachment-3324\" class=\"wp-caption-text\">Using hex architecture can help address scaling issues.<\/p><\/div>\n<h2><span style=\"font-weight: 400;\">Hex structure vs traditional three-layer architecture<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">There is nothing wrong with the traditional 3-layered structure composed of the presentation tier, the application tier, and the data tier. And for most applications this will usually be enough. However, theoretically, as you add more business logic and more functions, the complexity ramps up exponentially. In that case, a traditional approach may no longer be the most efficient. You can always scale and automate by expending more resources, or you can take a step back and reorganize your resources.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">A hex structure, contrary to what the name suggests, is not a 6-tiered structure. Instead, it\u2019s an analogy for the freedom of a developer to add ports and adapters\u2014sort of like a honeycomb structure where you can keep adding more hexagons and there would still be no gaps. In the traditional approach, the presentation, business, and data side flow directly to each other; in hexagonal architecture, you add interfaces (or buffers) in between fully functioning components making them semi-autonomous. You would only have to think about how what data passes from one to another and how communication is processed.<\/span><\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/What-the-hex_-Ports-and-Adapters-architecture-with-C.png?ssl=1\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3326\" data-permalink=\"https:\/\/www.wholetomato.com\/blog\/summer-codefest-what-the-hex-ports-and-adapters-architecture-with-c-recap\/what-the-hex_-ports-and-adapters-architecture-with-c\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/What-the-hex_-Ports-and-Adapters-architecture-with-C.png?fit=1920%2C1080&amp;ssl=1\" data-orig-size=\"1920,1080\" 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=\"What the hex_ Ports and Adapters architecture with C++\" data-image-description=\"&lt;p&gt;#image_title&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;#image_title&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/What-the-hex_-Ports-and-Adapters-architecture-with-C.png?fit=300%2C169&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/What-the-hex_-Ports-and-Adapters-architecture-with-C.png?fit=1024%2C576&amp;ssl=1\" class=\"alignnone wp-image-3326 size-large\" src=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/What-the-hex_-Ports-and-Adapters-architecture-with-C.png?resize=1024%2C576&#038;ssl=1\" alt=\"\" width=\"1024\" height=\"576\" srcset=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/What-the-hex_-Ports-and-Adapters-architecture-with-C.png?resize=1024%2C576&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/What-the-hex_-Ports-and-Adapters-architecture-with-C.png?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/What-the-hex_-Ports-and-Adapters-architecture-with-C.png?resize=768%2C432&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/What-the-hex_-Ports-and-Adapters-architecture-with-C.png?resize=1536%2C864&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/What-the-hex_-Ports-and-Adapters-architecture-with-C.png?resize=1200%2C675&amp;ssl=1 1200w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/What-the-hex_-Ports-and-Adapters-architecture-with-C.png?resize=360%2C203&amp;ssl=1 360w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/What-the-hex_-Ports-and-Adapters-architecture-with-C.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<h2><span style=\"font-weight: 400;\">Fortifying your app with hexagonal architecture<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">The Hexagonal architecture provides a solution to this problem by utilizing dependency inversion control, which separates business logic from implementation details like databases and REST clients. It also fosters a clear separation of concerns between components, ensuring a more organized and manageable application as it grows.<\/span><\/p>\n<p><b>Ports and Adapters<\/b><\/p>\n<p><span style=\"font-weight: 400;\">As the name suggests, hexagonal architecture utilizes standalone components with a functional core in the middle of the design structure. This means that expansion, maintenance, and designing is easier because the program\u2019s components and roles are clearly defined. Buffers between these components allow easy addition and removal as well as facilitate efficient communication among the program\u2019s functions.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">So how do you initiate a program with a hexagonal design structure? Watch our short presentation hosted by Nuno Castro to get a brief introduction and some great examples. <\/span><b>This session has concluded. Browse the presentation slides and replay below.<\/b><\/p>\n<h2>Presentation Slide Deck<\/h2>\n<p><iframe loading=\"lazy\" src=\"https:\/\/docs.google.com\/presentation\/d\/e\/2PACX-1vRcn9y2ttanHdMv1g7W7kzhyi3mFA0fxhfk3D4k55NzgwTXhBRHoO3j-YpZphX4hSYL1HcVSfTnk_sC\/embed?start=false&amp;loop=false&amp;delayms=3000\" width=\"780\" height=\"540\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><span data-mce-type=\"bookmark\" style=\"display: inline-block; width: 0px; overflow: hidden; line-height: 0;\" class=\"mce_SELRES_start\">\u00ef\u00bb\u00bf<\/span><\/iframe><\/p>\n<h2>Watch the Replay<\/h2>\n<p><iframe loading=\"lazy\" title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/RqYgyYVeZPQ\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This session has concluded watch the replay or download the slides below. Common pitfalls when scaling applications When scaling applications, two common pitfalls often arise: spaghetti code and a lack of proper testing. This can&#8230;<\/p>\n","protected":false},"author":213500340,"featured_media":3322,"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":[672,726359896],"tags":[726359925,2426,726359923,726359924],"class_list":["post-3321","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tips-and-tricks","category-webinar-recap","tag-adapters","tag-c","tag-hexagonal-architecture","tag-ports"],"jetpack_publicize_connections":[],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/16_WTSummer-CodeFest-Individual-Sessions_Nuno-Castro-1920x1080-1.png?fit=1920%2C1080&ssl=1","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pfpLS4-Rz","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts\/3321","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=3321"}],"version-history":[{"count":9,"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts\/3321\/revisions"}],"predecessor-version":[{"id":3506,"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts\/3321\/revisions\/3506"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/media\/3322"}],"wp:attachment":[{"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/media?parent=3321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/categories?post=3321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/tags?post=3321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}