diff --git a/content/de/1-5-Decomposition.md b/content/de/1-5-Decomposition.md index ab09c19..d1cc4df 100644 --- a/content/de/1-5-Decomposition.md +++ b/content/de/1-5-Decomposition.md @@ -1,3 +1,3 @@ -## 1.5. Декомпозиция и разделение ответственности +## 1.5. Dekomposition und _Separation of Concerns_ No translation diff --git a/content/de/2-1-Identifiers.md b/content/de/2-1-Identifiers.md new file mode 100644 index 0000000..e35b0c6 --- /dev/null +++ b/content/de/2-1-Identifiers.md @@ -0,0 +1,38 @@ +## 2.1. Wert, Bezeichner, Variable und Konstante, Literal, Zuweisung + +```js +const INTERVAL = 500; +let counter = 0; +const MAX_VALUE = 10; +let timer = null; + +const event = () => { + if (counter === MAX_VALUE) { + console.log('Das Ende'); + clearInterval(timer); + return; + } + console.dir({ counter, date: new Date() }); + counter++; +}; + +console.log('Beginn'); +timer = setInterval(event, INTERVAL); +``` + +```js +// Konstanten + +const SALUTATION = 'Ave'; + +const COLORS = [ + /* 0 */ 'schwarz', + /* 1 */ 'rot', + /* 2 */ 'grün', + /* 3 */ 'gelb', + /* 4 */ 'blau', + /* 5 */ 'magenta', + /* 6 */ 'cyan', + /* 7 */ 'weiß', +]; +``` diff --git a/content/de/2-2-Types.md b/content/de/2-2-Types.md new file mode 100644 index 0000000..4428c02 --- /dev/null +++ b/content/de/2-2-Types.md @@ -0,0 +1,42 @@ +## 2.2. Datentypen: skalare, Referenz- und strukturierte Typen + +> Typ — eine Menge von Werten und Operationen, die auf diesen Werten ausgeführt werden können. + +Zum Beispiel nimmt der `Boolean`-Typ in `JavaScript` zwei Werte `true` und `false` an und logische Operationen darauf, der `Null`-Typ nimmt einen `null`-Wert an, und der `Number`-Typ ist eine Menge rationaler Zahlen mit zusätzlichen Einschränkungen für Mindest- und Maximalwerte sowie Einschränkungen für Präzision und mathematische Operationen `+ - * ** / % ++ -- > < >= <= & | ~ ^ << >>`. + +> Datentypen + +```js +const values = [5, 'Kiew', true, { size: 10 }, (a) => ++a]; + +const types = values.map((x) => typeof x); +console.log({ types }); +``` + +> Skalar (Primitiv, Atomarer Wert) — der Wert des primitiven Datentyps. + +Der Skalar wird bei der Zuweisung kopiert und an die Funktion als Wert übergeben. + +> Referenz zeigt auf einen Wert eines Referenztyps, d.h. nicht auf einen Skalarwert. + +Für `JavaScript` sind dies die Untertypen: `Object`, `Function`, `Array`. + +> Strukturierte Typen (Zusammengesetzte Typen) — zusammengesetzte Typen oder Strukturen, die aus mehreren Skalarwerten bestehen. + +Skalarwerte werden so zu einem kombiniert, dass eine Reihe von Operationen auf diesem kombinierten Wert ausgeführt werden können. Zum Beispiel: Objekt, Array, Set, Tupel. + +> Aufzählungstyp + +> Flag — ein boolescher Wert, der den Zustand von etwas bestimmt. + +Zum Beispiel: Status einer geschlossenen Verbindung, Status der Beendigung einer Suche über eine Datenstruktur usw. + +```js +let flagName = false; +``` + +Manchmal können Flags nicht als logische, sondern als Aufzählungstypen bezeichnet werden. + +> String — eine Zeichenfolge + +In den meisten Sprachen kann auf jedes Zeichen über die Array-Zugriffssyntax zugegriffen werden, wie z.B. eckige Klammern. diff --git a/content/de/2-3-Blocks.md b/content/de/2-3-Blocks.md new file mode 100644 index 0000000..4a06fff --- /dev/null +++ b/content/de/2-3-Blocks.md @@ -0,0 +1,15 @@ +## 2.3. Operator und Ausdruck, Codeblock, Funktion, Schleife, Bedingung + +```js +(len - 1) * f(x, INTERVAL); +``` + +```js +const MAX_VALUE = 10; + +console.log('Beginn'); +for (let i = 0; i < MAX_VALUE; i++) { + console.dir({ i, date: new Date() }); +} +console.log('Das Ende'); +``` diff --git a/content/de/2-4-Context.md b/content/de/2-4-Context.md new file mode 100644 index 0000000..545aa09 --- /dev/null +++ b/content/de/2-4-Context.md @@ -0,0 +1,33 @@ +## 2.4. Kontexte und lexikalischer Scope + +> Scope + +```js +const level = 1; + +const f = () => { + const level = 2; + { + const level = 3; + console.log(level); // 3 + } + console.log(level); // 2 +}; +``` + +```py +level = 1 + +def f(): + level = 2 + if level == 2: + level = 3 + print(level) // 3 + print(level) // 3 + +f() +``` + +> Lexikalisches Umfeld + +> Globaler Kontext diff --git a/content/de/2-5-Procedure.md b/content/de/2-5-Procedure.md new file mode 100644 index 0000000..7e06bc5 --- /dev/null +++ b/content/de/2-5-Procedure.md @@ -0,0 +1,31 @@ +## 2.5. Prozedurales Paradigma, Aufruf, Stack und Heap + +```js +const colorer = (s, color) => `\x1b[3${color}m${s}\x1b[0m`; + +const colorize = (name) => { + let res = ''; + const letters = name.split(''); + let color = 0; + for (const letter of letters) { + res += colorer(letter, color++); + if (color > COLORS.length) color = 0; + } + return res; +}; + +const greetings = (name) => + name.includes('Augustus') + ? `${SALUTATION}, ${colorize(name)}!` + : `Hello, ${name}!`; +``` + +> Verwendung + +```js +const fullName = 'Marcus Aurelius Antoninus Augustus'; +console.log(greetings(fullName)); + +const shortName = 'Marcus Aurelius'; +console.log(greetings(shortName)); +``` diff --git a/content/de/2-6-Function.md b/content/de/2-6-Function.md new file mode 100644 index 0000000..d594e3b --- /dev/null +++ b/content/de/2-6-Function.md @@ -0,0 +1,118 @@ +## 2.6. Höhere Funktionen, reine Funktionen, Seiteneffekte + +Funktionsdeklaration (Function definition) — in `JavaScript` ist dies eine Art der Funktionsdeklaration, die von überall im lexikalischen Kontext sichtbar ist, in dem die Funktion deklariert ist, Beispiel: + +```js +function sum(a, b) { + return a + b; +} +``` + +Funktionsausdruck (Function expression) — Verknüpfung einer Funktion mit einem Bezeichner durch Zuweisung, wobei der Wert über den Bezeichner nicht im gesamten lexikalischen Kontext verfügbar ist, sondern nur nach der Zuweisungsstelle. Hat mehrere syntaktische Varianten: + +Funktionsausdruck mit benannter Funktion (Named function expression): + +```js +const sum = function sum(a, b) { + return a + b; +}; +``` + +Anonymer Funktionsausdruck (Anonymous function expression): + +```js +const sum = function (a, b) { + return a + b; +}; +``` + +Pfeil- oder Lambda-Funktion (Arrow, Lambda function): + +```js +const sum = (a, b) => { + return a + b; +}; +``` + +Lambda-Ausdruck, Pfeilfunktion mit Ausdruck als Körper (Lambda expression, Arrow function): + +```js +const sum = (a, b) => a + b; +``` + +> Reine Funktion (Pure Function) — deterministische Funktion ohne Seiteneffekte. + +Eine reine Funktion ist eine Funktion, die das Ergebnis nur auf der Grundlage der Argumente berechnet, keinen Zustand hat und nicht auf Eingabe-Ausgabe-Operationen zugreift. Das Ergebnis einer solchen Funktion ist immer deterministisch und ohne Seiteneffekte (siehe Seiteneffekt). + +> Closure (Closure) — Funktion, die mit dem lexikalischen Umfeld zum Zeitpunkt ihrer Erstellung verknüpft ist. + +Wenn eine Funktion `g` aus einer Funktion `f` zurückgegeben wird, wird `g` den Kontext der Funktion `f` sehen, ebenso wie ihre eigenen Argumente. Wenn `f` `g` zurückgibt, sagt man, dass die Instanz `g` den Kontext `f` geschlossen hat. Ein Closure ist eine Möglichkeit, eine Funktion mit einem Kontext (mit Daten oder Kontextvariablen) zu verknüpfen. Ein Closure ermöglicht es, einen Effekt zu erzeugen, der dem Zustand eines Objekts (der Menge seiner Eigenschaften) in der OOP ähnelt. Eigenschaften sind mit Methoden über das Objekt verknüpft, im Wesentlichen ist das Objekt in der OOP selbst der Verknüpfungskontext. Ein Closure erzeugt ebenfalls einen ähnlichen Kontext, aber auf der Grundlage von Funktionen erster Klasse und lexikalischem Kontext, nicht objektbasiert. + +Mit Hilfe von Closures kann funktionale Vererbung implementiert werden. + +Beispiele: + +```js +const sum = (a) => (b) => a + b; + +const hash = + (data = {}) => + (key, value) => ((data[key] = value), data); +``` + +> Superposition (Superposition) — Kombination von Funktionsaufrufen in Ausdrücken so, dass das Ergebnis einiger Funktionen zu Argumenten anderer Funktionen wird. + +```js +const expr2 = sum( + pow(mul(5, 8), 2), + div(inc(sqrt(20)), log(2, 7)) +); +``` + +> Komposition (Composition) — Erstellung einer neuen Funktion durch Kombination einfacherer. + +```js +const compose = (f1, f2) => (x) => f2(f1(x)); +``` + +```js +// prettier-ignore +const compose = (...funcs) => (...args) => + funcs.reduce((args, fn) => [fn(...args)], args); +``` + +> Partielle Anwendung (Partial application) + +```js +// prettier-ignore +const partial = (fn, x) => (...args) => fn(x, ...args); +``` + +> Currying (Currying) + +```js +const result = curry((a, b, c) => a + b + c)(1, 2)(3); +``` + +> Seiteneffekte (Side effects) + +> Funktion höherer Ordnung (Higher-order Function) + +1. Wenn eine Funktion als Argument an eine andere Funktion übergeben wird, ist es ein Callback. +2. Wenn eine Funktion als Ergebnis zurückgegeben wird, ist es eine Funktionsfabrik auf Closures. +3. Wenn die zurückgegebene Funktion dieselbe Semantik hat wie die in den Argumenten erhaltene, aber mit zusätzlichem (erweitertem) Verhalten, ist es eine Wrapper-Funktion. +4. Es kommt selten vor, dass die zurückgegebene Funktion nicht mit der Funktion aus den Argumenten verknüpft ist oder nicht direkt verknüpft ist und auch eine andere Semantik hat und keine Wrapper-Funktion ist. +5. Wenn am Ausgang eine Klasse oder Konstruktorfunktion steht, sind es Fabriken für Klassen und Prototypen. + +> Wrapper-Funktion (Wrapper) + +Eine Funktion, die eine andere Funktion (manchmal ein Objekt, Interface oder funktionales Objekt) umhüllt und ihr zusätzliches Verhalten hinzufügt. Man kann eine ganze API-Schnittstelle und sogar eine asynchrone Funktion zusammen mit Callbacks umhüllen (wenn der Vertrag bekannt ist). + +```js +const sum = (a, b) => a + b; + +console.log(`Add nums: ${sum(5, 2)}`); +console.log(`Add float: ${sum(5.1, 2.3)}`); +console.log(`Concatenate: ${sum('5', '2')}`); +console.log(`Subtraction: ${sum(5, -2)}`); +``` diff --git a/content/de/2-7-Closure.md b/content/de/2-7-Closure.md new file mode 100644 index 0000000..e39f28f --- /dev/null +++ b/content/de/2-7-Closure.md @@ -0,0 +1,315 @@ +## 2.7. Closures, Callbacks, Wrapper und Events + +> Closure + +```js +const add = (x) => (y) => { + const z = x + y; + console.log(`${x} + ${y} = ${z}`); + return z; +}; +``` + +```js +const res = add(3)(6); +console.log(res); +``` + +```js +const add = (x) => (y) => x + y; +``` + +> Rekursives Closure + +```js +const add = (x) => (y) => { + const z = x + y; + console.log(`${x} + ${y} = ${z}`); + return add(z); +}; +``` + +```js +const add = (x) => (y) => add(x + y); +``` + +```js +const a1 = add(5); +const a2 = a1(2); +const a3 = a2(3); +const a4 = a1(1); +const a5 = a2(10); +console.log(a1, a2, a3, a4, a5); +``` + +> Funktionsverkettung + +```js +const res = add(5)(2)(3)(7); +console.log(res); +``` + +> Abstraktion (Klassenersatz) + +```js +const COLORS = { + warning: '\x1b[1;33m', + error: '\x1b[0;31m', + info: '\x1b[1;37m', +}; + +const logger = (kind) => { + const color = COLORS[kind] || COLORS.info; + return (s) => { + const date = new Date().toISOString(); + console.log(color + date + '\t' + s); + }; +}; +``` + +```js +const warning = logger('warning'); +const error = logger('error'); +const debug = logger('debug'); +const slow = logger('slow'); + +slow('Ich bin ein langsamer Logger'); +warning('Hallo'); +error('Welt'); +debug('Auf Wiedersehen!'); +``` + +> Objektmethodenverkettung + +```js +const adder = (a) => { + const value = () => a; + const add = (b) => adder(a + b); + return { add, value }; +}; +``` + +```js +const v = adder(3).add(-9).add(12).value(); +console.log(v); +``` + +> Alternative Syntax + +```js +const adder = (a) => ({ + value() { + return a; + }, + add(b) { + a += b; + return this; + }, +}); +``` + +```js +const v = adder(3).add(-9).add(12).value(); +console.log(v); +``` + +> Alternative Syntax + +```js +const adder = (a) => ({ + value: () => a, + add: (b) => adder(a + b), +}); +``` + +```js +const v = adder(3).add(-9).add(12).value(); +console.log(v); +``` + +> Komplexes Beispiel + +```js +const adder = (a) => { + let onZerro = null; + const obj = {}; + const value = () => a; + const add = (b) => { + let x = a + b; + if (x < 0) { + x = 0; + if (onZerro) onZerro(); + } + return adder(x); + }; + const on = (name, callback) => { + if (name === 'zero') onZerro = callback; + return obj; + }; + return Object.assign(obj, { add, value, on }); +}; +``` + +```js +const a = adder(3) + .on('zero', () => console.log('Less than zero')) + .add(-9) + .add(12) + .add(5) + .value(); + +console.log(a); +``` + +> Callback + +```js +// Normale Rückgabe des Ergebnisses +const sum = (a, b) => a + b; + +// Rückgabe des Ergebnisses an eine Callback-Funktion +const sum = (a, b, callback) => callback(a + b); +``` + +```js +console.log('sum(5, 2) =', sum(5, 2)); +sum(5, 2, console.log.bind(null, 'sum(5, 2) =')); +``` + +```js +const fs = require('fs'); + +const reader = (err, data) => { + console.log({ lines: data.split('\n').length }); +}; + +fs.readFile('./file.txt', 'utf8', reader); +``` + +> Benannte Callbacks + +```js +const fs = require('fs'); + +const print = (fileName, err, data) => { + console.log({ lines: data.split('\n').length }); +}; + +const fileName = './file.txt'; +const callback = print.bind(null, fileName); +fs.readFile(fileName, 'utf8', callback); +``` + +> Timer-Implementierung mit Callback + +```js +const fn = () => { + console.log('Callback from from timer'); +}; + +const timeout = (interval, fn) => { + setTimeout(fn, interval); +}; + +timeout(5000, fn); +``` + +> Timer-Curry + +```js +const curry = (fn, ...par) => { + const curried = (...args) => { + if (fn.length <= args.length) return fn(...args); + return curry(fn.bind(null, ...args)); + }; + return par.length ? curried(...par) : curried; +}; +``` + +```js +const fn = () => { + console.log('Callback from from timer'); +}; + +const timeout = (interval, fn) => { + setTimeout(fn, interval); +}; + +const timer = curry(timeout); +timer(2000)(fn); + +const timer2s = timer(2000); +timer2s(fn); +``` + +> Iterations-Callbacks + +```js +const iterate = (array, listener) => { + for (const item of array) { + listener(item); + } +}; + +const cities = ['Kiew', 'London', 'Peking']; + +const print = (city) => { + console.log('City:', city); +}; + +iterate(cities, print); +``` + +> Events + +```js +const adder = (initial) => { + let value = initial; + const add = (delta) => { + value += delta; + if (value >= add.maxValue) add.maxEvent(value); + return add; + }; + add.max = (max, event) => { + add.maxValue = max; + add.maxEvent = event; + return add; + }; + return add; +}; +``` + +```js +const maxReached = (value) => { + console.log('max value reached, value: ' + value); +}; + +const a1 = adder(10).max(100, maxReached)(-12); + +a1(25); +a1(50); +a1(75); +a1(100); +a1(-200)(50)(30); +``` + +> EventEmitter + +```js +const { EventEmitter } = require('events'); + +const emitter = new EventEmitter(); + +emitter.on('new city', (city) => { + console.log('Emitted city:', city); +}); + +emitter.on('data', (array) => { + console.log(array.reduce((a, b) => a + b)); +}); + +emitter.emit('new city', 'Delhi'); +emitter.emit('new city', 'Berlin'); +emitter.emit('new city', 'Tokyo'); +emitter.emit('data', [5, 10, 7, -3]); +``` diff --git a/content/de/2-8-Errors.md b/content/de/2-8-Errors.md new file mode 100644 index 0000000..5ea8a22 --- /dev/null +++ b/content/de/2-8-Errors.md @@ -0,0 +1,145 @@ +## 2.8. Ausnahmen und Fehlerbehandlung + +> Debugging (Debug) — Prozess der Erkennung und Beseitigung von Fehlern in Software. + +Debugging wird durch Ausgabe von Nachrichten oder Tools implementiert: Debugger, Profiler, Dekompiler, Systeme zur Überwachung von Ressourcen und Protokollierung, Systeme für kontinuierliche Integration und Tests. + +„Debugging ist doppelt so schwer wie das Schreiben von Code. Wenn Sie also Code so klug schreiben, wie Sie können, sind Sie per Definition nicht klug genug, um ihn zu debuggen." // Brian Kernighan + +„Wenn Debugging der Prozess des Entfernens von Fehlern ist, dann muss Programmierung der Prozess des Einbringens von Fehlern sein" // Edsger Dijkstra + +> Throw + +```js +const isNumber = (value) => typeof value === 'number'; + +const sum = (a, b) => { + if (isNumber(a) && isNumber(b)) { + return a + b; + } + throw new Error('a and b should be numbers'); +}; +``` + +```js +try { + console.log(sum(2, 3)); +} catch (err) { + console.log(err.message); +} +``` + +```js +try { + console.log(sum(7, 'A')); +} catch (err) { + console.log(err.message); +} +``` + +> Rückgabe von Tupel oder Struktur + +```js +const sum = (a, b) => { + if (isNumber(a) && isNumber(b)) { + return [null, a + b]; + } + return [new Error('a and b should be numbers')]; +}; + +console.log(sum(2, 3)); + +console.log(sum(7, 'A')); +``` + +> Callback + +```js +const sum = (a, b, callback) => { + if (isNumber(a) && isNumber(b)) { + callback(null, a + b); + } else { + callback(new Error('a and b should be numbers')); + } +}; +``` + +```js +sum(2, 3, (err, result) => { + if (err) { + console.log(err.message); + return; + } + console.log(result); +}); +``` + +```js +sum(7, 'A', (err, result) => { + if (err) { + console.log(err.message); + return; + } + console.log(result); +}); +``` + +> Promise + +```js +const sum = (a, b) => + new Promise((resolve, reject) => { + if (isNumber(a) && isNumber(b)) { + resolve(a + b); + } else { + reject(new Error('a and b should be numbers')); + } + }); +``` + +```js +sum(2, 3) + .then((data) => { + console.log(data); + }) + .catch((err) => { + console.log(err.message); + }); +``` + +```js +sum(7, 'A') + .then((data) => { + console.log(data); + }) + .catch((err) => { + console.log(err.message); + }); +``` + +> Asynchrones Throw + +```js +const sum = async (a, b) => { + if (isNumber(a) && isNumber(b)) { + return a + b; + } + throw new Error('a and b should be numbers'); +}; +``` + +```js +try { + console.log(await sum(2, 3)); +} catch (e) { + console.log(e.message); +} +``` + +```js +try { + console.log(await sum(7, 'A')); +} catch (err) { + console.log(err.message); +} +``` diff --git a/content/de/2-9-Tasks.md b/content/de/2-9-Tasks.md new file mode 100644 index 0000000..6b73b6f --- /dev/null +++ b/content/de/2-9-Tasks.md @@ -0,0 +1,47 @@ +## 2.9. Aufgaben zum Abschnitt + +`Aufgabe 1.` Nehmen wir ein Beispiel, das wir bereits betrachtet haben, aber dem einige Fehler hinzugefügt wurden. Kopieren Sie diesen Code in eine separate Datei und korrigieren Sie ihn, damit er nicht nur funktioniert, sondern auch schön und verständlich ist. Als Referenz können Sie den Code aus dem Buch und den Vorlesungen verwenden. + +```js +const Items = [ + { CENA: 40 } ,{ CENA : 120 },{ + CENA: '505', + }, { CENA: 350 }]; + +For (const ITEM of items){ +console.log(`Price: ${item.price}`); +} +``` + +`Aufgabe 2.` Lassen Sie uns nun eine Funktion erstellen, die die Summe des gesamten Einkaufs berechnet. Geben Sie der Funktion einen verständlichen Namen und fügen Sie folgende Regeln hinzu: Es muss überprüft werden, ob der Preis eine Zahl ist (mit `typeof`), wir summieren nur positive Preise, und wenn wir keine Zahl oder eine negative Zahl finden, geben wir einen Fehler mit `throw` aus. + +Während der Ausführung der Aufgabe, suchen Sie im Internet nach Dokumentation zu `for..of`, `throw`, `console.log`, Funktionen und Arrays. Am besten suchen Sie in MDN (mozilla developers network). + +Stellen Sie sicher, dass der Code in der Kommandozeile über node.js oder im Browser läuft. + +`Aufgabe 3.` Nehmen Sie diese Datenstruktur und ergänzen Sie sie mit Waren und Warengruppen nach dem Beispiel der bereits vorhandenen: + +```js +const purchase = { + Electronics: [ + { name: 'Laptop', price: 1500 }, + { name: 'Keyboard', price: 100 }, + ], + Textile: [{ name: 'Bag', price: 50 }], +}; +``` + +Platzieren Sie den Code in eine Datei und geben Sie die gesamte Struktur auf dem Bildschirm aus, indem Sie den Code in node.js oder im Browser ausführen. + +`Aufgabe 4.` Schreiben Sie eine Funktion `find`, die durch die Struktur aus der vorherigen Aufgabe geht und ein Produkt anhand seines Namens findet (alle Produktgruppen überprüfend). Namen können sich wiederholen, aber diesmal interessiert uns nur das erste Produkt, dessen Name übereinstimmt. + +Beispiel für die Verwendung der Funktion `find`: + +```js +const result = find(purchase, 'Laptop'); +console.log(result); +``` + +Sollte ausgeben: `{ name: 'Laptop', price: 1500 }` + +`Aufgabe 5.` Erweitern wir nun die vorherige Aufgabe: Die Funktion `find` muss so geändert werden, dass sie ein Array zurückgibt, das alle Produkte mit dem angegebenen Namen enthält. Wenn keines gefunden wird, dann ein leeres Array. diff --git a/content/de/2-Basic.md b/content/de/2-Basic.md new file mode 100644 index 0000000..9c998fb --- /dev/null +++ b/content/de/2-Basic.md @@ -0,0 +1,53 @@ +# 2. Grundkonzepte + +Wir brauchen Kommentare, um Codeblöcke vorübergehend an der Ausführung oder Kompilierung zu hindern, um strukturierte Annotationen oder Metadaten zu speichern (interpretiert von speziellen Tools), um `TODOs` oder entwicklerlesbare Erklärungen zu halten. + +> Ein `Kommentar` ist eine Zeichenfolge im Code, die vom Compiler oder Interpreter ignoriert wird. + +Kommentare in allen `C`-Familien-Sprachen wie `C++`, `JavaScript`, `Java`, `C#`, `Swift`, `Kotlin`, `Go`, etc. haben die gleiche Syntax. + +```js +// Einzeiliger Kommentar +``` + +```js +/* + Mehrzeilige + Kommentare +*/ +``` + +Halten Sie nicht offensichtliche Dinge in Kommentaren fest, wiederholen Sie nicht etwas, was aus dem Code selbst klar ist. + +In bash (Shell-Skripten) und Python verwenden wir das Nummernzeichen (Raute oder Hash-Symbol) für Kommentare. + +```py +# Einzeiliger Kommentar +``` + +Python verwendet mehrzeilige Strings als mehrzeilige Kommentare mit Triple-Quote-Syntax. Aber denken Sie daran, dass es sich um ein String-Literal handelt, das keiner Variablen zugewiesen wird. + +```py +""" + Mehrzeilige + Kommentare +""" +``` + +SQL verwendet zwei Bindestriche, um einen einzeiligen Kommentar bis zum Ende der Zeile zu starten. + +```sql +select name from PERSON -- Kommentare in sql +``` + +HTML-Kommentare haben nur mehrzeilige Syntax. + +```html + +``` + +In Assembler und mehreren LISP-Dialekten verwenden wir Semikolons (oder mehrere Semikolons) für verschiedene Arten von Kommentaren. + +``` +; Einzeiliger Kommentar in Assembler und LISP +``` diff --git a/content/de/3-1-State.md b/content/de/3-1-State.md new file mode 100644 index 0000000..2e9e9e8 --- /dev/null +++ b/content/de/3-1-State.md @@ -0,0 +1,3 @@ +## 3.1. Stateful- und Stateless-Ansatz + +No translation diff --git a/content/de/3-2-Structs.md b/content/de/3-2-Structs.md new file mode 100644 index 0000000..2954d4e --- /dev/null +++ b/content/de/3-2-Structs.md @@ -0,0 +1,366 @@ +## 3.2. Strukturen und Records + +```c +#include + +struct date { + int day; + int month; + int year; +}; + +struct person { + char *name; + char *city; + struct date born; +}; + +int main() { + struct person p1; + p1.name = "Marcus"; + p1.city = "Roma"; + p1.born.day = 26; + p1.born.month = 4; + p1.born.year = 121; + + printf( + "Name: %s\nStadt: %s\nGeboren: %d-%d-%d\n", + p1.name, p1.city, + p1.born.year, p1.born.month, p1.born.day + ); + + return 0; +} +``` + +> Pascal + +```pas +program Example; + +type TDate = record + Year: integer; + Month: 1..12; + Day: 1..31; +end; + +type TPerson = record + Name: string[10]; + City: string[10]; + Born: TDate; +end; + +var + P1: TPerson; + FPerson: File of TPerson; + +begin + P1.Name := 'Marcus'; + P1.City := 'Roma'; + P1.Born.Day := 26; + P1.Born.Month := 4; + P1.Born.Year := 121; + WriteLn('Name: ', P1.Name); + WriteLn('Stadt: ', P1.City); + WriteLn( + 'Geboren: ', + P1.Born.Year, '-', + P1.Born.Month, '-', + P1.Born.Day + ); + Assign(FPerson, './record.dat'); + Rewrite(FPerson); + Write(FPerson, P1); + Close(FPerson); +end. +``` + +> Rust + +```rs +struct Date { + year: u32, + month: u32, + day: u32, +} + +struct Person { + name: String, + city: String, + born: Date, +} + +fn main() { + let p1 = Person { + name: String::from("Marcus"), + city: String::from("Roma"), + born: Date { + day: 26, + month: 4, + year: 121, + }, + }; + + println!( + "Name: {}\nStadt: {}\nGeboren: {}-{}-{}\n", + p1.name, p1.city, + p1.born.year, p1.born.month, p1.born.day + ); +} +``` + +> TypeScript: Interfaces + +```ts +interface IDate { + day: number; + month: number; + year: number; +} + +interface IPerson { + name: string; + city: string; + born: IDate; +} +``` + +```ts +const personToString = (person: IPerson): string => { + const { name, city, born } = person; + const { year, month, day } = born; + const fields = [ + `Name: ${name}`, + `Stadt: ${city}`, + `Geboren: ${year}-${month}-${day}`, + ]; + return fields.join('\n'); +}; +``` + +```ts +const person: IPerson = { + name: 'Marcus', + city: 'Roma', + born: { + day: 26, + month: 4, + year: 121, + }, +}; + +console.log(personToString(person)); +``` + +> TypeScript: Klassen + +```ts +class DateStruct { + day: number; + month: number; + year: number; +} + +class Person { + name: string; + city: string; + born: DateStruct; +} +``` + +> JavaScript: Klassen + +```js +class DateStruct { + constructor(year, month, day) { + this.day = day; + this.month = month; + this.year = year; + } +} + +class Person { + constructor(name, city, born) { + this.name = name; + this.city = city; + this.born = born; + } +} +``` + +```js +const personToString = (person) => { + const { name, city, born } = person; + const { year, month, day } = born; + const fields = [ + `Name: ${name}`, + `Stadt: ${city}`, + `Geboren: ${year}-${month}-${day}`, + ]; + return fields.join('\n'); +}; +``` + +```js +const date = new DateStruct(121, 4, 26); +const person = new Person('Marcus', 'Roma', date); +console.log(personToString(person)); +``` + +> JavaScript: Objekte + +```js +const person = { + name: 'Marcus', + city: 'Roma', + born: { + day: 26, + month: 4, + year: 121, + }, +}; + +console.log(personToString(person)); +``` + +> JavaScript: Struktur-Serialisierung + +```js +const v8 = require('v8'); +const fs = require('fs'); +``` + +Aus dem vorherigen Beispiel übernehmen: + +- class DateStruct +- class Person + +```js +const date = new DateStruct(121, 4, 26); +const person = new Person('Marcus', 'Roma', date); + +const v8Data = v8.serialize(person); +const v8File = './file.dat'; +fs.writeFile(v8File, v8Data, () => { + console.log('Gespeichert ' + v8File); +}); +``` + +> Datei: file.dat + +``` +FF 0D 6F 22 04 6E 61 6D 65 22 06 4D 61 72 63 75 +73 22 04 63 69 74 79 22 04 52 6F 6D 61 22 04 62 +6F 72 6E 6F 22 03 64 61 79 49 34 22 05 6D 6F 6E +74 68 49 08 22 04 79 65 61 72 49 F2 01 7B 03 7B +03 +``` + +> Verschachtelte Strukturen + +```c +#include +#include +#include +#include + +struct Product { + std::string name; + int price; +}; + +void printProduct(Product item) { + printf("%s: %d\n", item.name.c_str(), item.price); +} + +void printProducts(std::vector items) { + for (int i = 0; i < items.size(); i++) { + printProduct(items[i]); + } +} + +int main() { + std::map> purchase { + { "Elektronik", { + { "Laptop", 1500 }, + { "Tastatur", 100 }, + { "HDMI-Kabel", 10 }, + } }, + { "Textilien", { + { "Tasche", 50 }, + } }, + }; + + std::vector electronics = purchase["Elektronik"]; + printf("Elektronik:\n"); + printProducts(electronics); + + std::vector textile = purchase["Textilien"]; + printf("\nTextilien:\n"); + printProducts(textile); + + Product bag = textile[0]; + printf("\nEinzelelement:\n"); + printProduct(bag); + + int price = purchase["Elektronik"][2].price; + printf("\nHDMI-Kabel Preis ist %d\n", price); +} +``` + +> Python + +```py +purchase = { + 'Elektronik': [ + { 'name': 'Laptop', 'price': 1500 }, + { 'name': 'Tastatur', 'price': 100 }, + { 'name': 'HDMI-Kabel', 'price': 10 }, + ], + 'Textilien': [ + { 'name': 'Tasche', 'price': 50 }, + ], +} + +electronics = purchase['Elektronik'] +print({ 'electronics': electronics }) + +textile = purchase['Textilien'] +print({ 'textile': textile }) + +bag = textile[0] +print({ 'bag': bag }) + +price = purchase['Elektronik'][2]['price'] +print({ 'price': price }) +``` + +> JavaScript + +```js +const purchase = { + Elektronik: [ + { name: 'Laptop', price: 1500 }, + { name: 'Tastatur', price: 100 }, + { name: 'HDMI-Kabel', price: 10 }, + ], + Textilien: [{ name: 'Tasche', price: 50 }], +}; + +const electronics = purchase.Elektronik; +console.log(electronics); + +const textile = purchase['Textilien']; +console.log(textile); + +const bag = textile[0]; +console.log(bag); + +const price = purchase['Elektronik'][2].price; +console.log(price); + +const json = JSON.stringify(purchase); +console.log(json); +const obj = JSON.parse(json); +console.log(obj); +``` diff --git a/content/de/3-3-Collections.md b/content/de/3-3-Collections.md new file mode 100644 index 0000000..68fd04f --- /dev/null +++ b/content/de/3-3-Collections.md @@ -0,0 +1,222 @@ +## 3.3. Array, Liste, Set, Tupel + +> Array + +```js +const ages = [10, 12, 15, 15, 17, 18, 18, 19, 20]; + +const first = ages[0]; +const last = ages[ages.length - 1]; + +console.log({ first, last }); +``` + +> Liste + +```py +ages = [10, 12, 15, 15, 17, 18, 18, 19, 20] + +first = ages[0] +last = ages[-1] + +print({ 'first': first, 'last': last }) +``` + +> Array + +```c +#include + +int main() { + int ages[] = { 10, 12, 15, 15, 17, 18, 18, 19, 20 }; + + int first = ages[0]; + int length = sizeof(ages) / sizeof(ages[0]); + int last = ages[length - 1]; + + printf("first: %d\n", first); + printf("last: %d\n", last); +} +``` + +> Elemente zugreifen + +```js +const getFirstAndLast = (array) => { + const first = array[0]; + const last = array[array.length - 1]; + return { first, last }; +}; +``` + +```js +const ages = [10, 12, 15, 15, 17, 18, 18, 19, 20]; +const { first, last } = getFirstAndLast(ages); +console.log({ first, last }); +``` + +```py +def getFirstAndLast(array): + first = ages[0] + last = ages[-1] + return first, last +``` + +```py +ages = [10, 12, 15, 15, 17, 18, 18, 19, 20] +first, last = getFirstAndLast(ages) +print({ 'first': first, 'last': last }) +``` + +```js +const getFirstAndLast = (array) => ({ + first: array[0], + last: array[array.length - 1], +}); +``` + +```py +getFirstAndLast = lambda array: (array[0], array[-1]) +``` + +```js +const concat = (arr1, arr2) => { + const arr = arr1.slice(); + arr.push(...arr2); + return arr; +}; +``` + +```js +const schoolAges = [10, 12, 15, 15]; +const studentAges = [17, 18, 18, 19, 20]; +const ages = concat(schoolAges, studentAges); +``` + +```py +concat = lambda arr1, arr2: arr1 + arr2 +``` + +```py +schoolAges = [10, 12, 15, 15] +studentAges = [17, 18, 18, 19, 20] +ages = schoolAges + studentAges +``` + +```c +#include + +int main() { + int schoolAges[] = { 10, 12, 15, 15 }; + int studentAges[] = { 17, 18, 18, 19, 20 }; + + int schoolLength = sizeof(schoolAges) / sizeof(int); + int studentLength = sizeof(studentAges) / sizeof(int); + int length = schoolLength + studentLength; + int ages[length]; + + for (int i = 0; i < schoolLength; i++) { + ages[i] = schoolAges[i]; + } + + for (int i = 0; i < studentLength; i++) { + ages[i + schoolLength] = studentAges[i]; + } + + for (int i = 0; i < length; i++) { + printf("ages[%d]: %d\n", i, ages[i]); + } +} +``` + +```js +const concat = (arr1, arr2) => [...arr1, ...arr2]; +``` + +> Set + +```js +const ages = new Set([10, 12, 15, 15, 17, 18, 18, 19, 20]); +console.log({ ages }); + +ages.add(16); +ages.delete(20); + +console.log({ + 10: ages.has(10), + 16: ages.has(16), + 19: ages.has(19), + 20: ages.has(20), +}); + +ages.clear(); +console.log({ ages }); +``` + +> Vereinigung + +```js +const union = (s1, s2) => { + const ds = s1.slice(0); + for (let i = 0; i < s2.length; i++) { + const item = s2[i]; + if (!ds.includes(item)) ds.push(item); + } + return ds; +}; +``` + +```js +const cities1 = ['Beijing', 'Kiev']; +const cities2 = ['Kiev', 'London', 'Baghdad']; +console.dir({ cities1, cities2 }); + +const results = union(cities1, cities2); +console.dir(results); +``` + +```js +const union = (s1, s2) => new Set([...s1, ...s2]); +``` + +> Schnittmenge + +```js +const intersection = (s1, s2) => { + const ds = []; + for (let i = 0; i < s1.length; i++) { + const item = s1[i]; + if (s2.includes(item)) ds.push(item); + } + return ds; +}; +``` + +```js +const intersection = (s1, s2) => + new Set([...s1].filter((v) => s2.has(v))); +``` + +> Differenz + +```js +const difference = (s1, s2) => { + const ds = []; + for (let i = 0; i < s1.length; i++) { + const item = s1[i]; + if (!s2.includes(item)) ds.push(item); + } + return ds; +}; +``` + +```js +const difference = (s1, s2) => + new Set([...s1].filter((v) => !s2.has(v))); +``` + +> Komplement + +```js +const complement = (s1, s2) => difference(s2, s1); +``` diff --git a/content/de/3-4-Hash.md b/content/de/3-4-Hash.md new file mode 100644 index 0000000..4c70b2b --- /dev/null +++ b/content/de/3-4-Hash.md @@ -0,0 +1,97 @@ +## 3.4. Dictionary, Hashtabelle und assoziatives Array + +> Objekt + +```js +const ages = { + 'Vasia Pupkin': 19, + 'Marcus Aurelius': 1860, +}; + +console.log({ ages }); +``` + +```js +ages['Vasia Pupkin'] = 20; +console.log({ ages }); +``` + +```js +Reflect.deleteProperty(ages, 'Vasia Pupkin'); +console.log({ ages }); +``` + +```js +console.log({ + 'Vasia Pupkin': Reflect.has(ages, 'Vasia Pupkin'), + 'Marcus Aurelius': Reflect.has(ages, 'Marcus Aurelius'), +}); +``` + +> Map + +```js +const ages = new Map(); + +ages.set('Vasia Pupkin', 19); +ages.set('Marcus Aurelius', 1860); + +console.log({ ages }); +``` + +```js +ages.set('Vasia Pupkin', 20); +console.log({ ages }); +``` + +```js +ages.delete('Vasia Pupkin'); +console.log({ ages }); +``` + +```js +console.log({ + 'Vasia Pupkin': ages.has('Vasia Pupkin'), + 'Marcus Aurelius': ages.has('Marcus Aurelius'), +}); +``` + +```js +ages.clear(); +console.log({ ages }); +``` + +> Komplexes Beispiel: distinct + +```js +const distinct = (dataset) => { + const keys = new Set(); + return dataset.filter((record) => { + const cols = Object.keys(record).sort(); + const key = cols + .map((field) => record[field]) + .join('\x00'); + const has = keys.has(key); + if (!has) keys.add(key); + return !has; + }); +}; +``` + +```js +const flights = [ + { from: 'Kiev', to: 'Rome' }, + { from: 'Kiev', to: 'Warsaw' }, + { from: 'Dublin', to: 'Riga' }, + { from: 'Riga', to: 'Dublin' }, + { from: 'Kiev', to: 'Rome' }, + { from: 'Cairo', to: 'Paris' }, +]; + +console.table(flights); +``` + +```js +const directions = distinct(flights); +console.table(directions); +``` diff --git a/content/de/3-5-Deque.md b/content/de/3-5-Deque.md new file mode 100644 index 0000000..112d577 --- /dev/null +++ b/content/de/3-5-Deque.md @@ -0,0 +1,164 @@ +## 3.5. Stack, Queue, Deque + +```js +class Stack { + constructor() { + this.last = null; + } + + push(item) { + const prev = this.last; + const element = { prev, item }; + this.last = element; + } + + pop() { + const element = this.last; + if (!element) return null; + this.last = element.prev; + return element.item; + } +} +``` + +```js +const obj1 = { name: 'first' }; +const obj2 = { name: 'second' }; +const obj3 = { name: 'third' }; +const list = new Stack(); +list.push(obj1); +list.push(obj2); +list.push(obj3); +``` + +```js +console.dir(list.pop()); // { name: 'third' } +console.dir(list.pop()); // { name: 'second' } +console.dir(list.pop()); // { name: 'first' } +console.dir(list.pop()); // null +``` + +> Queue + +```js +class Queue { + constructor() { + this.first = null; + this.last = null; + } + + put(item) { + const last = this.last; + const element = { next: null, item }; + if (last) { + last.next = element; + this.last = element; + } else { + this.first = element; + this.last = element; + } + } + + pick() { + const element = this.first; + if (!element) return null; + if (this.last === element) { + this.first = null; + this.last = null; + } else { + this.first = element.next; + } + return element.item; + } +} +``` + +```js +const obj1 = { name: 'first' }; +const obj2 = { name: 'second' }; +const obj3 = { name: 'third' }; + +const queue = new Queue(); +queue.put(obj1); +queue.put(obj2); +queue.put(obj3); + +console.dir(queue.pick()); // { name: 'first' } +console.dir(queue.pick()); // { name: 'second' } +console.dir(queue.pick()); // { name: 'third' } +console.dir(queue.pick()); // null +``` + +> Dequeue + +```js +class Dequeue { + constructor() { + this.first = null; + this.last = null; + } + + push(item) { + const last = this.last; + const element = { prev: last, next: null, item }; + if (last) { + last.next = element; + this.last = element; + } else { + this.first = element; + this.last = element; + } + } + + pop() { + const element = this.last; + if (!element) return null; + if (this.first === element) { + this.first = null; + this.last = null; + } else { + this.last = element.prev; + } + return element.item; + } + + unshift(item) { + const first = this.first; + const element = { prev: null, next: first, item }; + if (first) { + first.prev = element; + this.first = element; + } else { + this.first = element; + this.last = element; + } + } + + shift() { + const element = this.first; + if (!element) return null; + if (this.last === element) { + this.first = null; + this.last = null; + } else { + this.first = element.next; + } + return element.item; + } +} +``` + +```js +const obj1 = { name: 'first' }; +const obj2 = { name: 'second' }; +const obj3 = { name: 'third' }; + +const list = new Dequeue(); +list.push(obj1); +list.push(obj2); +list.unshift(obj3); + +console.dir(list.pop()); // { name: 'second' } +console.dir(list.shift()); // { name: 'third' } +console.dir(list.shift()); // { name: 'first' } +``` diff --git a/content/de/3-6-Graph.md b/content/de/3-6-Graph.md new file mode 100644 index 0000000..3301f47 --- /dev/null +++ b/content/de/3-6-Graph.md @@ -0,0 +1,106 @@ +## 3.6. Bäume und Graphen + +> Adjazenzmatrix - speichert die Verbindungen der Graphknoten + +``` + 1 +---+ const graph = [ + +--------------+ B +--+ [0, 1, 1, 0, 1], + | +---+ | [1, 0, 0, 1, 0], + | | [1, 0, 0, 1, 0], ++-+-+ 2 | [0, 1, 1, 0, 0], +|| A +----------+ |3 [1, 0, 0, 0, 0], +|+-+ | | ]; + | | | + | +-+-+ | const graph = { + |5 | C | | A: [0, 1, 1, 0, 1], + | +-+-+ | B: [1, 0, 0, 1, 0], + +--+ | | C: [1, 0, 0, 1, 0], + | | | D: [0, 1, 1, 0, 0], + +-+-+ 4 | +-+-+ E: [1, 0, 0, 0, 0], + | E | +------+ D | }; + +---+ +---+ +``` + +> Adjazenzmatrix als flaches Array + +``` + 1 +---+ const graph = [ + +--------------+ B +--+ 0, 1, 1, 0, 1, + | +---+ | 1, 0, 0, 1, 0, + | | 1, 0, 0, 1, 0, ++-+-+ 2 | 0, 1, 1, 0, 0, +|| A +----------+ |3 1, 0, 0, 0, 0, +|+-+ | | ]; + | | | + | +-+-+ | + |5 | C | | + | +-+-+ | + +--+ | | + | | | + +-+-+ 4 | +-+-+ + | E | +------+ D | + +---+ +---+ +``` + +> Inzidenzmatrix - Verbindung von Knoten (Array-Zeilen) mit Kanten (Array-Spalten) + +``` + 1 +---+ const graph = [ + +--------------+ B +--+ [1, 1, 0, 0, 1], + | +---+ | [1, 0, 1, 0, 0], + | | [0, 1, 0, 1, 0], ++-+-+ 2 | [0, 0, 1, 1, 0], +|| A +----------+ |3 [0, 0, 0, 0, 1], +|+-+ | | ]; + | | | + | +-+-+ | const graph = { + |5 | C | | A: [1, 1, 0, 0, 1], + | +-+-+ | B: [1, 0, 1, 0, 0], + +--+ | | C: [0, 1, 0, 1, 0], + | | | D: [0, 0, 1, 1, 0], + +-+-+ 4 | +-+-+ E: [0, 0, 0, 0, 1], + | E | +------+ D | ]; + +---+ +---+ +``` + +> Adjazenzliste - Liste von Knoten, für jeden eine Liste benachbarter Knoten + +``` + 1 +---+ const graph = { + +--------------+ B +--+ A: [], + | +---+ | B: [], + | | C: [], ++-+-+ 2 | D: [], +|| A +----------+ |3 E: [], +|+-+ | | }; + | | | + | +-+-+ | const { A, B, C, D, E } = graph; + |5 | C | | A.push(B, C, E); + | +-+-+ | B.push(A, D); + +--+ | | C.push(A, D); + | | | D.push(B, C); + +-+-+ 4 | +-+-+ E.push(A); + | E | +------+ D | + +---+ +---+ console.dir({ graph }); +``` + +> Kantenliste - Liste mit Angabe der Kante als Knotenpaar + +``` + 1 +---+ const graph = [ + +--------------+ B +--+ [A, B], + | +---+ | [A, C], + | | [B, D], ++-+-+ 2 | [C, D], +|| A +----------+ |3 [A, E], +|+-+ | | ]; + | | | + | +-+-+ | const graph = [ + |5 | C | | { from: A, to: B }, + | +-+-+ | { from: A, to: C }, + +--+ | | { from: B, to: D }, + | | | { from: C, to: D }, + +-+-+ 4 | +-+-+ { from: A, to: E }, + | E | +------+ D | ]; + +---+ +---+ +``` diff --git a/content/de/3-7-Projections.md b/content/de/3-7-Projections.md new file mode 100644 index 0000000..17e00ec --- /dev/null +++ b/content/de/3-7-Projections.md @@ -0,0 +1,3 @@ +## 3.7. Projektion von Datenmengen + +No translation diff --git a/content/de/3-8-Complexity.md b/content/de/3-8-Complexity.md new file mode 100644 index 0000000..3fb68a6 --- /dev/null +++ b/content/de/3-8-Complexity.md @@ -0,0 +1,3 @@ +## 3.8. Analyse der Zeit- und Speicherkomplexität + +No translation diff --git a/content/de/3-Data.md b/content/de/3-Data.md new file mode 100644 index 0000000..0934500 --- /dev/null +++ b/content/de/3-Data.md @@ -0,0 +1,3 @@ +# 3. Zustände, Datenstrukturen und Sammlungen + +No translation diff --git a/content/de/4-1-Tech-stack.md b/content/de/4-1-Tech-stack.md new file mode 100644 index 0000000..2e56ea2 --- /dev/null +++ b/content/de/4-1-Tech-stack.md @@ -0,0 +1,3 @@ +## 4.1. Was ist ein Technologiestack? + +No translation diff --git a/content/de/4-2-Dev-env.md b/content/de/4-2-Dev-env.md new file mode 100644 index 0000000..bca1ea1 --- /dev/null +++ b/content/de/4-2-Dev-env.md @@ -0,0 +1,3 @@ +## 4.2. Entwicklungsumgebung und Debugging + +No translation diff --git a/content/de/4-3-Iterations.md b/content/de/4-3-Iterations.md new file mode 100644 index 0000000..75bf752 --- /dev/null +++ b/content/de/4-3-Iterations.md @@ -0,0 +1,3 @@ +## 4.3. Iteration: Rekursion, Iteratoren und Generatoren + +No translation diff --git a/content/de/4-4-Application.md b/content/de/4-4-Application.md new file mode 100644 index 0000000..8f6f21e --- /dev/null +++ b/content/de/4-4-Application.md @@ -0,0 +1,3 @@ +## 4.4. Bausteine einer Anwendung: Dateien, Module, Komponenten + +No translation diff --git a/content/de/4-5-Object.md b/content/de/4-5-Object.md new file mode 100644 index 0000000..c9506dc --- /dev/null +++ b/content/de/4-5-Object.md @@ -0,0 +1,3 @@ +## 4.5. Objekt, Prototyp und Klasse + +No translation diff --git a/content/de/4-6-Partial.md b/content/de/4-6-Partial.md new file mode 100644 index 0000000..d81f315 --- /dev/null +++ b/content/de/4-6-Partial.md @@ -0,0 +1,3 @@ +## 4.6. Partielle Anwendung und Currying, _Pipe_ und _Compose_ + +No translation diff --git a/content/de/4-7-Chaining.md b/content/de/4-7-Chaining.md new file mode 100644 index 0000000..69e286c --- /dev/null +++ b/content/de/4-7-Chaining.md @@ -0,0 +1,3 @@ +## 4.7. Chaining von Methoden und Funktionen + +No translation diff --git a/content/de/4-8-Mixins.md b/content/de/4-8-Mixins.md new file mode 100644 index 0000000..b9c0021 --- /dev/null +++ b/content/de/4-8-Mixins.md @@ -0,0 +1,3 @@ +## 4.8. Mixins + +No translation diff --git a/content/de/4-9-Dependencies.md b/content/de/4-9-Dependencies.md new file mode 100644 index 0000000..e8ba4ee --- /dev/null +++ b/content/de/4-9-Dependencies.md @@ -0,0 +1,3 @@ +## 4.9. Abhängigkeiten und Bibliotheken + +No translation diff --git a/content/de/4-Extended.md b/content/de/4-Extended.md new file mode 100644 index 0000000..50da9e5 --- /dev/null +++ b/content/de/4-Extended.md @@ -0,0 +1,3 @@ +# 4. Erweiterte Konzepte + +No translation diff --git a/content/de/Index.md b/content/de/Index.md index 7599d77..3ae7245 100644 --- a/content/de/Index.md +++ b/content/de/Index.md @@ -1,6 +1,6 @@ # Inhaltsverzeichnis -1. **Einführung** +1. Einführung 1.1. Lernansätze beim Programmieren 1.2. Beispiele in JavaScript, Python und C 1.3. Modellierung: Abstraktionen und Wiederverwendung @@ -8,8 +8,7 @@ 1.5. Dekomposition und _Separation of Concerns_ 1.6. Überblick über den Beruf Softwareingenieur 1.7. Überblick über Programmierparadigmen - -2. **Grundkonzepte** +2. Grundkonzepte 2.1. Wert, Bezeichner, Variable und Konstante, Literal, Zuweisung 2.2. Datentypen: skalare, Referenz- und strukturierte Typen 2.3. Operator und Ausdruck, Codeblock, Funktion, Schleife, Bedingung @@ -19,8 +18,7 @@ 2.7. Closures, Callbacks, Wrapper und Events 2.8. Ausnahmen und Fehlerbehandlung 2.9. Praxisaufgaben zum Abschnitt - -3. **Zustände, Datenstrukturen und Sammlungen** +3. Zustände, Datenstrukturen und Sammlungen 3.1. Stateful- und Stateless-Ansatz 3.2. Strukturen und Records 3.3. Array, Liste, Set, Tupel @@ -29,8 +27,7 @@ 3.6. Bäume und Graphen 3.7. Projektion von Datenmengen 3.8. Analyse der Zeit- und Speicherkomplexität - -4. **Erweiterte Konzepte** +4. Erweiterte Konzepte 4.1. Was ist ein Technologiestack? 4.2. Entwicklungsumgebung und Debugging 4.3. Iteration: Rekursion, Iteratoren und Generatoren @@ -40,22 +37,19 @@ 4.7. Chaining von Methoden und Funktionen 4.8. Mixins 4.9. Abhängigkeiten und Bibliotheken - -5. **Verbreitete Programmierparadigmen** +5. Verbreitete Programmierparadigmen 5.1. Imperativer und deklarativer Ansatz 5.2. Strukturierte und unstrukturierte Programmierung 5.3. Prozedurale Programmierung 5.4. Funktionale Programmierung 5.5. Objektorientierte Programmierung 5.6. Prototypenbasierte Programmierung - -6. **Antipatterns** +6. Antipatterns 6.1. Allgemeine Antipatterns für alle Paradigmen 6.2. Prozedurale Antipatterns 6.3. Objektorientierte Antipatterns 6.4. Funktionale Antipatterns - -7. **Entwicklungsprozess** +7. Entwicklungsprozess 7.1. Softwarelebenszyklus, Domänenanalyse 7.2. Konventionen und Standards 7.3. Tests: Unit Tests, System- und Integrationstests @@ -65,8 +59,7 @@ 7.7. Koordination und Prozessanpassung 7.8. Continuous Deployment und Continuous Delivery 7.9. Multidimensionale Optimierung - -8. **Fortgeschrittene Konzepte** +8. Fortgeschrittene Konzepte 8.1. Events, Timer und _EventEmitter_ 8.2. Introspektion und Reflexion 8.3. Serialisierung und Deserialisierung @@ -76,8 +69,7 @@ 8.7. Typisierte Arrays 8.8. Projektionen 8.9. I/O und Dateien - -9. **Architektur** +9. Architektur 9.1. Dekomposition, Benennung und Verknüpfung 9.2. Interaktion zwischen Softwarekomponenten 9.3. Kopplung über Namensräume @@ -85,8 +77,7 @@ 9.5. Interaktion mit Events und Nachrichten 9.6. Schnittstellen, Protokolle und Verträge 9.7. Onion-Architektur bzw. Schichtenarchitektur - -10. **Grundlagen paralleler Berechnungen** +10. Grundlagen paralleler Berechnungen 10.1. Asynchrones Programmieren 10.2. Paralleles Programmieren, gemeinsamer Speicher (Shared Memory) und Synchronisationsprimitive 10.3. Asynchrone Primitives: Thenable, Promise, Future, Deferred @@ -96,8 +87,7 @@ 10.7. Nachrichtenbasierter Ansatz und Actor-Modell 10.8. Asynchrone Warteschlangen und Sammlungen 10.9. lockfreie Datenstrukturen - -11. **Erweiterte Programmierparadigmen** +11. Erweiterte Programmierparadigmen 11.1. Generische Programmierung 11.2. Ereignisgesteuerte und reaktive Programmierung 11.3. Automatenbasierte Programmierung und Zustandsmaschinen @@ -105,8 +95,7 @@ 11.5. Datenflussprogrammierung 11.6. Metaprogrammierung 11.7. Dynamische Interpretation von Metamodellen - -12. **Datenbanken und persistente Speicherung** +12. Datenbanken und persistente Speicherung 12.1. Geschichte der Datenbanken und Navigational Databases 12.2. Key-Value Stores und andere abstrakte Datenstrukturen 12.3. Relationales Datenmodell und ER-Diagramme @@ -114,8 +103,7 @@ 12.5. Hierarchische und Graphdatenbanken 12.6. Spaltenorientierte und In-Memory-Datenbanken 12.7. Verteilte Datenbanken - -13. **Verteilte Systeme** +13. Verteilte Systeme 13.1. Interprozesskommunikation 13.2. Konfliktfreie replizierte Datentypen (CRDTs) 13.3. Konsistenz, Verfügbarkeit und Partitionierung