A blank file is the hardest part of a lot of programs. A skeleton removes it: a file that already has the shape of the solution, with the thinking left for you to do.
What a skeleton looks like
"""Ticket pricing — Unit 1.
Reads the customer's age, decides the price, prints it.
"""
# --- Input ---------------------------------------------------------
age = 0 # TODO: ask the customer's age and convert it
# --- Process -------------------------------------------------------
price = 0.0 # TODO: choose the price from the age
# --- Output --------------------------------------------------------
print() # TODO: print the price, to two decimalsNothing there solves the problem. What it gives you is the
input–process–output shape from Decomposition and Design, the names
worth using, and three places to stand. You fill the TODO lines in
order and run it after each one — a program that runs at every step is
a program whose failures stay small.
Where skeletons come from
- Given to you. Several tasks in this course start from one.
- The language’s own documentation. The examples in Python’s docs are skeletons: a working shape you adapt rather than copy blindly.
- Your editor’s snippets. Type
forand take the offered structure, then rename its variables to mean something. - Your own previous work. By December you will have a file that reads a data file, loops over it, and prints a summary. That file is your best skeleton, because you already understand every line of it.
Using one honestly
- Read the whole thing before typing. A skeleton you have not read is a maze.
- Rename the placeholders to your problem’s words.
valueandresultare what the author called them because they did not know your problem. - Delete what you do not need. An unused section is a lie about your program.
- Run it after each
TODOyou close. - Be able to explain every line that remains. This is the line between using a skeleton and copying an answer — and it is the line Our Classroom Norms holds you to.
Make your own, deliberately
When you finish a program you are pleased with, save a copy with the specifics stripped out and the structure left behind. That file, in a folder called
Skeletons, will save you a whole period in Unit 4.
Curriculum connection
B2.1
design programs from a program template or skeleton (e.g., teacher-supplied skeleton, Help facility code snippet);
Link to original
C3.2
work independently, using support documentation (e.g., IDE Help, tutorials, websites, user manuals), to design and write functioning computer programs;
Link to original