oop - How to granular packages in golang -
i prefer small packages (public , private meaning in scope of package) .
its more encapsulated , more manageable , cleaner (and use them small javascript packages ) .
but go compiler makes .a class per each package .
performance important me , afraid of overhead of loading .a files .
and see golang's source packages in github vary large , in perspective . take @ net/http package large.
so
how should granular , design go packages ?
how should encapsulate structures ?
- is there performance issues if app gets hundreds of small packages ?
maybe package http big, that's true, java classes far small. take @ other packages in stdlib guidance.
a package should provide coherent set of functionalities (types , methods, functions, variables, consts). using code packagename.type or packagename.function , should sensible.
encapsulation oversold.
no there no performance issue (except maybe longer compile times),
having hundreds of tiny, unusable-in-itself packages useless, non-idiomatic overkill (and prepare fight import cycles).
Comments
Post a Comment