软件测试中什么是正交实验法_软件工程中的正交性

正交性是软件设计的重要原则,确保更改一个组件不会影响其他组件。正交性与强内聚和松耦合密切相关,有助于减少代码耦合,提高软件可维护性。在软件测试中,正交实验法确保各个测试因素相互独立,便于定位问题根源。
摘要由CSDN通过智能技术生成

软件测试中什么是正交实验法

正交性 (Orthogonality)

In software engineering, a system is considered orthogonal if changing one of its components changes the state of that component only.

在软件工程中,如果更改系统的组件之一仅更改该组件的状态,则认为该系统是正交的。

For instance, consider a program with three variables: a, b, and c. Changing the value of a should not change the value of b or c, provided they are independent.

例如,考虑一个具有三个变量的程序:a,b和c。 更改a的值不应更改b或c的值,只要它们是独立的。

This property is particularly critical in debugging a program since one relies on narrowing down the number of moving parts of a program to identify the root cause of the problem.

此属性在调试程序时特别重要,因为人们依赖于缩小程序的移动部分的数量来确定问题的根本原因。

See the following quote from Eric S. Raymond’s “Art of UNIX programming”:

请参见Eric S. Raymond的“ UNIX编程艺术”中的以下引用:

Orthogonality is one of the most important properties that can help make even complex designs compact. In a purely orthogonal design, operations do not have side effects; each action (whether it’s an API call, a macro invocation, or a language operation) changes just one thing without affecting others. There is one and only one way to change each property of whatever system you are controlling.
正交性是最重要的属性之一,可以帮助使复杂的设计变得紧凑。 在纯正交设计中,操作没有副作用。 每个操作(无论是API调用,宏调用还是语言操作)都只会改变一件事而不会影响其他事情。 只有一种方法可以更改您所控制的任何系统的每个属性。

Orthogonality is a software design principle for writing components in a way that changing one component doesn’t affect other components. It is the combination of two other principles, namely strong cohesion and loose coupling.

正交性是一种软件设计原理,用于编写组件,而更改一个组件不会影响其他组件。 它是另外两个原理的结合,即强内聚和松散耦合。

It's actually is a term borrowed from mathematics. For example, two lines are orthogonal if they are perpendicular. In software design, two components are orthogonal if a change in one does not affect the other.

它实际上是一个从数学借来的术语。 例如,如果两条线是垂直的,则它们是正交的。 在软件设计中,如果一个组件的更改不影响另一个组件,则两个组件是正交的。

Applying this concept to classes or other sections of code results in less coupling. To be orthogonal two classes cannot depend on each others implementation. They also cannot share global data. Changing the internals of one class does not affect the other class. Components should be independent and have only a single responsibility.

将此概念应用于类或代码的其他部分可减少耦合。 要正交,两个类不能互相依赖。 他们也不能共享全局数据。 更改一个类的内部结构不会影响另一类。 组件应该是独立的,并且只有一个责任。

Consider a method that reads a list of numbers from a file and returns them in sorted order. Now the requirements change and the numbers are in a database. Modifying this method to access the database would cause client code to change. If this were two different methods, then a new source would not affect the sorting method. Only the client code would have to know the source of the numbers.

考虑一种从文件中读取数字列表并按排序顺序返回数字的方法。 现在,需求已更改,并且编号已存储在数据库中。 修改此方法以访问数据库将导致客户端代码更改。 如果这是两种不同的方法,那么新的来源将不会影响排序方法。 只有客户代码才需要知道数字的来源。

强大的凝聚力 (Strong Cohesion)

Inside a software component, code should be strongly connected. This is an indication that the code is correctly divided.

在软件组件内部,应牢固地连接代码。 这表明代码已正确划分。

If a component had two or more relatively disconnected parts, that may indicate that those parts should be in a different component, or on its own.

如果一个组件具有两个或多个相对断开的部分,则可能表明这些部分应位于不同的组件中,或单独存在。

松耦合 (Loose Coupling)

Between software components, there should be few connections. If two components are strongly coupled, it may indicate that they need to be one component, or that they need to be differently divided into more components.

在软件组件之间,应该很少有连接。 如果两个组件紧密耦合,则可能表明它们需要是一个组件,或者需要以不同的方式将它们分为更多的组件。

翻译自: https://www.freecodecamp.org/news/orthogonality-in-software-engineering/

软件测试中什么是正交实验法

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值