CPSC 103 Lecture Notes - Lecture 8: Domain Knowledge

77 views2 pages
Verified Note
10 Nov 2018
School
Course
Professor

Document Summary

In general, you should create a helper function whenever part of a function you are designing seems to be a well-defined subtask. You should create a helper function for the subtask and call the new helper function from your original function. The below rules will help you determine when you need to write a helper function, but always remember the overarching rule of "one task per function": reference: use a helper function at references to other non-primitive data definitions. When you"re at the template step of designing a function and see that the template you"ve copied has a call to another type"s template function, this is a very strong hint that you"ll need to design a helper function. For example, you may be designing a function that takes a list[student]. In the list[student] template, there would be a call to student"s template function since student is a user-defined type.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents