miscon:programming.functions.base-case-not-needed · draft · trust low · v0.1.2 · kind misapplied-analogy
A recursive function stops by itself
A recursive function stops calling itself when there is nothing left to do, so it does not need an explicit base case.
- Stable URI
- https://open-misconceptions.github.io/miscon-data/m/programming.functions.base-case-not-needed
- UUID
09dac977-0121-45e8-8a5c-0aa059faf59c- Domain
programming.functions- Level band
- middle, secondary, undergraduate
- Locale
- en
- About
- https://open-misconceptions.github.io/miscon-data/c/programming.functions.base-case (Miscon)
Evidence patterns
Pattern 0: predict the behaviour of a recursive function with no base case
predicts termination with a sensible answer
def count_down(n):
print(n)
count_down(n - 1)
count_down(3)3 2 1 0 -1 ... until the recursion limit is hit3 2 1Pattern 1: write a recursive function
omits the base case
Write factorial(n) recursively.if n == 0: return 1
return n * factorial(n - 1)return n * factorial(n - 1)Discriminators
vs a slip. A slip is one forgotten base case the learner adds when asked how it stops. The belief is the answer 'it stops when n runs out'.
vs programming.functions.recursion-as-loop. Loop-model holders often include a base case but expect only one copy of the variables; base-case omitters expect the function to stop on its own.
Relations
conflicts_with- A recursive function stops only when a base case returns (external)
resolved_by- A recursive function stops only when a base case returns (external)
Each recursive call has its own activation with its own variables (external) confusable_withprogramming.functions.recursion-as-loop
Alignments
- progmiscon Scratch/BaseCaseNotNeeded (close-match)
Provenance
Origin: llm-drafted
- Chiodini, L., Moreno Santos, I., Gallidabino, A., Tafliovich, A., Santos, A. L., & Hauswirth, M. (2021). A curated inventory of programming language misconceptions. In Proceedings of the 26th ACM Conference on Innovation and Technology in Computer Science Education (ITiCSE '21), 380-386. doi:10.1145/3430665.3456343
Inventory consulted for the misconception name and scope only; progmiscon publishes no licence for its text, so Open Misconceptions' statements and examples are written independently. - Kahney, H. (1983). What do novice programmers know about recursion? In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems (CHI '83), 235-239. doi:10.1145/800045.801618
- Götschi, T., Sanders, I., & Galpin, V. (2003). Mental models of recursion. In Proceedings of the 34th SIGCSE Technical Symposium on Computer Science Education (SIGCSE '03), 346-350. doi:10.1145/611892.612004
Drafted from the cited literature for the Open Misconceptions seed pack; statement, examples and discriminators are original text. Awaiting maintainer review.
Review status
Status draft, trust low (computed from the reviews below against the reviewer registry).
No reviews yet.
Formats
- Raw JSON
- CASE 1.1 package (CFItem
09dac977-0121-45e8-8a5c-0aa059faf59c) - Source on GitHub
Cite
miscon:programming.functions.base-case-not-needed
https://open-misconceptions.github.io/miscon-data/m/programming.functions.base-case-not-needed