Software Design in the Age of AI
Software Design in the Age of AI
AI 时代的软件设计
Introduction 引言
AI can now write significant amounts of software code, including increasingly large and complex systems. This is rapidly changing the way software is developed and has already affected the careers of many in the industry. It has also raised questions about how reliably AI can code complex systems, how its risks can be managed, and the extent of job disruption. Most importantly, it raises a fundamental question: does the ability of AI to write software make software engineering less important? 人工智能现在可以编写大量的软件代码,包括规模日益庞大且复杂的系统。这正在迅速改变软件开发的方式,并已经影响了行业内许多人的职业生涯。它也引发了关于人工智能在编写复杂系统时可靠性如何、风险如何管理以及工作岗位流失程度等问题。最重要的是,它提出了一个根本性的问题:人工智能编写软件的能力是否使得软件工程变得不再那么重要了?
The answer lies in distinguishing coding from software engineering. Software development involves much more than writing code. At the very least, it involves five activities: understanding requirements, design, coding, verification, and support. The quality of each activity affects the ones that come next. Coding is only one part of this larger engineering process. 答案在于区分“编码”与“软件工程”。软件开发不仅仅是编写代码。至少,它涉及五个活动:需求理解、设计、编码、验证和支持。每一项活动的质量都会影响后续的活动。编码只是这个庞大工程过程中的一部分。
This article focuses on software design and, in particular, on how the use of AI coding tools is changing its role and importance. Software design is one of the key activities in the software life cycle. Assuming that user requirements have been gathered correctly, design becomes a key factor in the success of the system. AI makes code generation easier, but this makes software design more important, not less. For large software systems, the effectiveness of AI in coding and support will depend significantly on the quality of the design. As teams depend more and more on AI coding tools, they will have to pay greater attention to how their software is designed. 本文重点讨论软件设计,特别是人工智能编码工具的使用如何改变其角色和重要性。软件设计是软件生命周期中的关键活动之一。假设用户需求已正确收集,设计便成为系统成功的关键因素。人工智能使代码生成变得更容易,但这反而使软件设计变得更加重要,而非相反。对于大型软件系统而言,人工智能在编码和支持方面的有效性将很大程度上取决于设计的质量。随着团队越来越依赖人工智能编码工具,他们将不得不更加关注软件的设计方式。
To understand why this is happening, we will briefly discuss the fundamentals of both software and design. We will use a stakeholder-centric approach and see how AI itself can become a stakeholder in software design. Through these discussions, we will see that the fundamental goals of software design remain the same, but their importance increases as AI takes on a larger role in software development. 为了理解为什么会发生这种情况,我们将简要讨论软件和设计的基本原理。我们将采用以利益相关者为中心的方法,看看人工智能本身如何成为软件设计中的利益相关者。通过这些讨论,我们将看到软件设计的基本目标保持不变,但随着人工智能在软件开发中承担更大的角色,这些目标的重要性也随之增加。
What is software 什么是软件
We often think of software as a kind of machine. Like all machines, it takes certain inputs and provides outputs. But software is a special type of machine. The inputs and outputs of software can change frequently. More importantly, software itself is continuously modified while it remains in operation. Over a period of time, a software system can undergo so many modifications that it may bear little resemblance to its initial state. 我们通常将软件视为一种机器。像所有机器一样,它接收特定的输入并提供输出。但软件是一种特殊的机器。软件的输入和输出可以频繁变化。更重要的是,软件本身在运行过程中会不断被修改。经过一段时间,一个软件系统可能会经历如此多的修改,以至于它可能与其初始状态几乎毫无相似之处。
Any complex system can be thought of in terms of a simple formula: y = A(x), where x is the set of all inputs, y is the set of all outputs, and A contains all the processing that is done to convert x to y. 任何复杂系统都可以用一个简单的公式来思考:y = A(x),其中 x 是所有输入的集合,y 是所有输出的集合,而 A 包含了将 x 转换为 y 所进行的所有处理。
Take the example of an airplane. It takes many inputs from its sensors and through its controls. But these are not the only inputs. Environmental factors such as wind and pressure, altitude, gravity, and even the weight and movement of the passengers are all inputs to the plane. The outputs are the changes it makes to the engine parameters and, ultimately, changes in speed, angle and so on. We can imagine that both x and y are large sets, and A is made up of thousands of parts interacting with each other. 以飞机为例。它从传感器和控制器接收许多输入。但这些并不是唯一的输入。风、气压、高度、重力等环境因素,甚至乘客的重量和移动,都是飞机的输入。输出则是它对发动机参数所做的调整,并最终导致速度、角度等方面的变化。我们可以想象 x 和 y 都是庞大的集合,而 A 则由数千个相互作用的部件组成。
Our brain, with 80 billion neurons and nearly infinite numbers of inputs and outputs, is also a good example of a complex system. 我们的大脑拥有 800 亿个神经元以及近乎无限的输入和输出,也是复杂系统的一个很好的例子。
Software is one of the most complex systems created by humans. The number of inputs and outputs of a system such as an ERP can be mind-boggling. But the real challenge of a software system lies not only in its complexity, but in its elastic nature: it undergoes frequent modification throughout its life, often while continuing to serve its users. 软件是人类创造的最复杂的系统之一。像 ERP 这样的系统,其输入和输出的数量可能令人难以置信。但软件系统的真正挑战不仅在于其复杂性,还在于其弹性本质:它在整个生命周期中会经历频繁的修改,而且通常是在持续为用户提供服务的同时进行的。
The brain is a good example of a complex system that changes over time. New connections between neurons, and changes in the strength of existing connections, allow the brain to learn new things. Learning can mean incorporating new inputs, new outputs, or new relationships between them. 大脑是一个随时间变化的复杂系统的典型例子。神经元之间新的连接以及现有连接强度的变化,使大脑能够学习新事物。学习可能意味着整合新的输入、新的输出,或它们之间新的关系。
But the brain is a unique system. There are hardly any other examples of natural or man-made systems that undergo such frequent modifications to accommodate changes in their inputs and outputs while continuing to operate. This puts software in an esoteric club: complex systems that are continuously modified during their lifetime. 但大脑是一个独特的系统。几乎没有其他自然或人造系统能够在持续运行的同时,为了适应输入和输出的变化而进行如此频繁的修改。这使得软件进入了一个特殊的行列:在生命周期内被持续修改的复杂系统。
This characteristic has an important implication for software design. A designer is not only designing the system that exists today; the designer is also designing how that system can be understood, modified and extended tomorrow. The design therefore has to account not only for the current requirements of the system, but also for the changes that the system is likely to undergo throughout its life. 这一特性对软件设计有着重要的启示。设计师不仅是在设计今天存在的系统;设计师还在设计该系统在未来如何被理解、修改和扩展。因此,设计不仅要考虑系统当前的需求,还要考虑系统在其整个生命周期中可能经历的变化。
What is software design 什么是软件设计
Design is a kind of planning. More precisely, design is a plan for achieving the goals of a system. Imagine you are planning for a trip. The plan will include the destination, travel, stay, places to see, day-wise itinerary, documents required and many other things. Taken together, this plan can be called a design. Some parts of the plan will be more concrete than others. For example, tickets and accommodation may be booked firmly in advance, while the plan for a particular day may be decided only vaguely. 设计是一种规划。更准确地说,设计是实现系统目标的计划。想象一下你正在计划一次旅行。计划将包括目的地、交通、住宿、景点、每日行程、所需证件以及许多其他事项。总而言之,这个计划可以被称为一种设计。计划的某些部分会比其他部分更具体。例如,机票和住宿可能提前预订好了,而某天的具体行程可能只是模糊地决定。
When you actually start the trip, the design turns into execution. Some parts will go as planned, while others will have to be adjusted to accommodate real-time situations. Software design follows a similar pattern. Being virtual in nature, it can be described in much greater detail than a holiday trip, but it is still a plan that guides execution. 当你真正开始旅行时,设计就变成了执行。有些部分会按计划进行,而另一些部分则必须根据实时情况进行调整。软件设计遵循类似的模式。由于其本质是虚拟的,它可以比度假旅行描述得更详细,但它仍然是指导执行的计划。
A closer analogy for software design is furnishing a house. If we want a comfortable and functional home, we have to plan the furnishing in advance. We first identify the civil work, electrical wiring, plumbing and furniture that will be needed. Some components can be specially made, while others can be bought from the market. We then have to ensure that all these components fit together and work as a whole. A washing machine, for example, will need water, drainage and electricity connections, and the… 软件设计的一个更贴切的类比是装修房子。如果我们想要一个舒适且功能齐全的家,我们必须提前规划装修。我们首先确定所需的土建工程、电路布线、管道和家具。有些组件可以定制,而另一些则可以从市场上购买。然后,我们必须确保所有这些组件能够相互配合,作为一个整体运作。例如,洗衣机需要水、排水和电力连接,并且……