277 lines
8.2 KiB
Markdown
277 lines
8.2 KiB
Markdown
# 🎓 programming-concepts-universal
|
||
|
||
*Interaktiver Programmierkurs: Von C zu universellen Konzepten*
|
||
|
||
## 📋 Übersicht
|
||
|
||
Dieses Repository enthält einen kompletten Kurs für Programmieranfänger mit C-Grundlagen, der sich auf **sprachunabhängige Konzepte** konzentriert.
|
||
|
||
**Zielgruppe:** Student mit C-Erfahrung, geplantem C++-Umstieg
|
||
**Kursdauer:** 8 Wochen + Setup
|
||
**Lernziel:** Konzepte verstehen, die auf jede Programmiersprache übertragbar sind
|
||
|
||
---
|
||
|
||
## 📁 Repository-Struktur
|
||
|
||
```
|
||
.
|
||
├── README.md # Diese Datei
|
||
├── docs/
|
||
│ ├── programming-concepts-universal.md # Hauptkurs-Dokument
|
||
│ └── quiz-fragen.md # Interaktive Quizfragen
|
||
├── src/
|
||
│ ├── c_examples/ # C Code-Beispiele
|
||
│ │ ├── module0_setup.c # 🆕 Entwicklungsumgebung
|
||
│ │ ├── module1_memory.c
|
||
│ │ ├── module2_datatypes.c
|
||
│ │ ├── module3_controlflow.c
|
||
│ │ ├── module4_functions.c
|
||
│ │ ├── module5_datastructures.c
|
||
│ │ ├── module6_pointers.c
|
||
│ │ ├── module7_oop_in_c.c
|
||
│ │ ├── module8_modularization.c
|
||
│ │ ├── Makefile
|
||
│ │ └── README.md
|
||
│ └── cpp_examples/ # 🆕 C++ Vergleichsbeispiele
|
||
│ ├── module1_memory_cpp.cpp # Smart Pointers, RAII
|
||
│ ├── module5_datastructures_cpp.cpp # STL Container
|
||
│ ├── module7_oop_cpp.cpp # Klassen, Vererbung
|
||
│ ├── module8_stl_cpp.cpp # 🆕 Iteratoren, Lambdas
|
||
│ └── README.md
|
||
└── exercises/
|
||
│ ├── checkpoint_a.c # 🆕 Lösung: Memory & Typen
|
||
│ ├── checkpoint_b.c # 🆕 Lösung: Taschenrechner
|
||
│ ├── checkpoint_c.c # 🆕 Lösung: Dynamische Liste
|
||
│ └── final_project/ # 🆕 Abschlussprojekt
|
||
│ ├── README.md
|
||
│ ├── todo_c/
|
||
│ │ └── todo.c # C-Implementierung
|
||
│ └── todo_cpp/
|
||
│ └── todo.cpp # C++-Implementierung
|
||
```
|
||
|
||
---
|
||
|
||
## 🗺️ Kurs-Module
|
||
|
||
| Modul | Thema | C-Beispiel | C++-Gegenstück |
|
||
|-------|-------|------------|----------------|
|
||
| **0** | **Setup** | `module0_setup.c` | - |
|
||
| **1** | **Memory-Modell** | `module1_memory.c` | `module1_memory_cpp.cpp` |
|
||
| **2** | **Datentypen** | `module2_datatypes.c` | (Konzepte ähnlich) |
|
||
| **3** | **Flusskontrolle** | `module3_controlflow.c` | (Konzepte identisch) |
|
||
| **4** | **Funktionen** | `module4_functions.c` | (Konzepte ähnlich) |
|
||
| **5** | **Datenstrukturen** | `module5_datastructures.c` | `module5_datastructures_cpp.cpp` |
|
||
| **6** | **Pointer** | `module6_pointers.c` | References, Smart Pointers |
|
||
| **7** | **OOP** | `module7_oop_in_c.c` | `module7_oop_cpp.cpp` |
|
||
| **8** | **Modularisierung** | `module8_modularization.c` | `module8_stl_cpp.cpp` |
|
||
|
||
---
|
||
|
||
## 🚀 Schnellstart
|
||
|
||
### Voraussetzungen
|
||
```bash
|
||
# C-Compiler (gcc oder clang)
|
||
gcc --version
|
||
|
||
# C++-Compiler (optional für Vergleich)
|
||
g++ --version
|
||
|
||
# Make (optional)
|
||
make --version
|
||
```
|
||
|
||
### Kompilieren
|
||
|
||
```bash
|
||
# Alle C-Beispiele
|
||
cd src/c_examples
|
||
make all
|
||
|
||
# Einzelnes Modul
|
||
make module1
|
||
./module1
|
||
|
||
# C++ Beispiele
|
||
cd ../cpp_examples
|
||
g++ -std=c++17 -o memory module1_memory_cpp.cpp
|
||
./memory
|
||
|
||
# Final-Projekt
|
||
cd ../../exercises/final_project/todo_c
|
||
gcc -o todo todo.c -Wall -Wextra
|
||
./todo
|
||
```
|
||
|
||
---
|
||
|
||
## 📖 Kursverwendung
|
||
|
||
### Empfohlener Lernpfad
|
||
|
||
**Vorbereitung (Modul 0):**
|
||
1. Lese `src/c_examples/module0_setup.c`
|
||
2. Installiere VS Code, GCC, Git
|
||
3. Erstelle erstes "Hello World" Programm
|
||
4. Initialisiere Git-Repository
|
||
|
||
**Woche 1-2 (Modul 1-2):**
|
||
1. Lese `docs/programming-concepts-universal.md` Modul 1-2
|
||
2. Bearbeite `docs/quiz-fragen.md` Fragen 1.1-2.3
|
||
3. Kompiliere und teste `module1_memory.c` & `module2_datatypes.c`
|
||
4. ✅ **Checkpoint A**: Lösung in `exercises/checkpoint_a.c` vergleichen
|
||
|
||
**Woche 3-4 (Modul 3-4):**
|
||
1. Modul 3-4 lesen
|
||
2. Quizfragen 3.1-4.3
|
||
3. Code-Beispiele: `module3_controlflow.c`, `module4_functions.c`
|
||
4. 📝 **Checkpoint B**: Taschenrechner implementieren, mit `checkpoint_b.c` vergleichen
|
||
|
||
**Woche 5-6 (Modul 5-6):**
|
||
1. Modul 5-6 lesen
|
||
2. Quizfragen 5.1-6.3
|
||
3. Code: `module5_datastructures.c`, `module6_pointers.c`
|
||
4. 🔧 **Checkpoint C**: Eigene LinkedList implementieren, mit `checkpoint_c.c` vergleichen
|
||
|
||
**Woche 7-8 (Modul 7-8):**
|
||
1. Modul 7-8 lesen
|
||
2. Quizfragen 7.1-8.3 + Final
|
||
3. Code: `module7_oop_in_c.c` + C++ Vergleich (`module7_oop_cpp.cpp`)
|
||
4. 🎓 **Final-Projekt**: Todo-App in C, dann C++ (`exercises/final_project/`)
|
||
|
||
---
|
||
|
||
## 🧪 Quiz-System
|
||
|
||
Das Kursmaterial enthält **28 Quizfragen** mit:
|
||
- ✅ Multiple Choice
|
||
- 📝 Code-Analyse
|
||
- 🔍 Konzept-Fragen
|
||
- 🎯 Score-Tabelle (0-28 Punkte)
|
||
|
||
**Bewertung:**
|
||
| Punkte | Bewertung |
|
||
|--------|-----------|
|
||
| 26-28 | 🏆 Meister |
|
||
| 22-25 | ⭐ Experte |
|
||
| 18-21 | ✅ Gut |
|
||
| < 18 | 📚 Nacharbeiten |
|
||
|
||
---
|
||
|
||
## 🎯 Checkpoints (mit Lösungen)
|
||
|
||
| Checkpoint | Thema | Datei | Schwierigkeit |
|
||
|------------|-------|-------|---------------|
|
||
| **A** | Memory & Typen | `exercises/checkpoint_a.c` | ⭐ Mittel |
|
||
| **B** | Taschenrechner | `exercises/checkpoint_b.c` | ⭐⭐ Fortgeschritten |
|
||
| **C** | Dynamische Liste | `exercises/checkpoint_c.c` | ⭐⭐⭐ Experte |
|
||
|
||
Jeder Checkpoint enthält:
|
||
- Aufgabenstellung als Kommentar
|
||
- Vollständige Lösung
|
||
- Erklärungen der Konzepte
|
||
- Test-Funktionen
|
||
|
||
---
|
||
|
||
## 🏆 Final-Projekt: Todo-App
|
||
|
||
Vollständige CRUD-Anwendung mit:
|
||
- **C-Version**: Manuelle Speicherverwaltung, structs
|
||
- **C++-Version**: Klassen, STL, Smart Pointers
|
||
|
||
**Features:**
|
||
- Todo hinzufügen/ansehen/abschließen/löschen
|
||
- Datei-Speicherung
|
||
- Menü-System
|
||
- Fehlerbehandlung
|
||
|
||
**Vergleich C vs C++:**
|
||
| Aspekt | C | C++ |
|
||
|--------|---|-----|
|
||
| Codezeilen | ~300 | ~250 |
|
||
| Speicherverwaltung | Manuell (malloc/free) | RAII (destruktoren) |
|
||
| Datenstruktur | Struct + Funktionen | Klasse mit Methoden |
|
||
| String-Handling | char[] (manuell) | std::string |
|
||
| Fehlerbehandlung | Return codes | Exceptions (optional) |
|
||
|
||
---
|
||
|
||
## 💡 Kernkonzepte
|
||
|
||
### 1. Memory-Modell (Universell)
|
||
```
|
||
┌─────────────────┐
|
||
│ Stack │ ← Automatisch, schnell, begrenzt
|
||
│ (short-term) │
|
||
├─────────────────┤
|
||
│ Heap │ ← Manuell/verwaltet, flexibel
|
||
│ (long-term) │
|
||
└─────────────────┘
|
||
```
|
||
**In jeder Sprache:** Stack/Heap existieren, Management variiert
|
||
|
||
### 2. Typen als Konzepte
|
||
```c
|
||
// Nicht lernen: "int ist 4 Bytes"
|
||
// Lernen: "int ist ein ganzzahliger Typ mit begrenztem Bereich"
|
||
```
|
||
|
||
### 3. OOP-Prinzipien (Sprachunabhängig)
|
||
- **Kapselung:** Daten schützen
|
||
- **Abstraktion:** Wie ist egal
|
||
- **Vererbung:** "IS-A" Beziehung
|
||
- **Polymorphie:** Gleiche Schnittstelle
|
||
|
||
---
|
||
|
||
## 🔧 C vs C++ Vergleich
|
||
|
||
| Feature | C | C++ |
|
||
|---------|---|-----|
|
||
| Memory | `malloc/free` | `new/delete`, RAII, Smart Pointers |
|
||
| Strings | `char[]` | `std::string` |
|
||
| Arrays | Fixed/dynamisch | `std::vector` |
|
||
| OOP | Simuliert (structs + fct ptrs) | Nativ (`class`, `virtual`) |
|
||
| Generics | `void*` | `template<T>` |
|
||
| Algorithmen | Manuell implementieren | 100+ STL-Algorithmen |
|
||
| Iteratoren | Manuell (Index/Pointers) | Einheitlich für alle Container |
|
||
|
||
---
|
||
|
||
## 📚 Ressourcen
|
||
|
||
### Bücher
|
||
- **"The C Programming Language"** (K&R) - Klassiker
|
||
- **"C++ Primer"** (Lippman) - Umfassend
|
||
- **"Clean Code"** (Robert C. Martin) - Sprachunabhängig!
|
||
- **"Design Patterns"** (Gang of Four) - Das Original
|
||
- **"The C++ Standard Library"** (Nicolai Josuttis) - STL Referenz
|
||
|
||
### Online
|
||
- [exercism.org](https://exercism.org) - Sprachübergreifende Übungen
|
||
- [leetcode.com](https://leetcode.com) - Algorithmen
|
||
- [codewars.com](https://codewars.com) - Katas
|
||
- [cppreference.com](https://cppreference.com) - C/C++ Dokumentation
|
||
|
||
---
|
||
|
||
## 🤝 Mitwirken
|
||
|
||
Dieser Kurs ist für Bildungszwecke gedacht. Verbesserungsvorschläge willkommen!
|
||
|
||
---
|
||
|
||
## 📄 Lizenz
|
||
|
||
MIT License - Für Bildungszwecke frei nutzbar.
|
||
|
||
---
|
||
|
||
**Viel Erfolg beim Lernen! 🚀**
|
||
|
||
*Remember: Programmieren ist nicht Syntax lernen – es sind Konzepte, die in jeder Sprache wiederkehren, nur mit anderem Akzent.*
|