How abhiraa/dataanalyticshub works
Project Type and Purpose
• This is a desktop full-stack MVC application built with JavaFX, using an embedded SQLite database for persistence, and JUnit for testing.
• Key functions: user/profile management, posting, CSV import, data analytics (pie charts, dashboards).
Top-Level Architectural Layers
• Presentation Layer (JavaFX UI)
• Controller Layer (UserController, PostController)
• Service Layer (UserService, PostService, ServiceFactory)
• Data Access Layer (DAO classes and DBManager)
• Persistence (SQLite database)
• Utilities & Exceptions
• External Libraries (javafx-sdk-21, sqlite-jdbc)
Main Components & Boundaries
a. Presentation (UI)
• JavaFX Views (LoginView, DashboardView, PostListView, etc.)
• GUIViewFacade (Facade Pattern) providing a simple interface for the views to call controllers.
b. Controllers
• UserController, PostController coordinate between Views and Services.
c. Service Layer
• UserService & PostService interfaces with implementations (Impl).
• ServiceFactory (Factory Pattern) to obtain service instances.
d. Data Access Layer
• DAOs: UserDAO, PostDAO for CRUD operations.
• DBManager (Singleton Pattern) managing the JDBC connection to the SQLite file DataAnalyticsHub.db.
e. Persistence
• SQLite database file under src/database.
f. Utilities & Exceptions
• CSVUtils, PasswordUtils, FileChooserUtils under utils.
• Custom exceptions under exceptions.
g. External Dependencies
• JavaFX runtime (javafx-sdk-21 jars)
• sqlite-jdbc-3.43.0.0.jar
Data Flow & Interactions
1) Application Start
• Main.java initializes JavaFX Application and shows LoginView via GUIViewFacade.
2) User Interaction
• User clicks on a View’s GUI control → View invokes a method on GUIViewFacadeInterface.
• GUIViewFacade routes call to the appropriate Controller.
3) Controller Layer
• Controller (e.g., UserController) processes input → calls Service layer via ServiceFactory.
4) Service Layer
• ServiceImpl applies business logic (e.g., password hashing via PasswordUtils) → calls DAO.
5) DAO & DBManager
• DAO uses DBManager’s singleton JDBC connection to execute SQL on the SQLite database.
• Data returns up the chain to Service → Controller → View.
6) Utilities
• CSVUtils reads/writes CSV files for bulk import/export.
7) Testing
• JUnit test classes bypass UI; instantiate Services and DAOs directly, using test data CSVs in src/csv.
Architectural Patterns & Principles
• MVC Pattern: clear separation of Models, Views, Controllers.
• Facade Pattern: GUIViewFacade hides complex controller interactions from Views.
• Factory Pattern: ServiceFactory centralizes creation of service objects.
• Singleton Pattern: DBManager ensures a single database connection.
• Layered Architecture: UI → Controllers → Services → DAOs → DB.
Final Checklist
• All layers and components separated and labeled clearly.
• Pattern annotations (Facade, Factory, Singleton, MVC).
• External libs and resources depicted.
• Utility modules and exception handling paths shown.