solanaj icon indicating copy to clipboard operation
solanaj copied to clipboard

TODO/Recommendations for SolanaJ (from the AI)

Open skynetcap opened this issue 5 months ago • 0 comments

1. Upgrade to Java 21:

  • Action: Migrate the codebase to Java 21 to access the latest features and improvements.
  • Benefit: Enhances performance, enables use of modern language features, and benefits from long-term support.
  • Consideration: Offer a compatibility layer or maintain a separate branch for users on older JDK versions, acknowledging that some companies adopt new versions slowly.

2. Refactor Exception Handling:

  • Action: Replace exception-based control flow with Optional, Either, or custom result types.
  • Benefit: Improves performance and code clarity, making error handling more predictable and functional.

3. Integrate Borsh Utility Classes:

  • Action: Implement Borsh serialization/deserialization utilities within SolanaJ.
  • Benefit: Ensures compatibility with Solana's data formats and simplifies interactions with on-chain programs.

4. Adopt Modern Java Features:

  • Action: Utilize features like records, sealed classes, and enhanced switch expressions.
  • Benefit: Reduces boilerplate code, improves type safety, and enhances readability.

5. Use Standard Java HTTP Client:

  • Action: Switch from OkHttp to java.net.http.HttpClient.
  • Benefit: Reduces external dependencies and leverages built-in HTTP/2 support and asynchronous capabilities.

6. Enhance Testing and Documentation:

  • Action: Write unit tests for all new methods and classes.
  • Action: Add Javadoc comments to all classes and methods.
  • Benefit: Improves code reliability and makes the library more approachable for users.

7. Codebase Cleanup and Style Improvements:

  • Action: Use tools like Spotless or Checkstyle to enforce consistent code formatting and style guidelines.
  • Action: Remove any @SuppressWarnings annotations and address the underlying issues.
  • Benefit: Increases maintainability and reduces potential bugs.

Feel free to pick up any of these issues, or discuss them. They will be the main considerations going into v2.

skynetcap avatar Sep 24 '24 22:09 skynetcap