Script Valley
Writing Clean Code: Naming, Functions & Structure
Why Naming Matters/Assessment

Practice & Assessment

Test your understanding of Why Naming Matters

Multiple Choice Questions

6
1

Which variable name best follows clean code naming principles?

2

What is the main problem with naming a function 'processData()'?

3

A constant storing the maximum number of login attempts should be named:

4

Which class name best communicates its responsibility?

5

What is a 'magic number' in code?

6

In Python, how should a function that checks if a user's account is active be named?

Coding Challenges

1
1

Rename the Messy Codebase

You are given a JavaScript file containing 10 functions and 15 variables with bad names (single letters, abbreviations, noise words, magic numbers). Your task: rename every identifier following clean code naming conventions. Input: the provided bad-names.js file. Output: clean-names.js where every name is intention-revealing, every constant uses SCREAMING_SNAKE_CASE, every boolean uses is/has/can prefix, and every function uses a clear verb-noun pattern. Constraint: do not change any logic — only names. Estimated time: 20 minutes.

Easy

Mini Project

1

Library Management System — Naming Audit

You are given a fully working but poorly named library management system with classes for books, members, and checkouts. The system has variables like 'b', 'mem', 'd', functions like 'process()', 'handle()', 'doThing()', and magic numbers like 14, 3, and 50 scattered through the logic. Your task: rename every identifier in the system using clean naming principles. Produce a before-and-after comparison document (a markdown file) that lists every renamed identifier, the old name, the new name, and one sentence explaining why the new name is better. The system must function identically after renaming. Difficulty: easy — the challenge is naming precision, not logic.

Easy