How deepshah232004/budgetmanager works
Project type and purpose
• This is a standalone Java desktop application (“Budget Tracker Application”) with a Swing-based GUI.
• Purpose: let end users enter incomes and expenses, categorize them, view monthly reports (including pie charts), and save/load data as JSON.
File structure
• Top-level directories:
• src/main/model – core domain objects (Budget, Category, TransactionExpense, TransactionIncome, WorkRoom, EventLog).
• src/main/persistence – JSON serialization (JsonReader, JsonWriter).
• src/main/ui – Swing UI entry points (Main, BudgetManagerUI) and tab panels (AddCategory, ExpenseTab, IncomeTab, MonthlyReportTab, PieChartTab).
• data – sample JSON files and docs.
• lib – third-party JARs (JUnit for tests, JFreeChart, JDatePicker, JSON library, SWT, etc.).
• src/test – unit tests for model and persistence.
Key architectural patterns and tech stack (from README and file tree)
• Layers: UI layer (Swing), Business Model layer (Budget, Category, Transactions), Persistence layer (JSON reader/writer).
• Observer/Event pattern: EventLog tracks application events.
• Chart generation: JFreeChart for pie charts.
• Build & Checkstyle: checkstyle.xml; IDE project file present.
Main components and interactions (
a. Frontend/UI Layer
• Main window (BudgetManagerUI)
• Tab panels: AddCategory, ExpenseTab, IncomeTab, MonthlyReportTab, PieChartTab
• User actions (button clicks, date pickers) → Controller code in BudgetManager/BudgetManagerUI
b. Business Model Layer
• WorkRoom aggregates: BudgetMap, CategoryMap, EventLog, List<TransactionExpense>, List<TransactionIncome>
• Entities: Budget, Category, Expense, Income, Event
• Model classes raise events into EventLog
c. Persistence Layer
• JsonReader and JsonWriter read/write WorkRoom and related maps to JSON files under data/
• Triggered at startup (load data prompt) and shutdown (save data prompt)
d. External Libraries
• JSON-20210307.jar for JSON parsing
• JFreeChart and JDatePicker for charting and date selection
• JUnit libraries for testing (not part of runtime flow but shown as test harness)
Architectural patterns & design principles
• Layered architecture: UI → Model → Persistence
• Single Responsibility: each package has one concern (model, persistence, UI)
• Observer/EventLog: decouple event recording from core logic
• Dependency Inversion: UI depends on interfaces of model and persistence
• “BudgetManagerUI / Main”
• “Tabs” (group AddCategory, ExpenseTab, etc.)
• “BudgetManager” (controllers)
• “WorkRoom” & contained maps/entities
• “JsonReader / JsonWriter”
• “JFreeChart” service
• “EventLog”
• UI → Controller (user actions)
• Controller → Model (create/update entities)
• Model → EventLog (record events)
• Controller → Persistence layer (load/save via JSON classes)
• Controller/Model → Chart service (pie chart generation)