How exora02/autochef works
Project Type & Purpose
• The README explains that Autochef is an application for managing shopping lists and recipes.
• The project uses Java 15 with Maven for dependency management and build processes.
• The runtime is primarily via JavaFX (as seen by the "mvn clean javafx:run" command and the FXML files in src/main/resources), indicating a rich graphical user interface.
• The presence of “database” packages, “model” packages (SQL models), and “util/import_export” functionality suggests that the application not only handles UI but also interacts with a structured storage (likely a SQL database or dump).
Analyzing the File Structure
• Top-level directories indicate a traditional Maven project with directories such as src/main/java, src/main/resources, and test.
• Within src/main/java/ulb/infof307/g02, the project is organized into several layers:
– The /gui directory is divided between controller and view subdirectories, which makes the use of an MVC pattern apparent. Controllers (in /controller) handle business logic connected to the UI while the views (including FXML files in src/main/resources/ulb/infof307/g02/gui/view) represent the presentation layer.
– The /model directory includes subdirectories for SQL interfaces, concrete SQL models (like ingredient_model, recipe_model, etc.), and a shared superclass for SQL-related methods. This segmentation reflects a clear separation between domain logic and data persistence.
– The /database package contains classes (DatabaseManager, DatabaseQuery, DatabaseTool) that abstract and manage the connection to and operations on the underlying database.
– The /util directory contains general utility classes (such as AlertUtils, FieldUtils, and RecipeCellFactory) and an import/export module for external interactions (e.g., JSON, PDF, email).
• Additional directories such as “doc” provide generated documentation, and “test” hosts testing classes that mirror the main project structure.
a. Main Components:
• User Interface Layer (Presentation):
– GUI Views: FXML files and JavaFX controllers (located in src/main/resources and src/main/java/…/gui/view).
– UI Controllers: Handle user events and bridge the view with the application logic (see src/main/java/…/gui/controller).
• Business Logic Layer:
– Controllers that coordinate the actions between UI and Model: login, main application controllers, recipe management controllers, scheduling, and shopping list management.
• Domain/Model Layer:
– SQL Models and domain objects for ingredients, recipes, shopping lists, stores, users, and schedules.
– Model Interfaces that abstract the concrete implementation details.
• Data Access Layer:
– Database Core: Classes such as DatabaseManager, DatabaseQuery, and DatabaseTool manage persistence.
• Utilities & External Integration:
– Utility classes for alerts, field handling, and custom cell factories.
– Import/export components handle data serialization (JSON, PDF, email integration).
• Configuration & Deployment:
– Maven (pom.xml) governs the build.
– Resources include configuration files (e.g., log4j.xml) and initial dumps for database setup.
b. Relationships and Interactions:
• The UI layer (views and their controllers) receives user input, which is then passed to the business logic controllers.
• Controllers invoke methods in the domain/model layer to retrieve or update data.
• The domain/model classes, in turn, interact with the database layer via DatabaseManager and related classes.
• Utility classes support various parts of these processes (conversion, alerting, report generation).
c. Architectural Patterns & Design Principles:
• MVC Pattern: Clearly seen in the separation of controllers, views (FXML + ViewerControllers), and data models.
• Layered Architecture: The system is divided into presentation, business, domain, and data access layers.
• Modular Design: Segregation of concerns is evident with dedicated packages for GUI, model, database, and utilities.
d. Key Technologies and Frameworks:
• Java 15 as the programming language.
• Maven for build automation and dependency management.
• JavaFX for the GUI (supported by FXML for view layouts).
• Potential use of SQL for persistence (as indicated by the SQL Model classes and database dump file).
Elements the Principal Software Engineer Should Include
• Clearly labeled components for each major layer (UI, Business Logic, Domain Model, Data Access, and Utilities).
– UI actions triggering controller methods.
– Controllers calling model methods.
– Model classes communicating with the database layer.
– Return flows from the database back to the UI through models and controllers.
– Presentation elements (e.g., rectangles for FXML views and controllers).
– Business/domain components.
– Data access objects and database communication.
– Utility functions and configuration.
• Annotations that note frameworks (JavaFX, Maven, SQL) and key design patterns (MVC, layered architecture).