---
# System prepended metadata

title: Jam 08 - Exercise 0
tags: ["2 \U0001F4DD in writing", "3 \U0001F9EA in testing", "4 \U0001F973 done"]

---

---
title: "Jam 08 - Exercise 0"
tags: 
  - 2 📝 in writing
  - 3 🧪 in testing
  - 4 🥳 done
---
<!-- markdownlint-disable line-length single-h1 no-inline-html -->
<!-- markdownlint-configure-file { "ul-indent": { "indent": 4 }, "link-fragments": {"ignore_case": true} } -->

{%hackmd dJZ5TulxSDKme-3fSY4Lbw %}

# Getting Started

Before diving into the exercises, let's set up our workspace:

1. Make sure you have committed all previous work
2. Create and switch to a new feature branch called `jam08`
3. Set up your source directory at `src/main/java/jam08`
4. Set up your test directory at `src/test/java/jam08`

:::info
🔧 **Environment Setup Tips**

- Verify your working directory is clean before creating the branch
- Check your current branch in IntelliJ's bottom-right corner
- Remember to create both main and test directories
- Review Jam 01's documentation if you need git command help

:::

## Resource Files

In this jam, you'll be working with CSV files containing stock market data. These files should be placed in the `src/main/resources/jam08` directory, not in your source code directory. This is because:

- Resource files are not source code
- They are data files needed by your program
- Gradle and Maven expect resources to be separate from source code
- This separation helps maintain a clean project structure

For example, if you have a file named `stock_data.csv`, it should go in:

```text
src/main/resources/jam08/stock_data.csv
```

Not in:

```text
src/main/java/jam08/stock_data.csv  // Wrong location!
```

### Why Separate Resources from Source Code?

1. **Build System Expectations**
    - Gradle and Maven are designed to handle resources differently from source code
    - Resources are copied as-is to the output directory
    - Source code is compiled and transformed
    - This separation makes the build process cleaner and more efficient

2. **Project Organization**
    - Source code (`src/main/java`) contains only Java files that need to be compiled
    - Resources (`src/main/resources`) contain all other files needed by your program
    - This clear separation makes it easier to:
        - Find and manage different types of files
        - Configure build tools correctly
        - Package your application for distribution

3. **Clean Project Structure**
    - Following this convention makes your project more maintainable
    - Other developers will immediately understand where to find different types of files
    - Build tools and IDEs can provide better support and features
    - Makes it easier to manage dependencies and project configuration

### Resource File Guidelines

1. **Location**: All non-source code files (data files, images, configuration files, etc.) should go in the resources directory
2. **Organization**: Keep resources organized in subdirectories matching your package structure
3. **Version Control**: Resource files should be committed to your repository - they are part of your project
4. **Access**: In your code, you can access resources using:

    ```java
    // Get a resource as a URL
    URL resourceUrl = getClass().getResource("/jam08/stock_data.csv");
   
    // Or as an input stream
    InputStream resourceStream = getClass().getResourceAsStream("/jam08/stock_data.csv");
    ```

### Common Resource Types

- Data files (CSV, JSON, XML)
- Configuration files (properties, YAML)
- Images and media files
- Template files
- Documentation files

Now that we have our workspace ready, let's begin exploring Streams and JavaFX!

# A Note About UML Diagrams

In this jam, you'll be introduced to UML Sequence Diagrams. These diagrams help visualize how objects interact over time and what messages they send to each other. You **will** be required to create a sequence diagram in Exercise 2 to model the interaction between your MVC components.

:::info
🎨 **Friday Challenge**

If you'd like to challenge yourself and earn extra credit, you can:

1. Add a simple data export feature that allows users to:
    - Export the currently displayed chart as a PNG image
    - Save the filtered/processed data as a CSV file
    - Include a timestamp and any applied filters in the export

This extra credit opportunity lets you explore JavaFX's file handling and image export capabilities while adding practical functionality to your visualization tool. Not completing it won't negatively impact your base grade.
:::
