Initial commit: IHK Ausbildung materials
This commit is contained in:
286
Wissen/Programmiersprachen/Programmierübersicht.md
Normal file
286
Wissen/Programmiersprachen/Programmierübersicht.md
Normal file
@@ -0,0 +1,286 @@
|
||||
# Programmierübersicht - Fachinformatiker Anwendungsentwicklung
|
||||
|
||||
> Wichtige Programmiersprachen und Konzepte für die Ausbildung
|
||||
|
||||
---
|
||||
|
||||
## Übersicht
|
||||
|
||||
| Sprache | Typ | Typisierung |Paradigma | Hauptverwendung |
|
||||
|---------|-----|------------|----------|-----------------|
|
||||
| **Python** | Interpreter | Dynamisch | OOP, funktional | Scripting, Web, Data Science |
|
||||
| **Java** | Kompiliert | Statisch | OOP | Enterprise, Android |
|
||||
| **JavaScript** | Interpreter | Dynamisch | OOP, funktional | Web-Entwicklung |
|
||||
| **C#** | Kompiliert | Statisch | OOP | .NET, Games |
|
||||
| **SQL** | deklarativ | - | - | Datenbanken |
|
||||
| **HTML/CSS** | Markup/Stylesheet | - | - | Web-Frontend |
|
||||
| **Bash/Shell** | Interpreter | Dynamisch | Prozedural | Systemadministration |
|
||||
|
||||
---
|
||||
|
||||
## Python
|
||||
|
||||
### Grundlagen
|
||||
|
||||
```python
|
||||
# Variablen
|
||||
name = "Max"
|
||||
alter = 25
|
||||
ist_student = True
|
||||
|
||||
# Datentypen
|
||||
text = "Hallo Welt" # str
|
||||
zahl = 42 # int
|
||||
komma = 3.14 # float
|
||||
listen = [1, 2, 3] # list
|
||||
tuples = (1, 2) # tuple
|
||||
wörter = {"a": 1, "b": 2} # dict
|
||||
|
||||
# Kontrollstrukturen
|
||||
if alter >= 18:
|
||||
print("Volljährig")
|
||||
elif alter >= 16:
|
||||
print("Führerschein")
|
||||
else:
|
||||
print("Minderjährig")
|
||||
|
||||
# Schleifen
|
||||
for i in range(5):
|
||||
print(i)
|
||||
|
||||
while alter > 0:
|
||||
alter -= 1
|
||||
|
||||
# Funktionen
|
||||
def gruss(name):
|
||||
return f"Hallo, {name}!"
|
||||
|
||||
# Klassen
|
||||
class Person:
|
||||
def __init__(self, name, alter):
|
||||
self.name = name
|
||||
self.alter = alter
|
||||
|
||||
def vorstellen(self):
|
||||
return f"Ich bin {self.name}"
|
||||
```
|
||||
|
||||
### List Comprehension
|
||||
|
||||
```python
|
||||
# Traditionell
|
||||
quadrate = []
|
||||
for i in range(10):
|
||||
quadrate.append(i**2)
|
||||
|
||||
# Elegant
|
||||
quadrate = [i**2 for i in range(10)]
|
||||
|
||||
# Mit Bedingung
|
||||
gerade = [i for i in range(20) if i % 2 == 0]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## JavaScript
|
||||
|
||||
### Grundlagen
|
||||
|
||||
```javascript
|
||||
// Variablen (ES6+)
|
||||
let name = "Max"; // Veränderbar
|
||||
const alter = 25; // Konstante
|
||||
var alter2 = 30; // Veraltet, nicht mehr nutzen
|
||||
|
||||
// Datentypen
|
||||
const text = "Hallo"; // string
|
||||
constzahl = 42; // number
|
||||
const istWahr = true; // boolean
|
||||
const array = [1, 2, 3]; // array
|
||||
const objekt = { key: "value" }; // object
|
||||
|
||||
// Arrow Functions
|
||||
const gruss = (name) => `Hallo, ${name}!`;
|
||||
|
||||
// Klassen
|
||||
class Person {
|
||||
constructor(name, alter) {
|
||||
this.name = name;
|
||||
this.alter = alter;
|
||||
}
|
||||
|
||||
vorstellen() {
|
||||
return `Ich bin ${this.name}`;
|
||||
}
|
||||
}
|
||||
|
||||
// DOM Manipulation
|
||||
document.getElementById("meinElement").addEventListener("click", () => {
|
||||
console.log("Geklickt!");
|
||||
});
|
||||
```
|
||||
|
||||
### Async/Await
|
||||
|
||||
```javascript
|
||||
// Promise
|
||||
fetch("https://api.example.com/data")
|
||||
.then(response => response.json())
|
||||
.then(data => console.log(data))
|
||||
.catch(error => console.error(error));
|
||||
|
||||
// Async/Await (moderner)
|
||||
async function ladeDaten() {
|
||||
try {
|
||||
const response = await fetch("https://api.example.com/data");
|
||||
const data = await response.json();
|
||||
console.log(data);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## SQL
|
||||
|
||||
### Grundlegende Abfragen
|
||||
|
||||
```sql
|
||||
-- Daten abfragen
|
||||
SELECT spalte1, spalte2
|
||||
FROM tabelle
|
||||
WHERE spalte1 = 'wert'
|
||||
ORDER BY spalte2 DESC;
|
||||
|
||||
-- Mit JOIN
|
||||
SELECT k.name, b.bestelldatum
|
||||
FROM kunde k
|
||||
JOIN bestellung b ON k.id = b.kunde_id;
|
||||
|
||||
-- Aggregatfunktionen
|
||||
SELECT
|
||||
COUNT(*) AS anzahl,
|
||||
SUM(preis) AS gesamt,
|
||||
AVG(preis) AS durchschnitt
|
||||
FROM produkte
|
||||
WHERE kategorie = 'Elektronik';
|
||||
|
||||
-- Gruppierung
|
||||
SELECT kategorie, COUNT(*) AS anzahl
|
||||
FROM produkte
|
||||
GROUP BY kategorie
|
||||
HAVING COUNT(*) > 5;
|
||||
```
|
||||
|
||||
### Datenmanipulation
|
||||
|
||||
```sql
|
||||
-- Einfügen
|
||||
INSERT INTO kunde (name, email)
|
||||
VALUES ('Max Mustermann', 'max@example.com');
|
||||
|
||||
-- Aktualisieren
|
||||
UPDATE kunde
|
||||
SET email = 'neu@example.com'
|
||||
WHERE id = 1;
|
||||
|
||||
-- Löschen
|
||||
DELETE FROM kunde WHERE id = 1;
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Java
|
||||
|
||||
### Grundlagen
|
||||
|
||||
```java
|
||||
// Klassenstruktur
|
||||
public class Person {
|
||||
private String name;
|
||||
private int alter;
|
||||
|
||||
// Konstruktor
|
||||
public Person(String name, int alter) {
|
||||
this.name = name;
|
||||
this.alter = alter;
|
||||
}
|
||||
|
||||
// Getter
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
// Setter
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
// main-Methode
|
||||
public static void main(String[] args) {
|
||||
Person p = new Person("Max", 25);
|
||||
System.out.println(p.getName());
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Wichtige Konzepte
|
||||
|
||||
### OOP-Prinzipien
|
||||
|
||||
1. **Kapselung**: Daten nach außen schützen
|
||||
2. **Vererbung**: Eigenschaften weitergeben
|
||||
3. **Polymorphismus**: Gleiches Verhalten, unterschiedliche Formen
|
||||
4. **Abstraktion**: Komplexität verbergen
|
||||
|
||||
### Entwurfsmuster
|
||||
|
||||
- **Singleton**: Eine Instanz einer Klasse
|
||||
- **Factory**: Erstellt Objekte, ohne exakte Klasse zu kennen
|
||||
- **Observer**: Ereignisbenachrichtigung
|
||||
- **Strategy**: Austauschbare Algorithmen
|
||||
|
||||
---
|
||||
|
||||
## Versionskontrolle (Git)
|
||||
|
||||
### Grundbefehle
|
||||
|
||||
```bash
|
||||
# Repository initialisieren
|
||||
git init
|
||||
|
||||
# Änderungen hinzufügen
|
||||
git add .
|
||||
git commit -m "Nachricht"
|
||||
|
||||
# Branching
|
||||
git checkout -b feature-neu
|
||||
|
||||
# Merge
|
||||
git checkout main
|
||||
git merge feature-neu
|
||||
|
||||
# Remote
|
||||
git push origin main
|
||||
git pull origin main
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## IDEs und Tools
|
||||
|
||||
| IDE | Sprache | Kosten |
|
||||
|-----|---------|--------|
|
||||
| VS Code | Multi | Kostenlos |
|
||||
| IntelliJ IDEA | Java | Community Edition |
|
||||
| PyCharm | Python | Community Edition |
|
||||
| Eclipse | Java | Kostenlos |
|
||||
|
||||
---
|
||||
|
||||
*Stand: 2024*
|
||||
Reference in New Issue
Block a user