liveBook · Manning

Implementation

As explained in Get Programming: Learn to code with Python

An implementation is the concrete way a task or system is realized through its steps and actions.

An implementation is the concrete way an algorithm, task, or object behavior is realized through steps and actions. A useful workflow is think, code, test, debug, and repeat: understand the task, write a possible solution, compare actual results with expected results, fix incorrect behavior, and continue until the tests pass. section 2.3

Keep the task separate from its implementation when planning a program:

  • Treat a large task as smaller black-box tasks. Focus first on each task’s purpose, inputs, and outputs rather than its internal steps. section 20.1
  • Make each task a repeatable sequence of actions with clearly documented inputs and outputs. section 20.1
  • Hide unnecessary implementation details so users can understand and use a behavior without knowing how it works internally. section 20.1 section 32.1

Implementing a stack

A stack can first be simulated with a list: add items at the end and remove items from the end. A Stack class turns those rules into methods such as add_one, remove_one, size, and prettyprint. The list becomes an internal data attribute, while users work with the stack’s behaviors instead of managing the list directly. section 32.1

Figure 2.3. This is the ideal way to approach solving a problem with programming. Understand the problem before you write any code. Then test the code that you write and debug it as necessary. This process repeats until your code passes all tests.

Follow the repeated implementation cycle from understanding the problem through testing and debugging until the program passes its tests. section 2.3

How Get Programming: Learn to code with Python covers it

How deep it goes
Explains implementation as steps, inputs, outputs, abstraction, and object methods, but stops short of detailed algorithm internals.
Examples
Uses baking recipes, online-ordering subtasks, warehouse retrieval, and a pancake stack represented by a list and class.
What it assumes
Assumes basic programming tasks and algorithms while teaching task analysis, black-box thinking, and object representation.
What you can do after
Build implementations by decomposing tasks, defining interfaces, writing code, testing outputs, and debugging incorrect behavior.
How it connects
Connects implementation with algorithms, testing, debugging, black boxes, classes, data attributes, and methods.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Get Programming: Learn to code with Python. The section links point to the parts of the book it draws on.