Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [TOC]
- # D Programming & GTK4 Framework with giD - 20-Day Syllabus
- **Target Audience**: Programmers with Python, Julia, Nim, and V experience
- **Goal**: Build professional-grade, elegant GUI applications in D with GTK4 using giD
- **Compiler**: DMD64 D Compiler v2.112.0 (development), LDC2 1.41.0 (production builds)
- **Platform**: Windows 11 with Zed Editor
- **Framework**: giD (GObject Introspection D bindings)
- **Duration**: 20 Days (Alternating D and GTK4)
- ---
- ## Syllabus Index
- ### Week 1: Foundations
- #### Day 1 (D): Introduction to D Programming
- - D syntax fundamentals and data types
- - Variables, constants, and type inference
- - Basic operators and expressions
- - String handling and manipulation
- - **Project**: Temperature converter CLI tool
- #### Day 2 (GTK4): Introduction to GTK4 and giD
- - GTK4 architecture and giD framework concepts
- - Setting up GTK4 applications with giD in D
- - Application and ApplicationWindow basics
- - Event loop and signal handling with `connectSignalName`
- - **Project**: "Hello World" GTK4 application with giD
- #### Day 3 (D): Control Flow and Functions
- - Conditional statements (if/else, switch)
- - Loops (for, foreach, while, do-while)
- - Function definitions and parameters
- - Return types and function overloading
- - **Project**: Number guessing game
- #### Day 4 (GTK4): Basic Widgets and Layouts
- - Common widgets (Button, Label, Entry)
- - Container widgets and layout managers
- - Box, Grid layouts with giD
- - Widget properties and styling
- - **Project**: Simple calculator interface
- #### Day 5 (D): Arrays, Slices, and Ranges
- - Static and dynamic arrays
- - Array operations and slicing
- - Associative arrays (hash maps)
- - Range concepts and algorithms
- - **Project**: Contact list manager (CLI)
- #### Day 6 (GTK4): User Input and Events
- - Entry, SearchEntry, and PasswordEntry widgets
- - Button events and callbacks
- - Keyboard and mouse events
- - Event propagation and handling with giD
- - **Project**: Login form with validation
- #### Day 7 (D): Object-Oriented Programming in D
- - Classes and objects
- - Constructors and destructors
- - Inheritance and polymorphism
- - Interfaces and abstract classes
- - **Project**: Library management system (core logic)
- ---
- ### Week 2: Intermediate Concepts
- #### Day 8 (GTK4): Advanced Widgets
- - TextView and TextBuffer
- - ListBox and FlowBox
- - ScrolledWindow and layouts
- - Label and icon widgets
- - **Project**: Note-taking application
- #### Day 9 (D): Templates and Generic Programming
- - Function templates
- - Class templates
- - Template constraints
- - Compile-time function execution (CTFE)
- - **Project**: Generic data structure library
- #### Day 10 (GTK4): Dialogs and Windows
- - Dialog for custom dialogs
- - MessageDialog alternatives in GTK4
- - FileChooserDialog alternatives
- - Modal and non-modal windows
- - **Project**: Text editor with file operations
- #### Day 11 (D): Error Handling and Exceptions
- - Exception types and hierarchy
- - Try-catch-finally blocks
- - Custom exceptions
- - Defensive programming patterns
- - **Project**: Robust file processor
- #### Day 12 (GTK4): Menus and Actions
- - MenuModel and Builder XML
- - SimpleAction and action-based menus
- - HeaderBar integration
- - Accelerators and shortcuts
- - **Project**: Document editor with full menu system
- #### Day 13 (D): File I/O and Serialization
- - Reading and writing files
- - Text and binary file operations
- - JSON parsing and generation
- - CSV and structured data handling
- - **Project**: Configuration manager
- #### Day 14 (GTK4): Advanced List Views
- - ListBox with custom widgets
- - FlowBox for grid layouts
- - Selection and filtering
- - Dynamic list management
- - **Project**: Task management application
- ---
- ### Week 3: Advanced Topics
- #### Day 15 (D): Concurrency and Parallelism
- - std.parallelism basics
- - Task-based parallelism
- - Message passing with std.concurrency
- - Thread synchronization
- - **Project**: Parallel file search tool
- #### Day 16 (GTK4): Custom Widgets and Drawing
- - DrawingArea with setDrawFunc
- - Custom widget creation by subclassing
- - Cairo drawing basics
- - Animation with timeoutAdd
- - **Project**: Custom chart/graph widget
- #### Day 17 (D): Advanced D Features
- - Mixins and metaprogramming
- - Attributes and UDAs
- - Contracts and invariants
- - Memory management and GC
- - **Project**: Plugin system framework
- #### Day 18 (GTK4): Application Architecture and Memory Management
- - Model-View pattern with giD
- - State management strategies
- - Memory leak prevention (runDispose, reference cycles)
- - Multi-window applications
- - **Project**: Multi-window application framework
- #### Day 19 (D): Working with External Libraries
- - Interfacing with C libraries
- - Using dub packages
- - Creating reusable modules
- - Best practices and patterns
- - **Project**: Database wrapper library
- #### Day 20 (GTK4): Final Integration Project
- - Complete application architecture
- - Professional UI/UX design with GTK4
- - Error handling and validation
- - Building with LDC2 for production
- - **Project**: Full-featured desktop application
- ---
- ## Daily Structure
- Each day follows this format:
- 1. **Concepts** - Key topics covered
- 2. **In-Depth Explanation** - Detailed theory and background
- 3. **Multiple Examples** - Minimum 2 practical code examples per concept
- 4. **Project** - Hands-on project applying the day's concepts
- 5. **Code Completion Test with Expected Output** - Challenge with expected output
- 6. **Optional Extra Projects** - Minimum 2 additional practice projects
- ---
- ## Learning Outcomes
- By the end of this syllabus, you will be able to:
- - Write idiomatic D code using modern language features
- - Build professional GTK4 desktop applications with giD
- - Apply object-oriented and functional programming paradigms
- - Handle events, user input, and application state
- - Create custom widgets and complex UI layouts
- - Implement proper error handling and validation
- - Work with files, data serialization, and external libraries
- - Manage memory correctly in GTK4/giD applications
- - Build complete, polished desktop applications ready for distribution
- ---
- ## Prerequisites
- - **Installed Software**:
- - DMD compiler (v2.112.0+) for development
- - LDC2 compiler (1.41.0+) for production builds
- - Zed editor with D extension
- - GTK4 libraries (MSYS2 UCRT64)
- - giD package cloned at C:\Users\virgil\Packages\Gid
- - DCD (D Completion Daemon)
- - serve-d language server
- - **Prior Knowledge**:
- - Basic programming concepts (from Python/Julia/Nim/V)
- - Command line usage
- - Text editor proficiency
- ---
- ## giD Framework Key Concepts
- ### Important giD Differences from GtkD
- - **Module naming**: Objects use snake_case modules (e.g., `gtk.application_window`)
- - **Signal connections**: Use `connectSignalName` templates (e.g., `connectClicked`, `connectActivate`)
- - **Method naming**: GIR snake_case becomes camelCase (e.g., `set_title` → `setTitle`)
- - **Properties**: Use setter methods with `=` (e.g., `setMarginTop = 24`)
- - **Object creation**: Static constructors like `Button.newWithLabel("Text")`
- - **Memory management**: Use `runDispose()` and `connectCloseRequest` to break reference cycles
- - **No GtkD**: All examples use pure giD bindings
- ### Key giD Modules
- - `gtk.application` - Application class
- - `gtk.application_window` - ApplicationWindow class
- - `gtk.button`, `gtk.label`, `gtk.entry` - Basic widgets
- - `gtk.box`, `gtk.grid` - Layout containers
- - `gtk.types` - Enums like Orientation, Justification
- - `gio.types` - ApplicationFlags and other GIO types
- - `gobject.value` - GObject Value type wrapper
- ---
- ## Resources
- - D Language Documentation: <https://dlang.org/>
- - giD Repository: <https://github.com/Kymorphia/gid>
- - giD API Documentation: <https://www.kymorphia.com/gid/>
- - giD GTK4 Examples: <https://github.com/Kymorphia/gid-gtk4-examples/>
- - giD Examples Collection: <https://codeberg.org/dejan/gid-examples/>
- - GTK4 Documentation: <https://docs.gtk.org/gtk4/>
- - D Package Registry: <https://code.dlang.org/>
- - LDC Documentation: <https://wiki.dlang.org/LDC>
- ---
- ## dub.json Configuration for giD Projects
- ```json
- {
- "name": "my-gtk4-app",
- "description": "GTK4 application with giD",
- "authors": ["Your Name"],
- "license": "MIT",
- "dependencies": {
- "gid:gtk4": "==0.9.7"
- }
- }
- ```
- **Note**: Always specify exact giD version (==0.9.x) until v1.0.0 is released.
- ---
- **Ready to begin? Start with Day 1: Introduction to D Programming!**
Advertisement
Add Comment
Please, Sign In to add comment