Learn to Estimate

本文探讨了软件估算的重要性,并区分了估算、目标与承诺的概念。指出许多开发者和管理者往往混淆这些概念,导致项目管理出现偏差。文章强调了正确的估算对于合理制定项目计划及目标至关重要。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Learn to Estimate

Giovanni Asproni

AS A PROGRAMMER, you need to be able to provide estimates to your man- agers, colleagues, and users for the tasks you need to perform, so that they will have a reasonably accurate idea of the time, costs, technology, and other resources needed to achieve their goals.
To be able to estimate well, it is obviously important to learn some estimation techniques. First of all, however, it is fundamental to learn what estimates are, and what they should be used for—as strange as it may seem, many developers and managers don’t really know this.
The following exchange between a project manager and a programmer is not atypical:
Project Manager: Can you give me an estimate of the time necessary to develop feature xyz?
Programmer: One month.
Project Manager: That’s far too long! We’ve only got one week. Programmer: I need at least three.
Project Manager: I can give you two at most.
Programmer: Deal!
The programmer, at the end, comes up with an “estimate” that matches what is acceptable for the manager. But since it is seen to be the programmer’s esti- mate, the manager will hold the programmer accountable to it. To understand what is wrong with this conversation, we need three definitions—estimate, target, and commitment:
100 97 Things Every Programmer Should Know

• An estimate is an approximate calculation or judgment of the value, number, quantity, or extent of something. This definition implies that an estimate is a factual measure based on hard data and previous experience—hopes and wishes must be ignored when calculating it. The definition also implies that, being approximate, an estimate cannot be precise, e.g., a development task cannot be estimated to last 234.14 days.
• A target is a statement of a desirable business objective, e.g., “The system must support at least 400 concurrent users.”
• A commitment is a promise to deliver specified functionality at a certain level of quality by a certain date or event. One example could be “The search functionality will be available in the next release of the product.”
Estimates, targets, and commitments are independent from one another, but targets and commitments should be based on sound estimates. As Steve McConnell notes, “The primary purpose of software estimation is not to pre- dict a project’s outcome; it is to determine whether a project’s targets are real- istic enough to allow the project to be controlled to meet them.” Thus, the purpose of estimation is to make proper project management and planning possible, allowing the project stakeholders to make commitments based on realistic targets.
What the manager in the preceding conversation was really asking the pro- grammer was to make a commitment based on an unstated target that the manager had in mind, not to provide an estimate. The next time you are asked to provide an estimate, make sure everybody involved knows what they are talking about, and your projects will have a better chance of succeeding. Now it’s time to learn some techniques….

### 使用NumPy、SciPy、scikit-learn和PyWavelets进行科学计算 #### NumPy的基础操作 NumPy是一个用于处理数组的强大库,提供了大量的函数来支持多维数组对象的操作。 ```python import numpy as np # 创建一维数组 arr = np.array([1, 2, 3]) # 数组运算 result_addition = arr + 5 # 对每个元素加5 matrix_multiplication = np.dot(np.array([[1, 2], [3, 4]]), np.array([[2, 0], [1, 2]])) # 矩阵乘法 ``` 这些基础操作使得数据预处理变得非常方便[^1]。 #### SciPy的应用场景 SciPy建立在NumPy之上,扩展了许多高级功能,特别是针对数值积分、优化等问题提供了解决方案。 ```python from scipy import integrate def integrand(x): return x ** 2 integral_result, error_estimate = integrate.quad(integrand, 0, 1) # 计算定积分 print(f"The integral of x^2 from 0 to 1 is approximately {integral_result} with an estimated error of {error_estimate}") ``` 此例子展示了如何利用`integrate.quad()`来进行简单的数值积分计算。 #### scikit-learn的机器学习应用 对于想要快速实现监督学习算法的人来说,scikit-learn是非常理想的选择。下面给出一个线性回归模型的例子: ```python from sklearn.model_selection import train_test_split from sklearn.linear_model import LinearRegression from sklearn.datasets import make_regression X, y = make_regression(n_samples=100, n_features=1, noise=0.1) # 划分训练集测试集 X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2) model = LinearRegression() model.fit(X_train, y_train) predictions = model.predict(X_test) ``` 这段代码说明了怎样通过划分数据集并拟合一个基本的线性回归模型来预测新样本的结果[^2]。 #### PyWavelets的小波变换分析 最后,在信号处理领域内,PyWavelets可以用来执行连续小波变换(CWT),离散小波变换(DWT)等任务。 ```python import pywt data = [i % 4 for i in range(8)] # 构造一些模拟的数据点 coeffs = pywt.wavedec(data, 'db1') # 应用Daubechies wavelet (D4) 进行分解 reconstructed_data = pywt.waverec(coeffs, 'db1') print("Original:", data) print("Reconstructed:", reconstructed_data[:len(data)]) ``` 上述程序片段显示了使用默认设置下的小波系数解码过程。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值