ai-flow-dev 2.7.0 → 2.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +573 -570
- package/package.json +74 -74
- package/prompts/backend/flow-build-phase-0.md +535 -535
- package/prompts/backend/flow-build-phase-1.md +626 -626
- package/prompts/backend/flow-build-phase-10.md +340 -340
- package/prompts/backend/flow-build-phase-2.md +573 -573
- package/prompts/backend/flow-build-phase-3.md +834 -834
- package/prompts/backend/flow-build-phase-4.md +554 -554
- package/prompts/backend/flow-build-phase-5.md +703 -703
- package/prompts/backend/flow-build-phase-6.md +524 -524
- package/prompts/backend/flow-build-phase-7.md +1001 -1001
- package/prompts/backend/flow-build-phase-8.md +1407 -1407
- package/prompts/backend/flow-build-phase-9.md +477 -477
- package/prompts/backend/flow-build.md +137 -137
- package/prompts/backend/flow-check-review.md +656 -20
- package/prompts/backend/flow-check-test.md +526 -14
- package/prompts/backend/flow-check.md +717 -67
- package/prompts/backend/flow-commit.md +88 -119
- package/prompts/backend/flow-docs-sync.md +354 -354
- package/prompts/backend/flow-finish.md +919 -0
- package/prompts/backend/flow-release.md +949 -0
- package/prompts/backend/flow-work-feature.md +61 -61
- package/prompts/backend/flow-work-fix.md +46 -46
- package/prompts/backend/flow-work-refactor.md +48 -48
- package/prompts/backend/flow-work-resume.md +34 -34
- package/prompts/backend/flow-work.md +1098 -1286
- package/prompts/desktop/flow-build-phase-0.md +359 -359
- package/prompts/desktop/flow-build-phase-1.md +295 -295
- package/prompts/desktop/flow-build-phase-10.md +357 -357
- package/prompts/desktop/flow-build-phase-2.md +282 -282
- package/prompts/desktop/flow-build-phase-3.md +291 -291
- package/prompts/desktop/flow-build-phase-4.md +308 -308
- package/prompts/desktop/flow-build-phase-5.md +269 -269
- package/prompts/desktop/flow-build-phase-6.md +350 -350
- package/prompts/desktop/flow-build-phase-7.md +297 -297
- package/prompts/desktop/flow-build-phase-8.md +541 -541
- package/prompts/desktop/flow-build-phase-9.md +439 -439
- package/prompts/desktop/flow-build.md +156 -156
- package/prompts/desktop/flow-check-review.md +656 -20
- package/prompts/desktop/flow-check-test.md +526 -14
- package/prompts/desktop/flow-check.md +717 -67
- package/prompts/desktop/flow-commit.md +88 -119
- package/prompts/desktop/flow-docs-sync.md +354 -354
- package/prompts/desktop/flow-finish.md +919 -0
- package/prompts/desktop/flow-release.md +662 -0
- package/prompts/desktop/flow-work-feature.md +61 -61
- package/prompts/desktop/flow-work-fix.md +46 -46
- package/prompts/desktop/flow-work-refactor.md +48 -48
- package/prompts/desktop/flow-work-resume.md +34 -34
- package/prompts/desktop/flow-work.md +1202 -1390
- package/prompts/frontend/flow-build-phase-0.md +425 -425
- package/prompts/frontend/flow-build-phase-1.md +626 -626
- package/prompts/frontend/flow-build-phase-10.md +33 -33
- package/prompts/frontend/flow-build-phase-2.md +573 -573
- package/prompts/frontend/flow-build-phase-3.md +782 -782
- package/prompts/frontend/flow-build-phase-4.md +554 -554
- package/prompts/frontend/flow-build-phase-5.md +703 -703
- package/prompts/frontend/flow-build-phase-6.md +524 -524
- package/prompts/frontend/flow-build-phase-7.md +1001 -1001
- package/prompts/frontend/flow-build-phase-8.md +872 -872
- package/prompts/frontend/flow-build-phase-9.md +94 -94
- package/prompts/frontend/flow-build.md +137 -137
- package/prompts/frontend/flow-check-review.md +656 -20
- package/prompts/frontend/flow-check-test.md +526 -14
- package/prompts/frontend/flow-check.md +717 -67
- package/prompts/frontend/flow-commit.md +88 -119
- package/prompts/frontend/flow-docs-sync.md +550 -550
- package/prompts/frontend/flow-finish.md +919 -0
- package/prompts/frontend/flow-release.md +519 -0
- package/prompts/frontend/flow-work-api.md +1547 -0
- package/prompts/frontend/flow-work-feature.md +61 -61
- package/prompts/frontend/flow-work-fix.md +38 -38
- package/prompts/frontend/flow-work-refactor.md +48 -48
- package/prompts/frontend/flow-work-resume.md +34 -34
- package/prompts/frontend/flow-work.md +1595 -1320
- package/prompts/mobile/flow-build-phase-0.md +425 -425
- package/prompts/mobile/flow-build-phase-1.md +626 -626
- package/prompts/mobile/flow-build-phase-10.md +32 -32
- package/prompts/mobile/flow-build-phase-2.md +573 -573
- package/prompts/mobile/flow-build-phase-3.md +782 -782
- package/prompts/mobile/flow-build-phase-4.md +554 -554
- package/prompts/mobile/flow-build-phase-5.md +703 -703
- package/prompts/mobile/flow-build-phase-6.md +524 -524
- package/prompts/mobile/flow-build-phase-7.md +1001 -1001
- package/prompts/mobile/flow-build-phase-8.md +888 -888
- package/prompts/mobile/flow-build-phase-9.md +90 -90
- package/prompts/mobile/flow-build.md +135 -135
- package/prompts/mobile/flow-check-review.md +656 -20
- package/prompts/mobile/flow-check-test.md +526 -14
- package/prompts/mobile/flow-check.md +717 -67
- package/prompts/mobile/flow-commit.md +88 -119
- package/prompts/mobile/flow-docs-sync.md +620 -620
- package/prompts/mobile/flow-finish.md +919 -0
- package/prompts/mobile/flow-release.md +751 -0
- package/prompts/mobile/flow-work-api.md +1500 -0
- package/prompts/mobile/flow-work-feature.md +61 -61
- package/prompts/mobile/flow-work-fix.md +46 -46
- package/prompts/mobile/flow-work-refactor.md +48 -48
- package/prompts/mobile/flow-work-resume.md +34 -34
- package/prompts/mobile/flow-work.md +1605 -1329
- package/prompts/shared/mermaid-guidelines.md +102 -102
- package/prompts/shared/scope-levels.md +114 -114
- package/prompts/shared/smart-skip-preflight.md +214 -214
- package/prompts/shared/story-points.md +55 -55
- package/prompts/shared/task-format.md +74 -74
- package/prompts/shared/task-summary-template.md +277 -277
- package/templates/AGENT.template.md +443 -443
- package/templates/backend/.clauderules.template +112 -112
- package/templates/backend/.cursorrules.template +102 -102
- package/templates/backend/README.template.md +2 -2
- package/templates/backend/ai-instructions.template.md +2 -2
- package/templates/backend/copilot-instructions.template.md +2 -2
- package/templates/backend/docs/api.template.md +320 -320
- package/templates/backend/docs/business-flows.template.md +97 -97
- package/templates/backend/docs/code-standards.template.md +2 -2
- package/templates/backend/docs/contributing.template.md +3 -3
- package/templates/backend/docs/data-model.template.md +520 -520
- package/templates/backend/docs/testing.template.md +2 -2
- package/templates/backend/project-brief.template.md +2 -2
- package/templates/backend/specs/configuration.template.md +2 -2
- package/templates/backend/specs/security.template.md +2 -2
- package/templates/desktop/.clauderules.template +112 -112
- package/templates/desktop/.cursorrules.template +102 -102
- package/templates/desktop/README.template.md +170 -170
- package/templates/desktop/ai-instructions.template.md +366 -366
- package/templates/desktop/copilot-instructions.template.md +140 -140
- package/templates/desktop/docs/docs/api.template.md +320 -320
- package/templates/desktop/docs/docs/architecture.template.md +724 -724
- package/templates/desktop/docs/docs/business-flows.template.md +102 -102
- package/templates/desktop/docs/docs/code-standards.template.md +792 -792
- package/templates/desktop/docs/docs/contributing.template.md +149 -149
- package/templates/desktop/docs/docs/data-model.template.md +520 -520
- package/templates/desktop/docs/docs/operations.template.md +720 -720
- package/templates/desktop/docs/docs/testing.template.md +722 -722
- package/templates/desktop/project-brief.template.md +150 -150
- package/templates/desktop/specs/specs/configuration.template.md +121 -121
- package/templates/desktop/specs/specs/security.template.md +392 -392
- package/templates/frontend/README.template.md +2 -2
- package/templates/frontend/ai-instructions.template.md +2 -2
- package/templates/frontend/docs/api-integration.template.md +362 -362
- package/templates/frontend/docs/components.template.md +2 -2
- package/templates/frontend/docs/error-handling.template.md +360 -360
- package/templates/frontend/docs/operations.template.md +107 -107
- package/templates/frontend/docs/performance.template.md +124 -124
- package/templates/frontend/docs/pwa.template.md +119 -119
- package/templates/frontend/docs/state-management.template.md +2 -2
- package/templates/frontend/docs/styling.template.md +2 -2
- package/templates/frontend/docs/testing.template.md +2 -2
- package/templates/frontend/project-brief.template.md +2 -2
- package/templates/frontend/specs/accessibility.template.md +95 -95
- package/templates/frontend/specs/configuration.template.md +2 -2
- package/templates/frontend/specs/security.template.md +175 -175
- package/templates/fullstack/README.template.md +252 -252
- package/templates/fullstack/ai-instructions.template.md +444 -444
- package/templates/fullstack/project-brief.template.md +157 -157
- package/templates/fullstack/specs/configuration.template.md +340 -340
- package/templates/mobile/README.template.md +167 -167
- package/templates/mobile/ai-instructions.template.md +196 -196
- package/templates/mobile/docs/app-store.template.md +135 -135
- package/templates/mobile/docs/architecture.template.md +63 -63
- package/templates/mobile/docs/native-features.template.md +94 -94
- package/templates/mobile/docs/navigation.template.md +59 -59
- package/templates/mobile/docs/offline-strategy.template.md +65 -65
- package/templates/mobile/docs/permissions.template.md +56 -56
- package/templates/mobile/docs/state-management.template.md +85 -85
- package/templates/mobile/docs/testing.template.md +109 -109
- package/templates/mobile/project-brief.template.md +69 -69
- package/templates/mobile/specs/build-configuration.template.md +91 -91
- package/templates/mobile/specs/deployment.template.md +92 -92
- package/templates/work.template.md +61 -47
|
@@ -1,291 +1,291 @@
|
|
|
1
|
-
## PHASE 3: Architecture Desktop (15-20 min)
|
|
2
|
-
|
|
3
|
-
> **Order for this phase:** 3.1 → 3.2 → 3.3 → 3.4 → 3.5 → 3.6
|
|
4
|
-
|
|
5
|
-
### Objective
|
|
6
|
-
|
|
7
|
-
Define the application architecture, design patterns, and code organization for desktop applications.
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## 3.1 Architecture Pattern
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
Which architectural pattern will you use?
|
|
15
|
-
|
|
16
|
-
A) 🏗️ MVC (Model-View-Controller) - Classic separation
|
|
17
|
-
- Model: Data and business logic
|
|
18
|
-
- View: UI components (Swing/JavaFX/SWT)
|
|
19
|
-
- Controller: Event handling and coordination
|
|
20
|
-
- Best for: Traditional desktop apps
|
|
21
|
-
|
|
22
|
-
B) 📱 MVP (Model-View-Presenter) - Testable UI
|
|
23
|
-
- Model: Data layer
|
|
24
|
-
- View: Passive UI interface
|
|
25
|
-
- Presenter: UI logic and testing
|
|
26
|
-
- Best for: Apps requiring extensive UI testing
|
|
27
|
-
|
|
28
|
-
C) 🎨 MVVM (Model-View-ViewModel) - Data binding
|
|
29
|
-
- Model: Data entities
|
|
30
|
-
- View: UI (FXML, declarative)
|
|
31
|
-
- ViewModel: Observable properties
|
|
32
|
-
- Best for: JavaFX with property binding
|
|
33
|
-
|
|
34
|
-
D) 🏛️ Layered Architecture - Classic N-tier
|
|
35
|
-
- Presentation Layer (UI)
|
|
36
|
-
- Business Logic Layer (Services)
|
|
37
|
-
- Data Access Layer (DAO/Repository)
|
|
38
|
-
- Best for: Enterprise applications
|
|
39
|
-
|
|
40
|
-
E) 🔌 Plugin Architecture - Extensible
|
|
41
|
-
- Core application + plugin system
|
|
42
|
-
- Plugins loaded dynamically
|
|
43
|
-
- Best for: IDEs, tools with extensions
|
|
44
|
-
|
|
45
|
-
F) 🎯 Event-Driven - Reactive
|
|
46
|
-
- Components communicate via events
|
|
47
|
-
- EventBus or Observer pattern
|
|
48
|
-
- Best for: Loosely coupled components
|
|
49
|
-
|
|
50
|
-
Your choice: __
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
## 3.2 Package Structure
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
How will you organize your code packages?
|
|
59
|
-
|
|
60
|
-
**Classic Structure (MVC/MVP):**
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
com.company.appname/
|
|
64
|
-
├── model/ # Data entities
|
|
65
|
-
│ ├── User.java
|
|
66
|
-
│ └── Project.java
|
|
67
|
-
├── view/ # UI components
|
|
68
|
-
│ ├── MainWindow.java
|
|
69
|
-
│ └── dialogs/
|
|
70
|
-
├── controller/ # Controllers/Presenters
|
|
71
|
-
│ ├── MainController.java
|
|
72
|
-
│ └── LoginController.java
|
|
73
|
-
├── service/ # Business logic
|
|
74
|
-
│ ├── UserService.java
|
|
75
|
-
│ └── ProjectService.java
|
|
76
|
-
├── dao/ # Data access
|
|
77
|
-
│ ├── UserDAO.java
|
|
78
|
-
│ └── ProjectDAO.java
|
|
79
|
-
└── util/ # Utilities
|
|
80
|
-
├── DateUtil.java
|
|
81
|
-
└── FileUtil.java
|
|
82
|
-
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
**JavaFX Structure (MVVM):**
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
com.company.appname/
|
|
89
|
-
├── model/ # Data models
|
|
90
|
-
├── view/ # FXML files (in resources/)
|
|
91
|
-
├── viewmodel/ # ViewModels with properties
|
|
92
|
-
├── controller/ # FXML controllers
|
|
93
|
-
├── service/ # Business services
|
|
94
|
-
└── repository/ # Data repositories
|
|
95
|
-
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
**Plugin Structure:**
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
com.company.appname/
|
|
102
|
-
├── core/ # Core application
|
|
103
|
-
│ ├── Application.java
|
|
104
|
-
│ └── PluginManager.java
|
|
105
|
-
├── plugin/ # Plugin API
|
|
106
|
-
│ └── IPlugin.java
|
|
107
|
-
├── plugins/ # Plugin implementations
|
|
108
|
-
│ ├── pdf/
|
|
109
|
-
│ └── excel/
|
|
110
|
-
├── ui/ # UI components
|
|
111
|
-
└── service/ # Core services
|
|
112
|
-
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
Which structure fits your needs? (Or describe custom):
|
|
116
|
-
__
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
## 3.3 Threading Model
|
|
122
|
-
|
|
123
|
-
```
|
|
124
|
-
Desktop applications must handle UI responsiveness. How will you manage threading?
|
|
125
|
-
|
|
126
|
-
**UI Thread (Event Dispatch Thread):**
|
|
127
|
-
- Swing: SwingUtilities.invokeLater()
|
|
128
|
-
- JavaFX: Platform.runLater()
|
|
129
|
-
- SWT: Display.asyncExec()
|
|
130
|
-
|
|
131
|
-
**Background Tasks:**
|
|
132
|
-
A) SwingWorker (Swing) - Background task with progress
|
|
133
|
-
B) Task/Service (JavaFX) - JavaFX background tasks
|
|
134
|
-
C) ExecutorService - Custom thread pools
|
|
135
|
-
D) CompletableFuture - Async operations (Java 8+)
|
|
136
|
-
E) Virtual Threads - Project Loom (Java 21+)
|
|
137
|
-
|
|
138
|
-
Your threading strategy:
|
|
139
|
-
A) ✅ All long-running operations in background threads
|
|
140
|
-
B) 🔄 Progress indicators for tasks > 1 second
|
|
141
|
-
C) ❌ Blocking UI (not recommended)
|
|
142
|
-
|
|
143
|
-
Concurrency patterns:
|
|
144
|
-
A) Producer-Consumer (queue-based)
|
|
145
|
-
B) Future/Promise (async results)
|
|
146
|
-
C) Observer (event notifications)
|
|
147
|
-
D) Synchronized collections
|
|
148
|
-
|
|
149
|
-
Your choices: __
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
---
|
|
153
|
-
|
|
154
|
-
## 3.4 Event Handling
|
|
155
|
-
|
|
156
|
-
```
|
|
157
|
-
How will components communicate?
|
|
158
|
-
|
|
159
|
-
**Swing Event Handling:**
|
|
160
|
-
A) ActionListener - Button clicks
|
|
161
|
-
B) DocumentListener - Text changes
|
|
162
|
-
C) PropertyChangeListener - Property changes
|
|
163
|
-
D) Custom EventListener - Domain events
|
|
164
|
-
|
|
165
|
-
**JavaFX Event Handling:**
|
|
166
|
-
A) EventHandler<ActionEvent> - Button clicks
|
|
167
|
-
B) ChangeListener - Observable property changes
|
|
168
|
-
C) InvalidationListener - Observable invalidation
|
|
169
|
-
D) Custom events with EventBus
|
|
170
|
-
|
|
171
|
-
**SWT Event Handling:**
|
|
172
|
-
A) SelectionListener - Widget selections
|
|
173
|
-
B) ModifyListener - Text modifications
|
|
174
|
-
C) FocusListener - Focus changes
|
|
175
|
-
D) Custom events
|
|
176
|
-
|
|
177
|
-
**Event Bus Libraries:**
|
|
178
|
-
A) EventBus (Guava) - Simple pub/sub
|
|
179
|
-
B) MBassador - High-performance event bus
|
|
180
|
-
C) Custom Observer pattern
|
|
181
|
-
|
|
182
|
-
Your event strategy: __
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
---
|
|
186
|
-
|
|
187
|
-
## 3.5 Dependency Injection
|
|
188
|
-
|
|
189
|
-
```
|
|
190
|
-
Will you use Dependency Injection?
|
|
191
|
-
|
|
192
|
-
A) ✅ Yes - Framework-based
|
|
193
|
-
- Spring Framework (Desktop edition)
|
|
194
|
-
- Google Guice
|
|
195
|
-
- CDI (Weld SE)
|
|
196
|
-
|
|
197
|
-
B) ✅ Yes - Manual
|
|
198
|
-
- Constructor injection
|
|
199
|
-
- Factory pattern
|
|
200
|
-
- Service locator
|
|
201
|
-
|
|
202
|
-
C) ❌ No - Direct instantiation
|
|
203
|
-
- new MyService()
|
|
204
|
-
- Singleton pattern
|
|
205
|
-
|
|
206
|
-
Your choice: __
|
|
207
|
-
|
|
208
|
-
If yes, how will you manage dependencies?
|
|
209
|
-
- Scopes: Singleton, Prototype
|
|
210
|
-
- Lifecycle: Initialization, cleanup
|
|
211
|
-
- Configuration: Annotations vs XML
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
---
|
|
215
|
-
|
|
216
|
-
## 3.6 Error Handling
|
|
217
|
-
|
|
218
|
-
```
|
|
219
|
-
How will you handle errors and exceptions?
|
|
220
|
-
|
|
221
|
-
**Global Exception Handler:**
|
|
222
|
-
A) ✅ Yes - Catch all uncaught exceptions
|
|
223
|
-
- Swing: Thread.setDefaultUncaughtExceptionHandler()
|
|
224
|
-
- JavaFX: Thread.setDefaultUncaughtExceptionHandler()
|
|
225
|
-
- Show error dialog to user
|
|
226
|
-
- Log to file
|
|
227
|
-
|
|
228
|
-
B) ❌ No - Handle locally
|
|
229
|
-
|
|
230
|
-
**Error Dialog Strategy:**
|
|
231
|
-
A) 🔴 Error Dialog - Show details, allow reporting
|
|
232
|
-
B) 🎨 Toast Notification - Non-intrusive for minor errors
|
|
233
|
-
C) 📝 Status Bar - Show error message
|
|
234
|
-
D) 📋 Log only - Silent errors, check logs
|
|
235
|
-
|
|
236
|
-
**Logging:**
|
|
237
|
-
A) SLF4J + Logback - Industry standard
|
|
238
|
-
B) Log4j2 - Apache logging
|
|
239
|
-
C) java.util.logging - Built-in
|
|
240
|
-
D) Custom logging
|
|
241
|
-
|
|
242
|
-
Log levels:
|
|
243
|
-
- TRACE - Detailed debug
|
|
244
|
-
- DEBUG - Development info
|
|
245
|
-
- INFO - General info
|
|
246
|
-
- WARN - Warning messages
|
|
247
|
-
- ERROR - Error messages
|
|
248
|
-
|
|
249
|
-
Your choices: __
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
---
|
|
253
|
-
|
|
254
|
-
### Phase 3 Output
|
|
255
|
-
|
|
256
|
-
```
|
|
257
|
-
📋 PHASE 3 SUMMARY:
|
|
258
|
-
|
|
259
|
-
Architecture Pattern: [MVC/MVP/MVVM/Layered/Plugin/Event-Driven]
|
|
260
|
-
Package Structure: [Described above]
|
|
261
|
-
Threading Model: [SwingWorker, Task, ExecutorService]
|
|
262
|
-
Event Handling: [ActionListener, EventBus, etc.]
|
|
263
|
-
Dependency Injection: [Spring/Guice/Manual/None]
|
|
264
|
-
Error Handling: [Global handler, error dialogs, logging strategy]
|
|
265
|
-
|
|
266
|
-
Is this correct? (Yes/No)
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
---
|
|
270
|
-
|
|
271
|
-
### 📄 Update Documents
|
|
272
|
-
|
|
273
|
-
Update `docs/ARCHITECTURE.md` with:
|
|
274
|
-
|
|
275
|
-
- Architecture pattern diagram
|
|
276
|
-
- Package structure
|
|
277
|
-
- Threading model and best practices
|
|
278
|
-
- Event handling flow
|
|
279
|
-
- Dependency injection configuration
|
|
280
|
-
- Error handling strategy
|
|
281
|
-
|
|
282
|
-
---
|
|
283
|
-
|
|
284
|
-
**Next Phase:** Phase 4 - Data & Storage (15-20 min)
|
|
285
|
-
|
|
286
|
-
Read: `.ai-flow/prompts/desktop/flow-build-phase-4.md`
|
|
287
|
-
|
|
288
|
-
---
|
|
289
|
-
|
|
290
|
-
**Last Updated:** 2025-02-03
|
|
291
|
-
**Version:** 1.0.0
|
|
1
|
+
## PHASE 3: Architecture Desktop (15-20 min)
|
|
2
|
+
|
|
3
|
+
> **Order for this phase:** 3.1 → 3.2 → 3.3 → 3.4 → 3.5 → 3.6
|
|
4
|
+
|
|
5
|
+
### Objective
|
|
6
|
+
|
|
7
|
+
Define the application architecture, design patterns, and code organization for desktop applications.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 3.1 Architecture Pattern
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
Which architectural pattern will you use?
|
|
15
|
+
|
|
16
|
+
A) 🏗️ MVC (Model-View-Controller) - Classic separation
|
|
17
|
+
- Model: Data and business logic
|
|
18
|
+
- View: UI components (Swing/JavaFX/SWT)
|
|
19
|
+
- Controller: Event handling and coordination
|
|
20
|
+
- Best for: Traditional desktop apps
|
|
21
|
+
|
|
22
|
+
B) 📱 MVP (Model-View-Presenter) - Testable UI
|
|
23
|
+
- Model: Data layer
|
|
24
|
+
- View: Passive UI interface
|
|
25
|
+
- Presenter: UI logic and testing
|
|
26
|
+
- Best for: Apps requiring extensive UI testing
|
|
27
|
+
|
|
28
|
+
C) 🎨 MVVM (Model-View-ViewModel) - Data binding
|
|
29
|
+
- Model: Data entities
|
|
30
|
+
- View: UI (FXML, declarative)
|
|
31
|
+
- ViewModel: Observable properties
|
|
32
|
+
- Best for: JavaFX with property binding
|
|
33
|
+
|
|
34
|
+
D) 🏛️ Layered Architecture - Classic N-tier
|
|
35
|
+
- Presentation Layer (UI)
|
|
36
|
+
- Business Logic Layer (Services)
|
|
37
|
+
- Data Access Layer (DAO/Repository)
|
|
38
|
+
- Best for: Enterprise applications
|
|
39
|
+
|
|
40
|
+
E) 🔌 Plugin Architecture - Extensible
|
|
41
|
+
- Core application + plugin system
|
|
42
|
+
- Plugins loaded dynamically
|
|
43
|
+
- Best for: IDEs, tools with extensions
|
|
44
|
+
|
|
45
|
+
F) 🎯 Event-Driven - Reactive
|
|
46
|
+
- Components communicate via events
|
|
47
|
+
- EventBus or Observer pattern
|
|
48
|
+
- Best for: Loosely coupled components
|
|
49
|
+
|
|
50
|
+
Your choice: __
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 3.2 Package Structure
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
How will you organize your code packages?
|
|
59
|
+
|
|
60
|
+
**Classic Structure (MVC/MVP):**
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
com.company.appname/
|
|
64
|
+
├── model/ # Data entities
|
|
65
|
+
│ ├── User.java
|
|
66
|
+
│ └── Project.java
|
|
67
|
+
├── view/ # UI components
|
|
68
|
+
│ ├── MainWindow.java
|
|
69
|
+
│ └── dialogs/
|
|
70
|
+
├── controller/ # Controllers/Presenters
|
|
71
|
+
│ ├── MainController.java
|
|
72
|
+
│ └── LoginController.java
|
|
73
|
+
├── service/ # Business logic
|
|
74
|
+
│ ├── UserService.java
|
|
75
|
+
│ └── ProjectService.java
|
|
76
|
+
├── dao/ # Data access
|
|
77
|
+
│ ├── UserDAO.java
|
|
78
|
+
│ └── ProjectDAO.java
|
|
79
|
+
└── util/ # Utilities
|
|
80
|
+
├── DateUtil.java
|
|
81
|
+
└── FileUtil.java
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**JavaFX Structure (MVVM):**
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
com.company.appname/
|
|
89
|
+
├── model/ # Data models
|
|
90
|
+
├── view/ # FXML files (in resources/)
|
|
91
|
+
├── viewmodel/ # ViewModels with properties
|
|
92
|
+
├── controller/ # FXML controllers
|
|
93
|
+
├── service/ # Business services
|
|
94
|
+
└── repository/ # Data repositories
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Plugin Structure:**
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
com.company.appname/
|
|
102
|
+
├── core/ # Core application
|
|
103
|
+
│ ├── Application.java
|
|
104
|
+
│ └── PluginManager.java
|
|
105
|
+
├── plugin/ # Plugin API
|
|
106
|
+
│ └── IPlugin.java
|
|
107
|
+
├── plugins/ # Plugin implementations
|
|
108
|
+
│ ├── pdf/
|
|
109
|
+
│ └── excel/
|
|
110
|
+
├── ui/ # UI components
|
|
111
|
+
└── service/ # Core services
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Which structure fits your needs? (Or describe custom):
|
|
116
|
+
__
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## 3.3 Threading Model
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
Desktop applications must handle UI responsiveness. How will you manage threading?
|
|
125
|
+
|
|
126
|
+
**UI Thread (Event Dispatch Thread):**
|
|
127
|
+
- Swing: SwingUtilities.invokeLater()
|
|
128
|
+
- JavaFX: Platform.runLater()
|
|
129
|
+
- SWT: Display.asyncExec()
|
|
130
|
+
|
|
131
|
+
**Background Tasks:**
|
|
132
|
+
A) SwingWorker (Swing) - Background task with progress
|
|
133
|
+
B) Task/Service (JavaFX) - JavaFX background tasks
|
|
134
|
+
C) ExecutorService - Custom thread pools
|
|
135
|
+
D) CompletableFuture - Async operations (Java 8+)
|
|
136
|
+
E) Virtual Threads - Project Loom (Java 21+)
|
|
137
|
+
|
|
138
|
+
Your threading strategy:
|
|
139
|
+
A) ✅ All long-running operations in background threads
|
|
140
|
+
B) 🔄 Progress indicators for tasks > 1 second
|
|
141
|
+
C) ❌ Blocking UI (not recommended)
|
|
142
|
+
|
|
143
|
+
Concurrency patterns:
|
|
144
|
+
A) Producer-Consumer (queue-based)
|
|
145
|
+
B) Future/Promise (async results)
|
|
146
|
+
C) Observer (event notifications)
|
|
147
|
+
D) Synchronized collections
|
|
148
|
+
|
|
149
|
+
Your choices: __
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 3.4 Event Handling
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
How will components communicate?
|
|
158
|
+
|
|
159
|
+
**Swing Event Handling:**
|
|
160
|
+
A) ActionListener - Button clicks
|
|
161
|
+
B) DocumentListener - Text changes
|
|
162
|
+
C) PropertyChangeListener - Property changes
|
|
163
|
+
D) Custom EventListener - Domain events
|
|
164
|
+
|
|
165
|
+
**JavaFX Event Handling:**
|
|
166
|
+
A) EventHandler<ActionEvent> - Button clicks
|
|
167
|
+
B) ChangeListener - Observable property changes
|
|
168
|
+
C) InvalidationListener - Observable invalidation
|
|
169
|
+
D) Custom events with EventBus
|
|
170
|
+
|
|
171
|
+
**SWT Event Handling:**
|
|
172
|
+
A) SelectionListener - Widget selections
|
|
173
|
+
B) ModifyListener - Text modifications
|
|
174
|
+
C) FocusListener - Focus changes
|
|
175
|
+
D) Custom events
|
|
176
|
+
|
|
177
|
+
**Event Bus Libraries:**
|
|
178
|
+
A) EventBus (Guava) - Simple pub/sub
|
|
179
|
+
B) MBassador - High-performance event bus
|
|
180
|
+
C) Custom Observer pattern
|
|
181
|
+
|
|
182
|
+
Your event strategy: __
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## 3.5 Dependency Injection
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
Will you use Dependency Injection?
|
|
191
|
+
|
|
192
|
+
A) ✅ Yes - Framework-based
|
|
193
|
+
- Spring Framework (Desktop edition)
|
|
194
|
+
- Google Guice
|
|
195
|
+
- CDI (Weld SE)
|
|
196
|
+
|
|
197
|
+
B) ✅ Yes - Manual
|
|
198
|
+
- Constructor injection
|
|
199
|
+
- Factory pattern
|
|
200
|
+
- Service locator
|
|
201
|
+
|
|
202
|
+
C) ❌ No - Direct instantiation
|
|
203
|
+
- new MyService()
|
|
204
|
+
- Singleton pattern
|
|
205
|
+
|
|
206
|
+
Your choice: __
|
|
207
|
+
|
|
208
|
+
If yes, how will you manage dependencies?
|
|
209
|
+
- Scopes: Singleton, Prototype
|
|
210
|
+
- Lifecycle: Initialization, cleanup
|
|
211
|
+
- Configuration: Annotations vs XML
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## 3.6 Error Handling
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
How will you handle errors and exceptions?
|
|
220
|
+
|
|
221
|
+
**Global Exception Handler:**
|
|
222
|
+
A) ✅ Yes - Catch all uncaught exceptions
|
|
223
|
+
- Swing: Thread.setDefaultUncaughtExceptionHandler()
|
|
224
|
+
- JavaFX: Thread.setDefaultUncaughtExceptionHandler()
|
|
225
|
+
- Show error dialog to user
|
|
226
|
+
- Log to file
|
|
227
|
+
|
|
228
|
+
B) ❌ No - Handle locally
|
|
229
|
+
|
|
230
|
+
**Error Dialog Strategy:**
|
|
231
|
+
A) 🔴 Error Dialog - Show details, allow reporting
|
|
232
|
+
B) 🎨 Toast Notification - Non-intrusive for minor errors
|
|
233
|
+
C) 📝 Status Bar - Show error message
|
|
234
|
+
D) 📋 Log only - Silent errors, check logs
|
|
235
|
+
|
|
236
|
+
**Logging:**
|
|
237
|
+
A) SLF4J + Logback - Industry standard
|
|
238
|
+
B) Log4j2 - Apache logging
|
|
239
|
+
C) java.util.logging - Built-in
|
|
240
|
+
D) Custom logging
|
|
241
|
+
|
|
242
|
+
Log levels:
|
|
243
|
+
- TRACE - Detailed debug
|
|
244
|
+
- DEBUG - Development info
|
|
245
|
+
- INFO - General info
|
|
246
|
+
- WARN - Warning messages
|
|
247
|
+
- ERROR - Error messages
|
|
248
|
+
|
|
249
|
+
Your choices: __
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
### Phase 3 Output
|
|
255
|
+
|
|
256
|
+
```
|
|
257
|
+
📋 PHASE 3 SUMMARY:
|
|
258
|
+
|
|
259
|
+
Architecture Pattern: [MVC/MVP/MVVM/Layered/Plugin/Event-Driven]
|
|
260
|
+
Package Structure: [Described above]
|
|
261
|
+
Threading Model: [SwingWorker, Task, ExecutorService]
|
|
262
|
+
Event Handling: [ActionListener, EventBus, etc.]
|
|
263
|
+
Dependency Injection: [Spring/Guice/Manual/None]
|
|
264
|
+
Error Handling: [Global handler, error dialogs, logging strategy]
|
|
265
|
+
|
|
266
|
+
Is this correct? (Yes/No)
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
### 📄 Update Documents
|
|
272
|
+
|
|
273
|
+
Update `docs/ARCHITECTURE.md` with:
|
|
274
|
+
|
|
275
|
+
- Architecture pattern diagram
|
|
276
|
+
- Package structure
|
|
277
|
+
- Threading model and best practices
|
|
278
|
+
- Event handling flow
|
|
279
|
+
- Dependency injection configuration
|
|
280
|
+
- Error handling strategy
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
**Next Phase:** Phase 4 - Data & Storage (15-20 min)
|
|
285
|
+
|
|
286
|
+
Read: `.ai-flow/prompts/desktop/flow-build-phase-4.md`
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
**Last Updated:** 2025-02-03
|
|
291
|
+
**Version:** 1.0.0
|