DEV Community

Discussion on: Should a library log its version number ?

Collapse
 
northbear profile image
northbear • Edited

Some of principles that good library should match is single responsibility and minimally surprising behavior. Library shouldn't do things that isn't expected from it and do exactly what it is aimed for. But good library should have ability to provide its' version. Especially for shared library...
And good practices for programmer is to provide this info in log for guys who will support your application. It helps to fix issues very very much.
Yeah... As people said, programmer usually knows libraries' versions. But guys who will you support it, may not know. Environment may contains several versions of the same library installed. And application may take version that not supposed initially. And it's pretty typical issue.
Of course, If you write an app just for yourself it's totally up to you...

Collapse
 
gmartigny profile image
Guillaume Martigny

My first thought was for discoverability. Some devs see something cool on the web, open the console and see Build with love using "MyAwesomeApp v1.0.0".
Thanks, to others comments, I realize that if every lib do the same, log can be cluttered.
Imagine:

Use JQuery 3.11
Build with Bootstrap@4
Made with love with Webpack v4
Propulsed by _Underscore_
Careful Google Analytics is watching you
...

However, I agree with you on:

good library should have ability to provide its' version.

Collapse
 
northbear profile image
northbear

It's funny. But you even cannot imagine how similar message really helps to discover issues. Especially If it's critical application...

Thread Thread
 
gmartigny profile image
Guillaume Martigny

Do you have an example ?