this post was submitted on 31 Jul 2024
3 points (100.0% liked)

Programmer Humor

24389 readers
423 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
top 25 comments
sorted by: hot top controversial new old
[–] bjoern_tantau@swg-empire.de 2 points 10 months ago (1 children)

Link to the PR? The PR description and the comment somehow contradict each other. Or I am stupid. Or the commenter.

[–] sus@programming.dev 2 points 10 months ago* (last edited 10 months ago) (1 children)

I tried to edit the 'highlights' into a single image, the top is the description of the PR, the middle is a comment replying to another comment

https://github.com/micromatch/to-regex-range/pull/17

[–] bjoern_tantau@swg-empire.de 1 points 10 months ago

Thanks!

What a shit show.

[–] floofloof@lemmy.ca 2 points 10 months ago* (last edited 10 months ago) (1 children)

It looks like "is-number" was never more than a few simple lines of code. It still has 68 million downloads per week.

https://www.npmjs.com/package/is-number

I checked one of our main projects at work, and it's in there as a dependency 6 levels deep via the "sass" package.

[–] sushibowl@feddit.nl 1 points 10 months ago (1 children)

is-number is a project by John Schlinkert. John has a background in sales and marketing before he became an open source programmer and started creating these types of single function packages. So far he has about 1400 projects. Not all of them are this small, though many are.

He builds a lot of very basic functionality packages. Get the first n values from an array. Sort an array. Set a non-enumerable property on an object. Split a string. Get the length of the longest item in an array. Check if a path ends with some string. It goes on and on.

If you browse through it's not uncommon to find packages that do nothing but call another package of his. For example, is-valid-path provides a function to check if a windows path contains any invalid characters. The only thing it does is import and call another package, is-invalid-path, and inverses its output.

He has a package called alphabet that only exports an array with all the letters of the alphabet. There's a package that provides a list of phrases that could mean "yes." He has a package (ansi-wrap) to wrap text in ANSI color escape codes, then he has separate packages to wrap text in every color name (ansi-red, ansi-cyan, etc).

To me, 1400 projects is just an insane number, and it's only possible because they are all so trivial. To me, it very much looks like the work of someone who cares a lot about pumping up his numbers and looking impressive. However the JavaScript world also extolled the virtues of these types of micro packages at some point so what do I know.

[–] notnotmike@programming.dev 2 points 10 months ago (1 children)

Wow you're right, he's the author of the infamous "is-odd" and "is-even" packages. What an odd person.

Someone in the OP PR mentioned the amount of energy used to download these tiny packages and its actually something crazy to think about

[–] floofloof@lemmy.ca 1 points 10 months ago (1 children)

It makes you wonder why anyone uses them though, since so many of them do things that are trivial in modern JavaScript.

[–] nickwitha_k@lemmy.sdf.org 1 points 10 months ago

And anyone who has been around for a while should remember when left-pad broke node.js. Including unnecessary dependencies, instead of writing trivial code is just bad practice.

[–] Aatube@kbin.melroy.org 2 points 10 months ago (1 children)

Note that the PR was later merged by a member who got fed up with his colleagues.

[–] lily33@lemm.ee 1 points 10 months ago (1 children)

And who hasn't contributed any code to this particular repo (according to github insights).

[–] GBU_28@lemm.ee 3 points 10 months ago (1 children)

Not familiar with this exact team, but a skilled reviewer/issue triager is useful. We can hope this person at least tested the changes.

[–] GammaGames@beehaw.org 1 points 10 months ago

The person who opened the pr already did

[–] UndercoverUlrikHD@programming.dev 2 points 10 months ago (1 children)

The only two people arguing against the change were both authors/contributors of is-number lol

[–] Baleine@jlai.lu 0 points 10 months ago (1 children)

How many contributors could there possibly be

[–] UndercoverUlrikHD@programming.dev 1 points 10 months ago* (last edited 10 months ago)

3, about two lines per contributor

[–] Randelung@lemmy.world 1 points 10 months ago (1 children)

Seems to me the only reason for these kind of dependencies to exist in the first place is that people really, really, really, REALLY can't code.

[–] Bourff@lemmy.world 1 points 10 months ago

Well javascript is the default language of the web, so no surprise it attracts a lot of newbies.

[–] josefo@leminal.space 1 points 10 months ago

I really need a community here solely dedicated to GitHub drama. This is so much better than Twitter drama, more relatable.

[–] AVincentInSpace@pawb.social 1 points 10 months ago (1 children)

Another day of being extremely thankful I decided not to learn JavaScript

[–] elxeno@lemm.ee 2 points 10 months ago* (last edited 10 months ago) (1 children)

Look at what you're missing!

Edit: also, is-odd depends on is-number

[–] JackbyDev@programming.dev 1 points 10 months ago

Heaven forbid they make a package is-even-or-odd with both. Wait. Don't give them ideas. They'll just make it depend on both.

[–] ChaoticNeutralCzech@feddit.org 1 points 10 months ago* (last edited 10 months ago) (1 children)

If you think is-number can be replaced with a one-liner, you don't have the enterprise code mindset. What if the world gets more inclusive and MMXXIV, ½ and ⠼⠁ become recognized as numbers? 𒐍𓆾 were numbers in the past but what if people start assigning numeric value to other characters? Are 🖐🔟💯🆢🂵🀌🁅 numbers of the future???
/s

I'm not even all kidding, Regex implementations are split on whether "٣" matches \d.

[–] Contravariant@lemmy.world 0 points 10 months ago (1 children)

It's simple ⅯⅯⅩⅩⅣis a number, MMXXIV is not.

[–] ChaoticNeutralCzech@feddit.org 1 points 10 months ago* (last edited 10 months ago)

You may argue that writiing 2024 as "MMXXIV" and not "ⅯⅯⅩⅩⅣ" is a mistake but while typists who'd use "2OlO" for "2010" (because they grew up using cost-reduced typewriters) are dying out, you'll never get everyone to use the appropriate Unicode for Roman numerals.

[–] TootSweet@lemmy.world 1 points 10 months ago

I've literally told my coworkers "I'm not saying we should never use dependencies. But every time you add a dependency, you should hate yourself a little bit more. Some self flagellation can't hurt either."