Software Engineering Struktogramme Dipl. Ing. Päd. Huwaldt
Strukturierter Entwurf Methoden für die implementationsnahe Beschreibung von Softwaresystemen. Zielstellung ist die Definition der Programmstruktur und des Programmablaufs. Weit verbreitete Techniken sind der Programmablaufplan und das Struktogramm. Grundidee: Bausteinprinzip. Jedes Programm wird nur aus drei Grundelementen (Sequenz, Alternative, Wiederholung) zusammengesetzt. Struktogramme Dipl. Ing. Päd. Huwaldt
Grundelemente (Text, Programmablaufplan, Struktogramm) Sequenz Führe erst A dann B dann C aus! A B C A B C A B Iteration Wiederhole A solange bis Bedingung B wahr ist! B A B C JA NEIN Wenn Bedingung B wahr ist, führe A aus. Sonst führe C aus. Alternative JA NEIN B A C A Struktogramme Dipl. Ing. Päd. Huwaldt
Sequenz (Folge von Anweisungen) Bildschirmausgabe B Bildschirmausgabe C Bildschirmausgabe D Als Programm function A() { printf (“B“); printf (“C“); printf (“D“); } Struktogramme Dipl. Ing. Päd. Huwaldt
Alternative if ( bedingung = wahr ) printf (“E“); else printf (“F“); Ja Nein Bildschirmausgabe E F Als Programm if ( bedingung = wahr ) printf (“E“); else printf (“F“); Struktogramme Dipl. Ing. Päd. Huwaldt
Alternative ohne „sonst“ (bedingte Ausführung) Bedingung Ja E if ( bedingung == wahr ) printf (“E“); Struktogramme Dipl. Ing. Päd. Huwaldt
Alternative Bedingung A=1 A=2 A=3 D E F G A=1 Ja Nein F A=2 Ja Nein E A=3 Ja Nein G D if ( A==1 ) printf (“E“); else if ( A==2 ) printf (“F“); else if ( A==3 ) printf (“F“); else printf (“F“); Struktogramme Dipl. Ing. Päd. Huwaldt
Wiederholung (Kopfgesteuert = Bedingung wird am Anfang geprüft) Anzahl <2 Bildschirmausgabe G Anzahl+1 Als Programm while ( anzahl < 2 ) { printf (“G“); anzahl=anzahl+1; } Struktogramme Dipl. Ing. Päd. Huwaldt
Wiederholung (Fußgesteuert = Bedingung wird am Ende geprüft) Anzahl <2 G Anzahl+1 do{ printf (“G“); anzahl=anzahl+1; }while ( anzahl < 2 ); Struktogramme Dipl. Ing. Päd. Huwaldt
Strukturen F E A B C G Bedingung Anzahl < 2 Struktogramme Dipl. Ing. Päd. Huwaldt
Strukturen kann man zusammensetzen B F E Bedingung G Anzahl < 2 Struktogramme Dipl. Ing. Päd. Huwaldt
Strukturen A Ja nein function A(int anzahl) { printf („A“); if ( bedingung = wahr ) print (“E“); else print (“F“); print (“B“); while ( anzahl < 2 ) { print (“G“); anzahl=anzahl+1; } } A B F E Bedingung G Anzahl < 2 Ja nein Struktogramme Dipl. Ing. Päd. Huwaldt
Strukturierte Programmierung in SiSy main init BS Aufbau Eingabeaufforderung Menüauswahl Ausleihe Rückgabe Statistik Stammdaten ende deinit 1 2 3 4 5 Mit F8 generiert Struktogramme Dipl. Ing. Päd. Huwaldt