Material download: github.com/krother/talks
Dr. Kristian Rother
www.academis.eu
Proteins are tiny molecular machines that do all kinds of things in living cells. For example, antibodies, digestive enzymes and spider silk are all made of protein.
Proteins are chains made of 20 chemical building blocks, which is why we can easily represent and analyze them as strings.
In [2]:
data = [1, 2, 3, 4
In [3]:
data = 1, 2, 3, 4]
more elegant alternatives to print():
| function | purpose |
|---|---|
dir(x) |
examine local namespace |
locals(x) |
examine local namespace |
globals(x) |
examine global namespace |
help(x) |
access help interactively |
type(x) |
examine object type |
isinstance(x, cl) |
examine object type |
issubclass(cl1, cl2) |
examine class hierarchy |
Rubber Duck by Florentijn Hofman in Hong Kong, CC-BY-SA 3.0
Also see: https://en.wikipedia.org/wiki/Rubber_duck_debugging
In [ ]:
import pdb
pdb.set_trace()
The control mechanism of the lock of a vault for nuclear waste has been designed for safe operation. It makes sure that it is only possible to access the vault, if the radiation shields are in place or the radiation level in the vault is below a threshold (DANGER_LEVEL). That means:
The code below controls the door lock. Note that the safe state is that no entry is possible. Develop an argument for safety that shows that the code is potentially unsafe.
(adopted from I.Sommerville, Software Engineering, 9th edition)
Trivia: Code reviews are seen as superior to automated testing when engineering safety-critical software.
Review the following (fictional!) code for a nuclear vault door:
entry_code = lock.get_entry_code()
if entry_code == lock.authorised_code:
shield_status = shield.get_status()
radiation_level = rad_sensor.get()
if radiation_level < DANGER_LEVEL:
state = SAFE
else:
state = UNSAFE
if shield_status == shield.in_place():
state = SAFE
if state == SAFE:
door.locked = False
door.unlock()
else:
door.lock()
door.locked = True
(code adopted from I.Sommerville, Software Engineering, 9th edition)
In [ ]: