How jukisyuri/bookstore_projectctdl works
Main Components
• Data Layer:
• Data Files: Represented by the text files (e.g., customer_account.txt, listbook.txt) in the src/data directory.
• File I/O Utilities: Include FileLoader.java and FileWriter.java for reading and writing data.
• Business Logic Layer (Model):
• Domain Models: Classes like Book.java, Customer.java, Order.java.
• Managers: Classes managing domain logic such as BookManager.java, CustomerManager.java, OrderManager.java, and OrderBook.java.
• Central System Logic: MainSystem.java, Model.java, and IModel.java which likely define the core interactions and contracts between the various model components.
• Utility Components:
• Additional Helpers: AnalyzeDate.java for date formatting/validation, TextPrompt.java, and even ToolRandomAccount.js (an external helper script/tool) that might be used to generate random account-related data.
• Presentation Layer (View):
• GUI Components: The view is built with Java Swing. This includes MainFrame.java as the main container and specific panels (BookManagerPanel.java, BookStoreManagerPanel.java, CustomerManagerPanel.java, OrderManagerPanel.java) that provide the user interface for each module.
Relationships and Interactions
• The Presentation layer (views) interacts with the Business Logic layer (model) to perform actions such as adding, editing, or deleting books, customers, and orders. For instance, button actions on BookManagerPanel trigger updates via BookManager.java.
• The Business Logic layer uses Utility methods (FileLoader/FileWriter) to persist and retrieve data from the text files in the Data layer.
• The central MainSystem.java likely coordinates the overall flow between the GUI and the underlying model, ensuring that user actions are correctly processed and changes are stored.
Architectural Patterns and Design Principles
• Layered Architecture: Clearly separating presentation (Swing views), business logic (models and managers), and data (text files).
• MVC-Like Approach: Although there isn’t an explicit controller directory, the MainSystem component acts as a coordination hub between the view and model. The panels act as views while model classes encapsulate the business logic.
• Single Responsibility: Each component (e.g., FileWriter, FileLoader, model managers) is designated for specific tasks, ensuring clear separation of concerns.
Technologies and Frameworks
• Programming Language: Java.
• GUI Framework: Java Swing.
• Data Persistence: Simple text file storage.
• Additional Scripts: Inclusion of a JavaScript file (ToolRandomAccount.js) which might be used for generating random account data, suggesting a utility role external to the Java main application.