Issue#523: Refactor XML and JSON handling in CRUD operations
[WIP] Initial Refactoring of XML and JSON handling in CRUD operations
Overview
This PR introduces to handle common logic for XML and JSON operations in the CRUD directory. The focus is on enhancing abstraction for create and delete operations, to reduce code duplication and improve maintainability.
Changes
- AbstractCreateHandler Enhancement:
- Extended with implementing Common Method
createDatabaseIfNotExists() - Refactored
XMLCreateandJsonCreateto use this shared method.
- Extended with implementing Common Method
- AbstractDeleteHandler Enhancement:
- Extended with implementing Common Method
handle() - Refactored
XMLDeleteandJsonDeleteto use this shared method.
Next Steps
- Review and refine current changes based on feedback
- Extend similar refactoring to other operations.
- Consider creating abstract base classes for classes which have almost similar methods and content.
Review Request
Please focus on:
- Effectiveness of the abstraction and adherence to "Template Method" design (Interface+Abstact+Implementations)
- Potential issues with format-specific operations
- Suggestions for further improvements or extensions of this refactoring approach
Thanks so much for opening this pull request and for helping to improve SirixDB 🚀
Looking good :-)
Are you going to add more stuff or should I already merge?
Thank you for your support. Definitely, I will extend similar refactoring to other operations wherever possible and commit the changes in the PR.
[Revised] Further Refactoring of XML and JSON Handling in CRUD Operations
Overview
This PR continues the refactoring and modifications to enhance XML and JSON handling within CRUD operations.
Changes
-
AbstractGetHandler Enhancement:
- Added common methods for data retrieval within
AbstractGetHandler. - Refactored
JsonGetandXmlGetto leverage these shared methods for centralized retrieval logic.
- Added common methods for data retrieval within
-
AbstractUpdateHandler Introduction:
- Introduced
AbstractUpdateHandlerto manage update operations across both contexts. - Updated
JsonUpdateandXmlUpdateto extendAbstractUpdateHandler, ensuring consistent update handling.
- Introduced
Next Steps
- Review and provide feedback on the newly implemented abstractions.
Review and Merge Request
Kindly review the changes.
Thanks a lot, I think it's great regarding clean code, but I'm on my phone, so I'll check tomorrow or later on :-) thanks a lot and as always I hope you'll contribute more ;) there's maybe room for a better Kotlin DSL API, maybe even a DSL to provide type safe and syntactically correct JSONiq. Other than that I'm currently working on reducing object allocations :-)
Oh and maybe updating Vert.x to the newest version and check if we have to update anything.
Congrats on merging your first pull request. 🐬 You've just improved SirixDB for everyone. ❤️