{"id":2639,"date":"2026-07-29T21:33:15","date_gmt":"2026-07-29T19:33:15","guid":{"rendered":"https:\/\/extendsclass.com\/blog\/?p=2639"},"modified":"2026-07-29T21:26:06","modified_gmt":"2026-07-29T19:26:06","slug":"why-ai-generated-code-becomes-difficult-to-maintain","status":"publish","type":"post","link":"https:\/\/extendsclass.com\/blog\/why-ai-generated-code-becomes-difficult-to-maintain","title":{"rendered":"Why AI-generated code becomes difficult to maintain"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Artificial intelligence has changed the way we develop applications. In a few seconds, it can generate a complete function, suggest an architecture, or transform an idea into a working prototype (well, it can also take quite a few minutes in this particular case&#8230;).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This speed is particularly useful at the beginning of a project. The first features move quickly, repetitive tasks disappear, and we can focus more on business logic.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But over time, a problem appears: AI-generated code is not always designed to evolve. It often answers the immediate request without necessarily considering the future constraints of the project.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this article, we will look at the main problems encountered with AI-generated code.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_47_1 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"ez-toc-toggle-icon-1\"><label for=\"item-6a6a701d5a8c1\" aria-label=\"Table of Content\"><span style=\"display: flex;align-items: center;width: 35px;height: 30px;justify-content: center;direction:ltr;\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/label><input  type=\"checkbox\" id=\"item-6a6a701d5a8c1\"><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/extendsclass.com\/blog\/why-ai-generated-code-becomes-difficult-to-maintain\/#Logic_duplication\" title=\"Logic duplication\">Logic duplication<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/extendsclass.com\/blog\/why-ai-generated-code-becomes-difficult-to-maintain\/#Unnecessary_abstractions\" title=\"Unnecessary abstractions\">Unnecessary abstractions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/extendsclass.com\/blog\/why-ai-generated-code-becomes-difficult-to-maintain\/#Too_many_dependencies\" title=\"Too many dependencies\">Too many dependencies<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/extendsclass.com\/blog\/why-ai-generated-code-becomes-difficult-to-maintain\/#Code_that_is_difficult_to_explain\" title=\"Code that is difficult to explain\">Code that is difficult to explain<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/extendsclass.com\/blog\/why-ai-generated-code-becomes-difficult-to-maintain\/#The_problem_of_limited_context\" title=\"The problem of limited context\">The problem of limited context<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/extendsclass.com\/blog\/why-ai-generated-code-becomes-difficult-to-maintain\/#AI_remains_an_excellent_tool_when_used_correctly\" title=\"AI remains an excellent tool when used correctly\">AI remains an excellent tool when used correctly<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/extendsclass.com\/blog\/why-ai-generated-code-becomes-difficult-to-maintain\/#Conclusion\" title=\"Conclusion\">Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Logic_duplication\"><\/span><strong>Logic duplication<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">One possible problem with AI-generated code is the repetition of logic.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When we ask an AI to add a new feature, it generally tries to provide a working solution based on the context available. If it does not know about existing components or if the project is large (several thousand code files&#8230;), it may create a new implementation instead of reusing logic that already exists.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In a small project, this problem is relatively rare. The developer usually knows the code organization and can easily spot existing features. But when the application grows, with dozens or hundreds of files, the situation changes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Starting the development of a new feature by simply asking the AI to &#8220;add it&#8221; without providing the necessary context can lead to duplicated logic. The AI will often produce a functional solution, but not necessarily the one that integrates best with the existing codebase.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Unnecessary_abstractions\"><\/span>Unnecessary abstractions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">AI models tend to suggest very general structures to solve a problem. In some cases, this can quickly lead to a multiplication of layers and components, even when the complexity of the project does not justify it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Abstraction is a powerful tool for organizing code and making it easier to evolve, but it does not always mean better design. An abstraction introduced too early can make code harder to understand, longer to modify, and sometimes less efficient.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Well-designed code is not necessarily the code with the most layers, but the code that uses the right level of complexity for the problem.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When AI suggests &#8220;beautiful code&#8221; to me, I often tend to accept it. It is difficult to reject a solution that looks clean and well structured&#8230;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Too_many_dependencies\"><\/span>Too many dependencies<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Another difficulty comes from libraries added automatically. To solve a problem, AI may recommend an external dependency even when a native solution already exists.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, adding a complete library to handle dates:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>composer require date-helper-package<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">when PHP already provides suitable tools:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$date = new DateTime();<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Every dependency brings:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>additional code to maintain;<\/li>\n\n\n\n<li>security updates;<\/li>\n\n\n\n<li>compatibility risks;<\/li>\n\n\n\n<li>new documentation to learn.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">An application with too many dependencies often becomes more fragile.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Code_that_is_difficult_to_explain\"><\/span><strong>Code that is difficult to explain<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Another problem appears when developers accept generated code without really understanding it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">AI can produce a complex function:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$result = array_reduce(\narray_filter(\n\u00a0 \u00a0 \u00a0 \u00a0 array_map(\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 fn($item) => transform($item),\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 $items\n\u00a0 \u00a0 \u00a0 \u00a0 ),\n\u00a0 \u00a0 \u00a0 \u00a0 fn($item) => $item !== null\n\u00a0 \u00a0 ),\n\u00a0 \u00a0 fn($carry, $item) => merge($carry, $item),\n\u00a0 \u00a0 &#91;]\n);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This code may be correct, but will it still be understandable in six months? Will another developer be able to modify it easily?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In a professional project, readability is often more important than the amount of code written. We have to think about our colleagues ^^<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A slightly longer but explicit piece of code will usually be easier to maintain:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$transformedItems = &#91;];\nforeach ($items as $item) {\n\u00a0 \u00a0 $result = transform($item);\n\u00a0 \u00a0 if ($result !== null) {\n\u00a0 \u00a0 \u00a0 \u00a0 $transformedItems&#91;] = $result;\n\u00a0 \u00a0 }\n}\nreturn mergeItems($transformedItems);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Some people might say that an AI will be the one reading this code to modify it in the future&#8230; They are not completely wrong oO<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"The_problem_of_limited_context\"><\/span><strong>The problem of limited context<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">An AI does not always know the entire project. And fortunately, otherwise it would cost a lot in tokens&#8230;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It may ignore:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>existing conventions;<\/li>\n\n\n\n<li>historical constraints;<\/li>\n\n\n\n<li>expected performance requirements;<\/li>\n\n\n\n<li>previous technical choices.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">It therefore often generates a solution that is correct locally, but not necessarily adapted globally.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In my opinion, a developer must keep a validation role:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>understand the proposed code;<\/li>\n\n\n\n<li>check its integration;<\/li>\n\n\n\n<li>simplify when necessary;<\/li>\n\n\n\n<li>remove what is not useful.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"AI_remains_an_excellent_tool_when_used_correctly\"><\/span><strong>AI remains an excellent tool when used correctly<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Despite these limitations, AI-generated code provides many benefits. It can significantly reduce the time spent on repetitive tasks:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>generating basic structures;<\/li>\n\n\n\n<li>creating tests;<\/li>\n\n\n\n<li>writing documentation;<\/li>\n\n\n\n<li>converting code;<\/li>\n\n\n\n<li>finding simple errors.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">A developer can then spend more time on important decisions: architecture, user experience, and business logic (personally, I am heavily involved by project managers and clients).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">AI works particularly well as a development assistant. It speeds up code creation, but the final quality still depends on the developer&#8217;s ability to review, understand, and improve that code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span><strong>Conclusion<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Generative AI is here, and it will probably remain an important part of software development. It is a great ally for developers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, I remain more skeptical about some practices that involve running several agents in parallel (risk of burnout?) and multiplying code generations without real supervision.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8220;vibe coding&#8221; phenomenon also leaves me doubtful. Quickly creating a prototype is one thing; building a reliable, secure, and maintainable application over several years is another.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The future will tell us how these new ways of developing will evolve. In a few years, will I still be a developer in the same way as I am today? Or will I simply still be a developer?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Artificial intelligence has changed the way we develop applications. In a few seconds, it can generate a complete function, suggest an architecture, or transform an idea into a working prototype (well, it can also take quite a few minutes in this particular case&#8230;). This speed is particularly useful at the beginning of a project. The [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2640,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","footnotes":""},"categories":[2],"tags":[],"class_list":["post-2639","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/extendsclass.com\/blog\/wp-json\/wp\/v2\/posts\/2639","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/extendsclass.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/extendsclass.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/extendsclass.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/extendsclass.com\/blog\/wp-json\/wp\/v2\/comments?post=2639"}],"version-history":[{"count":1,"href":"https:\/\/extendsclass.com\/blog\/wp-json\/wp\/v2\/posts\/2639\/revisions"}],"predecessor-version":[{"id":2641,"href":"https:\/\/extendsclass.com\/blog\/wp-json\/wp\/v2\/posts\/2639\/revisions\/2641"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/extendsclass.com\/blog\/wp-json\/wp\/v2\/media\/2640"}],"wp:attachment":[{"href":"https:\/\/extendsclass.com\/blog\/wp-json\/wp\/v2\/media?parent=2639"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/extendsclass.com\/blog\/wp-json\/wp\/v2\/categories?post=2639"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/extendsclass.com\/blog\/wp-json\/wp\/v2\/tags?post=2639"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}