How cala-br/jsheets works
Project Type & Purpose
• This is a Java-based spreadsheet application built as an object-oriented project for an OOP exam. It implements spreadsheet functionalities (such as different cell types, expression evaluation, and event-based updates) and includes a rich UI built with various components.
• The purpose is to demonstrate an extensive use of OOP principles by organizing the code into packages that encapsulate UI, data models, expression evaluation, event handling, and various supporting services.
Breakdown of the File Structure
• Top-Level Directories:
▪ cells — manages different types of spreadsheet cells (TextCell, NumericCell, ExpressionCell, etc.).
▪ events — defines custom events (actions, cell updates, selections) used for handling user interactions and state changes.
▪ expressions — comprises the classes for parsing and evaluating spreadsheet expressions (tokenizer, expression tree, operator implementations, operands, and operations).
▪ frames — provides the main window (MainFrame) that hosts the UI components.
▪ model — includes the business/data logic models (RowHeaderModel, WorkSheetModel).
▪ services — contains service layers for operations such as file storage, session management, font management, and worksheet management, which abstract backend functionalities.
▪ util — maintains helper classes and utility methods that support the core logic.
• docs: Contains generated HTML documentation (and additional resources) for classes and packages, which can be referred to for details on component responsibilities.
• assets, Makefile, and configuration files are used for build and deployment.
a. Main Components:
• UI Layer:
• MainFrame (from frames), various dialogs (ErrorDialog, FileAlreadyExistsDialog, etc.), top bar/menu components, spreadsheet and worksheet UI components.
• Core Logic Layer:
• Cells: Different cell implementations (Text, Numeric, Expression, etc.)
• Models: WorkSheetModel and RowHeaderModel that represent the data.
• Expression Engine: Expression, ExpressionTokenizer, ExpressionTree, operations and operands.
• Event Handling:
• Custom event classes (e.g., ActionEvent, CellEditedEventArgs) that connect UI actions to model changes.
• Services Layer:
• ServiceRepository and individual services (Storage, Session, Font, WorksheetManager) provide backend functionality.
• Utilities:
• Helper classes and utility methods that support different parts of the application.
b. Relationships & Interactions:
• The UI components (in the components and frames packages) handle user interactions which fire events (in the events package).
• These events are propagated to service classes (in the services package) and model classes (in the model package) to update or retrieve data.
• The Expression Engine (in the expressions package) is used by cells when parsing and calculating cell content.
• There is a cyclic interaction: UI → Events → Model/Services → Update UI.
c. Architectural Patterns & Design Principles:
• Separation of Concerns: Clear division between presentation (UI), business logic (models, cells, expression engine), and backend services.
• Event-Driven Architecture: Use of event classes to decouple UI interactions from core logic updates.
d. Relevant Technologies & Frameworks:
• Java is the primary language.
• Likely use of Java Swing or a similar framework isn’t explicitly mentioned but is implied by the presence of UI components (dialogs, main frame, etc.).
• The Makefile implies a standardized build process.
Elements
• Components Labeled Clearly:
• Name each package/group (e.g., “UI Components”, “Spreadsheet Cells”, “Expression Evaluation”, “Event Handling”, “Service Layer”).
• How services are invoked by the UI or model to perform operations (like loading files or saving sessions).
• Visual Differentiation:
• A high-level view that shows major components and then break down each component (for example, showing details of the expression engine and its subcomponents).
Detailed Steps for the Principal Software Engineer
• UI Layer (MainFrame, dialogs, top bar, spreadsheet view)
• Business Logic (Cells, Models, Expression Engine, Event processing)
• Service Layer (File storage, session management, etc.)
• Utilities (Helper functions).
• For each layer:
• Main classes or packages and represent them as nodes.