As far as efficiency and memory usage goes, is it better to have one large jar with a class/package for each feature as needed? Or is it instead better to separate it out into smaller more-manageable jars?
Lets say I have a large project with 20-30 packages all unrelated to each other:
com.example.test
- class 1
- class 2
- class 3
- another.package
- class 1
- class 2
- class 3
- another.package
- class 1
- class 2
- class 3
- another.package
- class 1
- class 2
- class 3
Would it instead be more efficient to split up each package into its own jar? And have multiple, smaller more lightweight jars? Im not sure if this even matters, however i am curious as it would make further development easier if i split everything up a bit. (as long as there is no performance disadvantages)
If the packages are unrelated, then they shouldn't be in the same jar
, period.
By splitting up the jar, users could choose which packages they need in deployment, and include only those nothing more.
You want to deploy the minimal possible code. Anything extra is an additional potential problem, bug, security hole. Unnecessary stuff could also slow down the class loader, though that's a tiny concern compared to the others I mentioned earlier.
If some of them, or all of them, are always used together, then for practical reasons it can be ok to bundle them together.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With