Programming
Databases

Joern Ploennigs

Program Flow

Midjourney: Doves to Blocks, ref. M. C. Escher

Process¶

Program flow - Example¶

In [ ]:
x = 3                    # Assignment
y = 4                    # Assignment

def pythagoras(a, b):    # Storing the function
    return math.sqrt((a*2)+(b*2))  # Calculation

z = pythagoras(x, y)     # Function call, assign to z
print(z)                  # Variable output

Defining the Problem¶

  • The most important skill in programming is to translate a real-world problem into individual program instructions (i.e., operations on symbols).

  • First step: What are the inputs, what are the outputs of the current problem?

  • Not unlike how a function is defined!

    • Input parameters
    • Return value

Lecture Hall Question¶

What inputs and outputs are involved in calculating the volume of a rectangular prism (house)?

No description has been provided for this image

Example: Volume calculation of a rectangular prism (house)¶

  • Simplification: The house is rectangular and has a flat roof.

  • Inputs: Side lengths a and b, height h (in m)

  • Outputs: Volume in m³

  • First considerations:

    • What data types do these inputs and outputs have?
    • What different scenarios exist?

Breaking the Problem into Steps¶

  • The core question:

"How do we get from the given input to the desired output?"

  • Not Easy: To answer this question for arbitrary problems, one must adopt a way of thinking, break the problem into steps, and work through them.

  • Our Advantage: The ability to decompose and solve problems is a fundamental skill for engineers.

A Tool for Designing Algorithms¶

  • Also called 'flowcharts'
  • Describe sequences of operations
  • Can have the following elements, which are connected by arrows:

Oval

Program Flowcharts — Fundamentals¶

  • The most important blocks:
  • Statements do not need to be written in the syntax of a programming language – they can be pseudocode.

Instruction

  • Arrows originate from a branching point, indicating whether the condition evaluated to True or False (if/else).

If statement

Example: Christmas Shopping¶

Flowchart example

What is this used for in everyday life?¶

Process modeling

  • Geothermal process flows
  • IP management process optimization
  • Business processes
  • Quality assurance

Patents

  • Algorithmic descriptions

  • Process patents

  • Technical documentation

Lesson Learned¶

Midjourney: Dorian Gray

Lessons Learned - Flashcards¶

Flashcards
  • The question goes on the front of the flashcard, the answer on the back
  • The cards for Subject 1 are reviewed daily
  • The Subject 2 cards are reviewed every other day
  • The Subject 3 cards are reviewed once a week
  • and the Subject 4 cards are reviewed every 30 days

Questions?

programmierung
und datenbanken