> For the complete documentation index, see [llms.txt](https://azuriohs-organization.gitbook.io/r-type/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://azuriohs-organization.gitbook.io/r-type/subsystems/create-your-subsystems/step-1-create-your-interfaces.md).

# Step 1 - Create your interfaces

In this step, we will define the interfaces that your subsystem will implement. This includes the core functionality and any necessary methods for interaction with other subsystems or components.

***

## 🧑‍💻 Define Your Interfaces

When creating a subsystem, it's essential to establish clear interfaces that outline the expected behavior and interactions. Below is an example for defining your subsystem interfaces.

```cpp
// IExampleSubsystem.h
#pragma once

class IExampleSubsystem {
    public:
        virtual ~IExampleSubsystem() = default;
        virtual void Initialize() = 0; // Method to initialize the subsystem
        virtual void Update(float deltaTime) = 0; // Method to update the subsystem each
        virtual void Shutdown() = 0; // Method to clean up resources
};
```

### 📚 Document Your Interfaces

Make sure to document each method in your interface, using doxygen, to clarify its purpose and usage. This will help other developers understand how to interact with your subsystem.

```cpp
// IExampleSubsystem.h
#pragma once

/**
 * @brief Interface for the Example Subsystem.
 * This interface defines the core methods that any implementation of the Example Subsystem must provide.
 */
class IExampleSubsystem {
    public:
        /**
         * @brief Virtual destructor to ensure proper cleanup of derived classes.
         */
        virtual ~IExampleSubsystem() = default;

        /**
         * @brief Initializes the subsystem.
         * This method should set up any necessary resources or state.
         */
        virtual void Initialize() = 0;

        /**
         * @brief Updates the subsystem.
         * @param deltaTime The time elapsed since the last update call.
         * This method should contain the logic that needs to be executed each frame.
         */
        virtual void Update(float deltaTime) = 0;

        /**
         * @brief Shuts down the subsystem.
         * This method should clean up any resources and prepare for shutdown.
         */
        virtual void Shutdown() = 0;
};
```

### 🧩 Additional Considerations

* **Modularity**: Ensure that your interfaces are designed to be modular and can be easily extended or modified in the future.
* **Interoperability**: Consider how your subsystem will interact with other subsystems and components. Define methods that facilitate communication and data exchange.
* **Error Handling**: Think about how your subsystem will handle errors and exceptions. You may want to include methods for logging or reporting issues.
* **Performance**: Keep performance in mind when designing your interfaces. Avoid unnecessary complexity that could lead to performance bottlenecks.
* **Testing**: Design your interfaces with testing in mind. Ensure that they can be easily mocked or stubbed for unit testing purposes.

> Once you have defined your interfaces, you can proceed to the next step: [Setup your subsystems in the lib directory](https://github.com/Azurioh/R-Type/blob/docs/subsystems/create-your-subsystems/subsystems/create-your-subsystems/step-2-setup-your-subsystems-in-the-lib-directory.md).
