by _-___________-_ · 6y ago · 0 comments
I can totally see how this happened, and I would definitely not say that I would never make this mistake, especially under time pressure etc. But a careful programmer would a) desire to understand what the code did, and thus spend enough time reading it to spot the `GetType()`, and b) test that the "prevent more than one instance from running" behaviour worked properly, which would involve both testing that you can't run two instances of the program, and testing that if you change the assembly identifier, you can run two instances.
Furthermore, it's a lot easier to take the time to understand what a few lines of code from SO does than it is to audit a dependency thoroughly.
I have thankfully avoided the world of NPM, but when I've had to use it I've found it very difficult because a lot of packages don't really have API docs.
Also, you should look at least at the docs of the packages you install.. And since most SO answers are shorter that introductory section of most docs, this means reading and understanding entire answer.
Brb reading the docs for every micro-package installed as a dependency for what I just installed that provides functionality that could've been hand written in five minutes.
Gonna spend the next few months reading about a thousand package README's for this single package I installed and all its dependencies down the tree, be right back.
(this encourages one to keep number of at least dependencies small, which is pretty good idea in general)
There was a post recently that noted that React is up to over 800,000 dependencies. Good luck with that.
Or at least you have no idea whether it actually solves any problem besides the exact scenario you tested it for, and no idea if it's even possible to maintain it.