Convert IPLAN to Python

This is a guide to converting an IPLAN program into the equivalent Python code.
The steps here should serve as the outline only.
  1. 1

    Document existing program

    You must understand 100% of what the IPLAN program does. That means you need to read and document the
    • Variables
    • Inputs
    • Outputs
    • Expectations of the input saved case
    • How the output saved case is changed
    • Any caveats or things to watch out for
    This should be a written document somewhere and will be good to refer to again later by other engineers.
  2. 2

    Test the existing program

    Write unit tests for the existing program with a variety of input cases.

    It will be impossible to truly "unit test" the program. In fact your tests will be "system tests" but that shouldn't stop you comparing the state of the case before and after having run the IPLAN code automatically.

    Later on we'll compare our Python program against the same tests to prove that they are 
  3. 3

    Translate the IPLAN paragraph by paragraph

    Move through the IPLAN code, line by line and make a translation as best you can into the equivalent Python code. 

    Don't worry if your code looks like IPLAN written in Python, because it essentially is.

    You should be able to run those same tests earlier and confirm that the Python code is equivalent to the IPLAN code.
  4. 4

    Taking it a step further, maintaining the code

    The reason you wanted to migrate in the first place was to have code in a format that new engineers could read and understand, and possible extend for themselves.

    Depending on the quality of the code you wrote, you could leave it here. But extending in the future is likely to be difficult. Because you have no true "unit tests". You only know if the program works end to end, but no where within the program that errors can occur.

    You should work through the Python version of the program and find repetitive tasks that can be pulled out and grouped into functions. Then test each function in isolation using a true unit test.