In Software Project Management we saw that every project estimate starts with one question: how big is the software? Effort, cost and schedule are all derived from size. Get the size wrong and every number that follows is wrong too.
The difficulty is that we need the size before the software exists. A house builder can measure a floor plan in square metres; a software team has only an SRS and some sketches. This chapter covers the two classic ways to measure software size: Lines of Code (LOC), which measures the program text, and Function Points (FP), which measures the functionality delivered to the user. We will do full worked examples of both, because both are popular in university exams.
Lines of Code (LOC)
Lines of Code (LOC) is a size measure equal to the number of source lines in a program, usually excluding blank lines and comment lines. Large sizes are written in KLOC (thousands of lines of code).
LOC is the oldest and most intuitive size measure. A 50 KLOC program is roughly ten times "bigger" than a 5 KLOC one, and historical data such as "our team produces about 600 LOC per person-month" can turn a size into an effort.
Counting rules matter
"Lines" sounds simple, but the same program can give very different counts depending on the rules. Look at this C++ fragment:
// find the maximum of an array
int maxOf(const int a[], int n) {
int best = a[0];
for (int i = 1; i < n; i++) {
if (a[i] > best) best = a[i];
}
return best;
}Physical lines (everything) : 9
Without the blank line : 8
Without blank and comment lines (NCLOC) : 7
Also skipping lines that hold only a "}" : 5So an organisation must fix one counting standard (most commonly: non-blank, non-comment physical lines, sometimes called NCLOC or SLOC) and use it consistently. Comparing LOC counts made with different rules is meaningless.
Advantages and disadvantages of LOC
| Advantages | Disadvantages |
|---|---|
| Easy to count automatically once code exists | Hard to estimate before coding, which is exactly when estimates are needed |
| Intuitive and widely understood | Language-dependent: the same feature takes far more lines in assembly than in Python |
| Lots of historical data and models (COCOMO) use it | Penalises good design: a clever 200-line solution looks "less productive" than a sloppy 600-line one |
| Directly related to the work of writing code | Ignores non-coding work (requirements, design, testing, documentation) |
| Depends on coding style and counting rules |
The productivity paradox is worth remembering: if productivity is measured in LOC per person-month, switching to a more powerful language makes the team look less productive, even though the product was delivered faster and cheaper. This is a major reason Function Points were invented.
LOC-Based Estimation
Even though LOC can only be counted after coding, it can be estimated before coding by breaking the system into modules and estimating each one, usually using experience from similar past modules.
Because each module estimate is uncertain, Pressman's approach takes three values per module and combines them with a weighted average (the same formula PERT uses, which we will meet again in Project Scheduling: Gantt Charts, PERT & CPM):
Expected size S = (Sopt + 4·Sm + Spess) / 6
where Sopt is the optimistic size, Sm the most likely size and Spess the pessimistic size. The most likely value gets four times the weight of the extremes.
Worked Example: Library Management System
A college library system is decomposed into five modules with the size estimates below (in LOC). Historical data says the team produces 620 LOC per person-month, and a person-month costs ₹80,000. Estimate the size, effort and cost.
| Module | Optimistic | Most likely | Pessimistic | Expected (o + 4m + p)/6 |
|---|---|---|---|---|
| User interface | 1800 | 2400 | 3600 | 2500.0 |
| Catalogue management | 3000 | 3800 | 5200 | 3900.0 |
| Circulation (issue/return) | 2500 | 3200 | 4500 | 3300.0 |
| Reports | 1200 | 1600 | 2600 | 1700.0 |
| Database layer | 2000 | 2500 | 3400 | 2566.7 |
| Total | 13,966.7 ≈ 13,967 LOC |
Check one row: User interface = (1800 + 4 × 2400 + 3600) / 6 = (1800 + 9600 + 3600) / 6 = 15000 / 6 = 2500.
Size ≈ 13,967 LOC ≈ 14 KLOC
Effort = 13,967 / 620 ≈ 22.5 person-months
Cost = 22.53 × ₹80,000 ≈ ₹18.0 lakh
Cost per LOC = 80,000 / 620 ≈ ₹129Notice that the pessimistic values are further from the most likely value than the optimistic ones. That is realistic: software rarely turns out much smaller than expected, but it often turns out much bigger, so the expected size is slightly above the most likely size.
Function Point Analysis (FPA)
In 1979, Allan Albrecht at IBM proposed measuring software by what it does for the user rather than by how many lines it took. A login screen is one unit of functionality whether it is written in COBOL or Java. This measure is the function point. Today it is maintained by the International Function Point Users Group (IFPUG) and standardised as ISO/IEC 20926.
A function point is a unit of software size based on the functionality the software provides to its users, counted from the logical design or requirements, independent of programming language and technology.
Because it is counted from requirements, FP can be estimated early, right after the SRS (see Software Requirements Specification (SRS)).
The Five Function Types
FPA looks at the system from the user's side of its boundary and counts five kinds of things. Two are about data, three are about transactions.
| Type | Full name | Meaning | Library example |
|---|---|---|---|
| ILF | Internal Logical File | A logical group of data maintained inside the system | Member records, Book records |
| EIF | External Interface File | A logical group of data the system only reads; it is maintained by another system | University student directory used to validate members |
| EI | External Input | Data or control coming in that maintains an ILF or changes behaviour | Add member, Issue book |
| EO | External Output | Data going out that involves calculation or derived data | Monthly fine report with totals |
| EQ | External Inquiry | An input-output pair that retrieves data with no derived data and no update | Search book by title |
The EO vs EQ distinction confuses many students. Ask: does the output contain something calculated? "Show book details" just fetches stored data, so it is an EQ. "Show total fine for this member" computes a sum, so it is an EO.
┌──────────── application boundary ───────────┐
User ── EI ────▶ │ │
User ◀── EO ──── │ ILF (maintained here) │ ──reads──▶ EIF
User ◀─EQ─▶ │ │ (owned by another app)
└──────────────────────────────────────────────┘Step 1: Rate the Complexity of Each Function
Each counted function is rated Low, Average or High using three ingredients:
DET (Data Element Type): a unique, user-recognisable field, such as "member name".
RET (Record Element Type): a user-recognisable subgroup of data inside an ILF/EIF.
FTR (File Type Referenced): an ILF or EIF read or maintained by a transaction.
The IFPUG matrices are:
ILF / EIF 1–19 DET 20–50 DET 51+ DET
1 RET Low Low Average
2–5 RET Low Average High
6+ RET Average High High
EI 1–4 DET 5–15 DET 16+ DET
0–1 FTR Low Low Average
2 FTR Low Average High
3+ FTR Average High High
EO / EQ 1–5 DET 6–19 DET 20+ DET
0–1 FTR Low Low Average
2–3 FTR Low Average High
4+ FTR Average High HighExample: the EI "Issue book" takes member ID, book ID, issue date, due date, staff ID and a confirm action (6 DETs) and references two files, Member and Loan (2 FTRs). Row "2 FTR", column "5–15 DET" gives Average.
Step 2: Unadjusted Function Points (UFP)
Multiply each count by its weight and add:
| Function type | Low | Average | High |
|---|---|---|---|
| EI | 3 | 4 | 6 |
| EO | 4 | 5 | 7 |
| EQ | 3 | 4 | 6 |
| ILF | 7 | 10 | 15 |
| EIF | 5 | 7 | 10 |
UFP = ∑ (count of each type at each complexity × its weight)
Notice that files carry the biggest weights. Designing, storing and maintaining a logical data group is more work than a single screen.
Step 3: Value Adjustment Factor (VAF)
The classic method then adjusts UFP for the general nature of the system using 14 General System Characteristics (GSCs), each rated from 0 (no influence) to 5 (strong influence):
| # | GSC | # | GSC |
|---|---|---|---|
| 1 | Data communications | 8 | Online update |
| 2 | Distributed data processing | 9 | Complex processing |
| 3 | Performance | 10 | Reusability |
| 4 | Heavily used configuration | 11 | Installation ease |
| 5 | Transaction rate | 12 | Operational ease |
| 6 | Online data entry | 13 | Multiple sites |
| 7 | End-user efficiency | 14 | Facilitate change |
VAF = 0.65 + 0.01 × ∑Fi (i = 1 to 14)
FP = UFP × VAF
Since each Fi is 0 to 5, ∑Fi ranges from 0 to 70, so VAF ranges from 0.65 to 1.35. The adjustment can change the size by at most ±35%.
A note on current practice: since version 4.3 of the IFPUG Counting Practices Manual, the VAF is optional, and the ISO standard size is the unadjusted count. Most university syllabi and exam questions still use the VAF formula, so learn both: if a question gives the 14 ratings, compute FP = UFP × VAF; if not, the UFP is the answer.
Worked Example 1: All Average Complexity
A system has 24 external inputs, 46 external outputs, 8 external inquiries, 4 internal logical files and 2 external interface files, all of average complexity. The sum of the 14 GSC ratings is 43. Compute the function points.
EI 24 × 4 = 96
EO 46 × 5 = 230
EQ 8 × 4 = 32
ILF 4 × 10 = 40
EIF 2 × 7 = 14
─────
UFP = 412
VAF = 0.65 + 0.01 × 43 = 1.08
FP = 412 × 1.08 = 444.96 ≈ 445Worked Example 2: The Library System
The library system's counted functions are below. The 14 GSCs are rated 3, 4, 2, 3, 3, 4, 2, 3, 3, 2, 1, 2, 3, 5. The team's historical productivity is 8 FP per person-month at ₹90,000 per person-month. Estimate FP, effort and cost.
| Type | Low | Average | High | Calculation | Total |
|---|---|---|---|---|---|
| EI | 3 | 2 | 1 | 3×3 + 2×4 + 1×6 | 23 |
| EO | 2 | 2 | 0 | 2×4 + 2×5 | 18 |
| EQ | 4 | 1 | 0 | 4×3 + 1×4 | 16 |
| ILF | 2 | 1 | 0 | 2×7 + 1×10 | 24 |
| EIF | 1 | 0 | 0 | 1×5 | 5 |
| UFP | 86 |
∑Fi = 3+4+2+3+3+4+2+3+3+2+1+2+3+5 = 40
VAF = 0.65 + 0.01 × 40 = 1.05
FP = 86 × 1.05 = 90.3
Effort = 90.3 / 8 ≈ 11.3 person-months
Cost = 11.29 × ₹90,000 ≈ ₹10.2 lakhNotice this is a different estimate from the LOC-based one earlier (22.5 person-months). That is normal: the two methods use different historical data and assumptions. In practice, managers compute estimates by two or more methods and investigate if they differ widely. A big gap usually means one of the inputs (module sizes, productivity rate, function counts) needs a second look.
LOC vs Function Points
| Aspect | LOC | Function Points |
|---|---|---|
| Measures | Program text (solution size) | User functionality (problem size) |
| Available | Accurately only after coding | From requirements / early design |
| Language dependence | Strongly dependent | Independent |
| Counting effort | Automatic with tools | Manual, needs trained counters |
| Subjectivity | Low once rules are fixed | Some (complexity ratings, GSCs) |
| Meaning to customer | Little | High: maps to features they asked for |
| Fits best | Algorithmic, system software | Business / data-processing applications |
| Used by | Basic and Intermediate COCOMO | Productivity benchmarks; can be converted to LOC for COCOMO II |
FP can be converted to an approximate LOC figure using average "LOC per FP" ratios for each language, a technique called backfiring. These ratios vary widely between organisations, so treat any converted figure as rough.
Other size measures you may hear about
COSMIC function points (ISO/IEC 19761): a newer functional size method that counts data movements; works better for real-time and embedded software.
Use case points: size derived from the number and complexity of use cases and actors.
Story points: a relative size used by Agile teams for backlog items. They are team-specific and not comparable between teams, so they are not a substitute for FP across projects.
Common Mistakes
Mixing up EO and EQ. Derived/calculated data → EO. Pure retrieval → EQ.
Counting an ILF as an EIF or vice versa. Ask who maintains the data. Maintained by this application → ILF; only referenced → EIF.
Wrong VAF constant. It is 0.65 + 0.01 × ∑Fi, not 0.65 + 0.1 × ∑Fi.
Using 4 GSCs or 15 GSCs. There are exactly 14, each rated 0–5.
Forgetting the weights differ for EI and EO. EI and EQ share 3/4/6; EO is 4/5/7.
Counting physical screens or database tables instead of logical functions and logical files.
Computing (o + m + p)/3 for three-point estimates; the standard formula is (o + 4m + p)/6.
Exam and Interview Questions
Q1. Compute FP: EI = 20 (simple), EO = 30 (average), EQ = 10 (complex), ILF = 5 (average), EIF = 3 (simple). ∑Fi = 35.
UFP = 20×3 + 30×5 + 10×6 + 5×10 + 3×5
= 60 + 150 + 60 + 50 + 15 = 335
VAF = 0.65 + 0.35 = 1.00
FP = 335Q2. What are the minimum and maximum values of the VAF? What does it mean?
Minimum 0.65 (all GSCs = 0), maximum 1.35 (all GSCs = 5). The general system characteristics can reduce or increase the unadjusted size by at most 35%.
Q3. If all 14 GSCs are rated "average" (3) and UFP = 200, what is the FP?
∑Fi = 42, VAF = 0.65 + 0.42 = 1.07, FP = 200 × 1.07 = 214.
Q4. Why is LOC considered a poor measure of programmer productivity?
It rewards verbosity and penalises high-level languages and good design. The same feature written in fewer lines (better language, reuse, cleaner design) looks like lower productivity, even though it cost less. It also ignores non-coding work.
Q5. A module's size estimates are 4,000 (optimistic), 5,500 (most likely) and 9,000 (pessimistic) LOC. Find the expected size.
(4000 + 4 × 5500 + 9000) / 6 = (4000 + 22000 + 9000) / 6 = 35000 / 6 ≈ 5,833 LOC.
Q6. "Generate a payslip showing gross pay, deductions and net pay" — EI, EO or EQ?
EO. Net pay and total deductions are calculated (derived data), so it is an external output, not an inquiry.
Summary
Size is the foundation of every estimate. Two classic measures: LOC (program text) and Function Points (user functionality).
LOC is easy to count but language-dependent, hard to know early, and penalises concise code.
LOC can be estimated per module with S = (Sopt + 4Sm + Spess)/6, then divided by historical productivity to get effort.
FPA counts EI, EO, EQ, ILF, EIF, rates each Low/Average/High using DETs, RETs and FTRs, and weights them (EI 3/4/6, EO 4/5/7, EQ 3/4/6, ILF 7/10/15, EIF 5/7/10) to get UFP.
VAF = 0.65 + 0.01∑Fi over 14 GSCs (range 0.65–1.35), FP = UFP × VAF. Current IFPUG practice treats the VAF as optional.
Use more than one estimation method and compare. Next, COCOMO Model turns size (in KLOC) into effort, duration and team size.