We use clean architecture to improve code reusability and clarity.
But as we divide each domain into cli, dependency, compile, bundle, deploy, and utils, filenames become ambiguous.
For example:
packpack/src/main/kotlin/org/thisisthepy/python/multiplatform/packpack/dependency/middleware/DefaultInterface.kt
packpack/src/main/kotlin/org/thisisthepy/python/multiplatform/packpack/compile/middleware/DefaultInterface.kt
This is especially difficult to read and navigate in Kotlin because package paths are already deeply nested.
Current Structure
- dependency/frontend/
BaseInterface.kt - Base Interface for frontend
Gradle.kt - Abstract Gradle frontend
Cli.kt - Abstract CLI frontend
- dependency/middleware/
BaseInterface.kt - Base interface for middleware
DefaultInterface.kt - Abstract class for middleware
- dependency/backend/
BaseInterface.kt - Base interface for backend
UVInterface.kt - Abstract class for UV-specific methods
external/UV.kt - UV-specific methods
Problem
The current names are ambiguous for two reasons:
- BaseInterface.kt and DefaultInterface.kt are repeated across multiple domains.
- Concrete implementation classes use the word Interface, for example DefaultInterface and UVInterface, which makes it unclear whether the file contains an interface or an implementation.
Suggested Structure
- dependency/frontend/
FrontendInterface.kt
Gradle.kt
Cli.kt
- dependency/middleware/
MiddlewareInterface.kt
DefaultMiddleware.kt
- dependency/backend/
BackendInterface.kt
(new) DefaultBackend.kt - Abstract class for ppp native features(python-multiplatform's binary install, versioning, etc..) that uv doesn't support
UVBackend.kt - Abstract class for UV-specific methods(this extends DefaultBackend)
external/UV.kt
However, this structure still causes duplication across domains because each domain follows the same structure.
At the very least, the current naming structure should be revised to reduce ambiguity.
We use clean architecture to improve code reusability and clarity.
But as we divide each domain into cli, dependency, compile, bundle, deploy, and utils, filenames become ambiguous.
For example:
This is especially difficult to read and navigate in Kotlin because package paths are already deeply nested.
Current Structure
Problem
The current names are ambiguous for two reasons:
Suggested Structure
However, this structure still causes duplication across domains because each domain follows the same structure.
At the very least, the current naming structure should be revised to reduce ambiguity.