How pablohernandezm/ed20232-arreglos works
Main components
• Main Application Entry Point – Represented by Main.java, this component drives the program’s execution.
• Domain Model – The Producto (or “Item” entity) defines the data model with fields such as ItemID, Nombre, Proveedor, Tipo and Precio.
• Data Management Utility – ItemList (and possibly related utility classes) encapsulates the management of the fixed-size array, handling operations like insertion, deletion, updating, listing, sorting, and searching.
• Persistence Module – Even though the persistence is file-based (using items_Amazon.txt) rather than a database, it should be represented as a component responsible for reading from and writing to the text file.
• Testing Suite – Components in the src/test directories ensure that each of the functions in ItemList and potentially Main are covered by unit tests.
Relationships and Interactions
• The Main application (controller) interacts with the data management utility (ItemList) to execute business logic.
• The ItemList Utility directly manipulates the array of Producto objects (the domain model) and enforces the business rules (e.g., unique ItemIDs, size limited to 50 elements).
• The persistence module is used by ItemList (or a dedicated persistence handler) to load initial data from and save data to a text file.
• Unit tests (in the test package) simulate various use cases and verify operations on the core components.
Important Architectural Patterns and Design Principles
• Although this is a small-scale prototype, it benefits from a separation of concerns:
• Presentation/Control logic (Main).
• Business/Data management logic (ItemList and the associated operations).
• Data representation (Producto as part of the Domain Model).
• Persistence mechanism for file I/O.
• The system employs a simple layered design even if not explicitly stated (for instance, the persistence details are abstracted away from the business logic).
Technologies and Frameworks
• JUnit or similar frameworks are used for unit testing (as seen from the test package structure).
• Plain text file I/O is used for persistent storage (items_Amazon.txt).
• Component 1: Main Application (Main.java)
– Entry point and user-interface handling.
– Sends commands to the business logic layer (ItemList).
• Component 2: Business Logic & Data Management (ItemList.java)
– Manages the array of Producto objects.
– Implements add, delete, search, update, sort functionalities.
• Component 3: Domain Model (Producto.java)
– Represents an individual office supply item with its attributes.
• Component 4: Persistence Mechanism
– Responsible for loading from and writing to the “items_Amazon.txt” file.
• Component 5: Testing Suite
– Contains unit tests that verify the functionality of each operation.