<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>潘锦的空间 &#187; 软件复杂度</title>
	<atom:link href="https://www.phppan.com/tag/%e8%bd%af%e4%bb%b6%e5%a4%8d%e6%9d%82%e5%ba%a6/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.phppan.com</link>
	<description>SaaS SaaS架构 团队管理 技术管理 技术架构 PHP 内核 扩展 项目管理</description>
	<lastBuildDate>Sun, 10 May 2026 02:26:45 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=3.9.40</generator>
	<item>
		<title>AI 编程后，软件的本质复杂度会有变化吗？</title>
		<link>https://www.phppan.com/2025/03/ai-programming-software-complexity-architect-guide/</link>
		<comments>https://www.phppan.com/2025/03/ai-programming-software-complexity-architect-guide/#comments</comments>
		<pubDate>Sat, 01 Mar 2025 12:41:07 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[架构和远方]]></category>
		<category><![CDATA[AI编程]]></category>
		<category><![CDATA[软件复杂度]]></category>

		<guid isPermaLink="false">https://www.phppan.com/?p=2338</guid>
		<description><![CDATA[最近一直在深度使用 AI 编程，从完全无代码的开发哥网站，到 AI 生成后台代码；从 Cursor 到 Tra [&#8230;]]]></description>
				<content:encoded><![CDATA[<section id="nice" style="color: #000000;" data-tool="mdnice编辑器" data-website="https://www.mdnice.com">
<p data-tool="mdnice编辑器">最近一直在深度使用 AI 编程，从<strong style="color: #0e88eb;">完全无代码的<a style="color: #0e88eb;" href="https://www.kaifage.com/">开发哥</a>网站</strong>，到 AI 生成后台代码；从 <strong style="color: #0e88eb;">Cursor 到 Trae AI</strong>，能明显感受到 AI 可以帮我写大量代码。最多的时候，<strong style="color: #0e88eb;">5 个小时写了超过 2000 行可以运行的代码</strong>。但一个奇怪的感受是，<strong style="color: #0e88eb;">尽管 AI 让代码生产更快了，软件开发的复杂度却没有降低，项目的构建需要的心力依然和以前一样。</strong></p>
<p data-tool="mdnice编辑器">这让我不禁思考：<strong style="color: #0e88eb;">AI 真的在降低软件开发的复杂度吗？还是说，复杂度只是被转移了？</strong></p>
<hr data-tool="mdnice编辑器" />
<h1 data-tool="mdnice编辑器"><span class="content" style="color: #0e8aeb;">1. AI 编程 ≠ 复杂度消失，而是复杂度转移</span></h1>
<p data-tool="mdnice编辑器">在《人月神话》中，布鲁克斯提出了软件开发的四大本质复杂度：<strong style="color: #0e88eb;">复杂度、一致性、可变性、不可见性</strong>。即使 AI 能够自动生成代码，这些复杂性依旧存在。</p>
<ul data-tool="mdnice编辑器">
<li>
<section style="color: #010101;"><strong style="color: #0e88eb;">业务复杂性</strong>：AI 可以帮我们写代码，但它无法自动理解业务规则的变化。例如，一个 AI 生成的电商促销规则，可能在逻辑漏洞下导致「满 100 减 200」这样的错误，造成严重损失。</section>
</li>
<li>
<section style="color: #010101;"><strong style="color: #0e88eb;">技术复杂性</strong>：AI 可以优化 SQL 查询、生成索引，但 AI 生成的代码仍然可能隐藏性能瓶颈，甚至带来更高的架构耦合度。</section>
</li>
<li>
<section style="color: #010101;"><strong style="color: #0e88eb;">治理复杂性</strong>：AI 代码的可维护性、可解释性，仍然是一个巨大的挑战。AI 生成的代码往往不是“最优解”，而是“看起来能跑”的解。</section>
</li>
</ul>
<p data-tool="mdnice编辑器"> AI 并没有消除软件开发的复杂度，而是将其<strong style="color: #0e88eb;">转移</strong>到了其它的层面：</p>
<section class="table-container" data-tool="mdnice编辑器">
<table>
<thead>
<tr>
<th style="color: #000000;">传统复杂度</th>
<th style="color: #000000;">AI 时代的复杂度转移</th>
</tr>
</thead>
<tbody>
<tr style="color: #000000;">
<td>人工编写 CRUD 代码</td>
<td>提示工程（Prompt Engineering）</td>
</tr>
<tr style="color: #000000;">
<td>手动优化数据库索引</td>
<td>AI 生成索引，但需要人类调优</td>
</tr>
<tr style="color: #000000;">
<td>代码逻辑的可读性</td>
<td>AI 生成的代码可能变成「黑盒」</td>
</tr>
<tr style="color: #000000;">
<td>需求沟通的精确表达</td>
<td>需要用更严谨的自然语言指导 AI</td>
</tr>
</tbody>
</table>
</section>
<h1 data-tool="mdnice编辑器"><span class="content" style="color: #0e8aeb;">2. AI 让开发更快，但项目建设更复杂</span></h1>
<p data-tool="mdnice编辑器">布鲁克斯认为，软件开发的困难分为<strong style="color: #0e88eb;">根本困难</strong>（Essential Complexity）和<strong style="color: #0e88eb;">次要困难</strong>（Accidental Complexity）：</p>
<ul data-tool="mdnice编辑器">
<li>
<section style="color: #010101;"><strong style="color: #0e88eb;">根本困难</strong>：软件本身的固有复杂性，不会因技术进步而消失。</section>
</li>
<li>
<section style="color: #010101;"><strong style="color: #0e88eb;">次要困难</strong>：开发过程中人为引入的复杂性，如编程语言、工具、调试方式等，可以通过技术优化。</section>
</li>
</ul>
<p data-tool="mdnice编辑器"><strong style="color: #0e88eb;">AI 编程 主要解决的是「次要困难」，但无法消除「根本困难」</strong>。让我们来看看布鲁克斯提出的软件开发四大根本困难，以及 AI 编程是否真的能克服它们。</p>
<h2 data-tool="mdnice编辑器"><span class="content" style="color: #0e8aeb;">2.1 复杂度（Complexity）</span></h2>
<p data-tool="mdnice编辑器">布鲁克斯认为，软件的复杂度源自以下几个因素：</p>
<ul data-tool="mdnice编辑器">
<li>
<section style="color: #010101;">组件交互的指数级增长（比如微服务架构）。</section>
</li>
<li>
<section style="color: #010101;">代码状态的激增（如并发编程）。</section>
</li>
<li>
<section style="color: #010101;">业务逻辑的无限变化（如金融风控规则）。</section>
</li>
<li>
<section style="color: #010101;">缺乏对整个系统的全局掌控能力。</section>
</li>
</ul>
<p data-tool="mdnice编辑器"><strong style="color: #0e88eb;">AI 确实能快速生成代码，但它无法减少软件的业务复杂性。</strong> 例如：</p>
<ul data-tool="mdnice编辑器">
<li>
<section style="color: #010101;">AI 可以帮你写一个支付系统的 API，但它<strong style="color: #0e88eb;">无法理解跨境支付的法律法规</strong>，仍然需要人类去设计合规架构。</section>
</li>
<li>
<section style="color: #010101;">AI 生成的代码可能<strong style="color: #0e88eb;">没有考虑到以前没有见过异常情况</strong>，导致后期维护困难。</section>
</li>
</ul>
<p data-tool="mdnice编辑器"><strong style="color: #0e88eb;">结论</strong>：AI <strong style="color: #0e88eb;">不会减少软件的复杂度</strong>，只是让代码生产更快，但架构和业务逻辑的复杂性依然存在。</p>
<h2 data-tool="mdnice编辑器"><span class="content" style="color: #0e8aeb;">2.2 一致性（Consistency）</span></h2>
<p data-tool="mdnice编辑器">软件必须兼容<strong style="color: #0e88eb;">历史系统、旧数据、第三方 API 和用户习惯</strong>，这导致：</p>
<ul data-tool="mdnice编辑器">
<li>
<section style="color: #010101;">新系统必须适配旧架构。</section>
</li>
<li>
<section style="color: #010101;">代码风格和 API 设计必须保持一致。</section>
</li>
<li>
<section style="color: #010101;">数据格式、协议、接口规范不能随意更改。</section>
</li>
</ul>
<p data-tool="mdnice编辑器"><strong style="color: #0e88eb;">AI 可能会破坏一致性，而不是增强一致性。</strong></p>
<ul data-tool="mdnice编辑器">
<li>
<section style="color: #010101;"><strong style="color: #0e88eb;">AI 生成的代码风格可能不统一</strong>，团队成员需要额外时间进行重构。</section>
</li>
<li>
<section style="color: #010101;"><strong style="color: #0e88eb;">AI 可能会引入隐性的兼容性问题</strong>，导致老系统无法正常运行。</section>
</li>
</ul>
<p data-tool="mdnice编辑器"><strong style="color: #0e88eb;">结论</strong>：AI 不能自动保证代码和系统的一致性，反而可能引入新的不兼容问题。</p>
<h2 data-tool="mdnice编辑器"><span class="content" style="color: #0e8aeb;">2.3 可变性（Changeability）</span></h2>
<p data-tool="mdnice编辑器">软件必须不断适应需求变化：</p>
<ul data-tool="mdnice编辑器">
<li>
<section style="color: #010101;"><strong style="color: #0e88eb;">政策法规变化</strong>（如 GDPR 隐私保护要求）。</section>
</li>
<li>
<section style="color: #010101;"><strong style="color: #0e88eb;">新业务功能增加</strong>（比如直播带货）。</section>
</li>
<li>
<section style="color: #010101;"><strong style="color: #0e88eb;">技术栈升级或迁移</strong>（比如从 MySQL 迁移到 PostgreSQL 等）。</section>
</li>
</ul>
<p data-tool="mdnice编辑器">AI 确实可以加速代码变更，但<strong style="color: #0e88eb;">它无法理解业务变更的深层逻辑</strong>：</p>
<ul data-tool="mdnice编辑器">
<li>
<section style="color: #010101;">AI 可能会<strong style="color: #0e88eb;">机械地替换代码</strong>，但不会思考<strong style="color: #0e88eb;">整体架构是否需要调整</strong>。</section>
</li>
<li>
<section style="color: #010101;">AI 可能会<strong style="color: #0e88eb;">优化单个函数</strong>，但不会考虑<strong style="color: #0e88eb;">整个系统的长期演进</strong>。</section>
</li>
</ul>
<p data-tool="mdnice编辑器"> <strong style="color: #0e88eb;">结论</strong>：AI 可以加速代码变更，但<strong style="color: #0e88eb;">无法主动适应业务变化，反而可能增加技术债务</strong>。</p>
<h2 data-tool="mdnice编辑器"><span class="content" style="color: #0e8aeb;">2.4 不可见性（Invisibility）</span></h2>
<p data-tool="mdnice编辑器">软件不像建筑或者机械产品那样，可以从物理空间上直观理解。软件的结构是逻辑性的，导致：</p>
<ul data-tool="mdnice编辑器">
<li>
<section style="color: #010101;"><strong style="color: #0e88eb;">沟通困难</strong>：不同开发者对系统的理解可能不同。</section>
</li>
<li>
<section style="color: #010101;"><strong style="color: #0e88eb;">调试困难</strong>：AI 生成的代码可能变成「黑盒」，难以分析问题。</section>
</li>
<li>
<section style="color: #010101;"><strong style="color: #0e88eb;">架构复杂化</strong>：AI 生成代码可能会引入隐形的设计缺陷。</section>
</li>
</ul>
<p data-tool="mdnice编辑器"> <strong style="color: #0e88eb;">结论</strong>：AI 代码的「黑盒性」可能让软件的<strong style="color: #0e88eb;">可见性更差</strong>，导致调试和维护的挑战更大。</p>
<h1 data-tool="mdnice编辑器"><span class="content" style="color: #0e8aeb;">3. AI 编程的真正价值：降低「次要困难」</span></h1>
<p data-tool="mdnice编辑器">虽然 AI <strong style="color: #0e88eb;">无法消除软件的根本复杂度</strong>，但它确实在<strong style="color: #0e88eb;">减少次要复杂度</strong>（Accidental Complexity），包括： ✔ <strong style="color: #0e88eb;">代码生成</strong>：AI 可以帮你写 CRUD、API、测试代码，提高开发效率。<br />
✔ <strong style="color: #0e88eb;">调试辅助</strong>：AI 可以自动分析日志、找出潜在 Bug。<br />
✔ <strong style="color: #0e88eb;">文档生成</strong>：AI 可以自动补充代码注释，提升可读性。<br />
✔ <strong style="color: #0e88eb;">代码优化</strong>：AI 可以推荐更优的算法或 SQL 查询，提高性能。</p>
<p data-tool="mdnice编辑器">但与此同时，AI 也引入了<strong style="color: #0e88eb;">新的复杂度</strong>： ❌ <strong style="color: #0e88eb;">Prompt 设计复杂度</strong>：如何写出好的 Prompt，才能让 AI 生成高质量代码？AI 代码质量很大程度上<strong style="color: #0e88eb;">依赖于输入的提示（Prompt）</strong>，这意味着开发者需要掌握新的技能，比如如何编写高质量的 Prompt。 ❌ <strong style="color: #0e88eb;">AI 代码治理</strong>：如何审查 AI 生成的代码，防止安全漏洞？<br />
❌ <strong style="color: #0e88eb;">技术债务</strong>：AI 可能会生成「能跑但难维护」的代码，如何管理长远的架构演进？ AI 可以帮助我们快速生成大量代码，但如何<strong style="color: #0e88eb;">组织这些代码、保证架构的可维护性</strong>，仍然是开发者的责任。</p>
<h1 data-tool="mdnice编辑器"><span class="content" style="color: #0e8aeb;">4. 未来开发者的核心竞争力：驾驭 AI，而不是被 AI 取代</span></h1>
<p data-tool="mdnice编辑器">AI 编程时代，开发者的角色正在改变：</p>
<ul data-tool="mdnice编辑器">
<li>
<section style="color: #010101;">过去，开发者的价值在于<strong style="color: #0e88eb;">写代码</strong>。</section>
</li>
<li>
<section style="color: #010101;">未来，开发者的价值在于<strong style="color: #0e88eb;">驾驭代码复杂度，利用 AI 高效开发</strong>。</section>
</li>
</ul>
<h2 data-tool="mdnice编辑器"><span class="content" style="color: #0e8aeb;">开发者的三大新技能</span></h2>
<h3 data-tool="mdnice编辑器"><span class="content" style="color: #0e88eb;">✅ <strong>语义工程</strong>：如何用精准的 Prompt 让 AI 生成高质量代码？</span></h3>
<ul data-tool="mdnice编辑器">
<li>
<section style="color: #010101;">AI 代码质量的高低，取决于开发者如何设计 Prompt。</section>
</li>
<li>
<section style="color: #010101;"><strong style="color: #0e88eb;">但 AI 无法判断哪种方案最适合当前业务场景</strong>，这仍然需要开发者的经验与判断。</section>
</li>
</ul>
<h3 data-tool="mdnice编辑器"><span class="content" style="color: #0e88eb;">✅ <strong>AI 代码治理</strong>：如何审核 AI 代码，防止技术债务？</span></h3>
<ul data-tool="mdnice编辑器">
<li>
<section style="color: #010101;">AI 代码可能会引入新的技术债务，比如：</p>
<ul style="color: #000000;">
<li>
<section style="color: #010101;">代码结构混乱，缺乏一致性</section>
</li>
<li>
<section style="color: #010101;">逻辑错误难以发现</section>
</li>
<li>
<section style="color: #010101;">AI 生成的代码难以调试</section>
</li>
</ul>
</section>
</li>
<li>
<section style="color: #010101;">未来，<strong style="color: #0e88eb;">AI 代码审查</strong>（AI Code Review）可能会成为开发流程的新标准。</section>
</li>
</ul>
<h3 data-tool="mdnice编辑器"><span class="content" style="color: #0e88eb;">✅ <strong>架构思维</strong>：如何让 AI 代码符合长期可维护的架构设计？</span></h3>
<ul data-tool="mdnice编辑器">
<li>
<section style="color: #010101;">未来的开发者，需要具备更强的<strong style="color: #0e88eb;">系统思维</strong>：</p>
<ul style="color: #000000;">
<li>
<section style="color: #010101;">如何拆解业务需求？</section>
</li>
<li>
<section style="color: #010101;">如何设计可扩展的架构？</section>
</li>
<li>
<section style="color: #010101;">如何管理 AI 代码的质量？</section>
</li>
</ul>
</section>
</li>
<li>
<section style="color: #010101;"><strong style="color: #0e88eb;">开发者需要从「被动写代码」转变为「主动设计系统」</strong>。</section>
</li>
</ul>
<h1 data-tool="mdnice编辑器"><span class="content" style="color: #0e8aeb;">5. 结尾</span></h1>
<p data-tool="mdnice编辑器">AI 让代码生成变得简单，但软件架构仍然需要人类设计。</p>
<p data-tool="mdnice编辑器">未来，AI 编程会让开发变得更加高效，但开发者的核心竞争力<strong style="color: #0e88eb;">将不再是写代码，而是驾驭复杂度</strong>。</p>
<p data-tool="mdnice编辑器">未来，AI 可能会替代<strong style="color: #0e88eb;">低端的代码搬运工</strong>，但无法替代<strong style="color: #0e88eb;">深刻理解复杂度的架构师</strong>。</p>
<p data-tool="mdnice编辑器"><strong style="color: #0e88eb;">「AI 不会取代开发者，但懂得驾驭 AI 的开发者，将取代那些不懂 AI 的人。」</strong></p>
<p data-tool="mdnice编辑器">以上。</p>
</section>
]]></content:encoded>
			<wfw:commentRss>https://www.phppan.com/2025/03/ai-programming-software-complexity-architect-guide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
