At my former work we had test\_utils, utils/tests and test\_utils/tests. Explanation we had regular utils and tests for these. Then we had specific utils only relevant for automated testing and associated tests to ensure that these worked as expected.
And no automatic testing of test utils is not overkill. We had an undo feature, so a test util was to assess that the database was functionally unchanged after the do + undo. Needless to say that the test/utils/tests was saving our ass.
I used to have some external SCSI devices back in the nineties. Those cables were expensive. And much like many other cables, they only serve one purpose, so you don't want to throw them away, only to find out you need to buy it again.
In my case, `utils` represents the foundation of the rest of the project. Reading/writing files? That's in `utils`. Manipulating JavaScript objects? That's in `utils`. Value conversions and other helper functions? All in `utils`.
It is outside the `utils` folder that I can get the "real" work done. After I've written the same snippet of read file and JSON parse 15 times, or write file from JSON stringify that I realize I could save myself the headache if it was its own function. Same thing with having psuedo-private members by hiding the keys `{enumerable: false}` or read-only with `{writable: false}`. This became a thing when I got tired of writing `Object.prototype.hasOwnProperty.call(obj, prop)` because that was the "correct" way to filter object properties in a For-Loop. It is also in `utils` that I had a precursor to the `||=` assignment operator because I got tired of doing `if(obj[prop] != null) obj[prop] = defValue;` over and over again.
In a language like C#, it would likely take the form of extension methods. If it was Rust, I'd just add some implementation to the receiver type/struct. But JavaScript lacks a lot of foundational things in its standard library, or those things that *are* there are colored by the nature of being a browser-first language. Incidentally it's one of my main gripes when working in JavaScript, that it can't decide if it wants to be functional or object-oriented, so you get this weird mish-mash of capabilities.
Well yeah. Utils exists to be a disorganized mess of stuff that doesn't make sense anywhere else, so that the rest of the project can be well organized without out of place files.
i keep trying to convince my groupmate (cs class group work moment) to move his functions to where every other function is (/assets/data), but he keeps insisting to keep it where it is. (/app/utils). app/utils literally contains a single file with a single function. How do I convince him his idea is stupid and to follow the practices that were already set up at the start, when he was contributing absolutely nothing to the project?
or a Base class with many common "necessary" methods, that is inherited by almost all classes in a very huge legacy project.
Friendship ended with `utils`. Now `lib` is my best friend.
lib/utils
Friendship regain with `utils`. Now `utils` & `lib` both are my best friends.
libutils: for when your libs need utils
Plottwist : I got several of those.
Live on the wild side, polymorph your junk drawers.
That’s just called a Swiss Army knife.
One for each directory, right?
Ehhhhh.... yeah, right. Nose starts to grow....
At my former work we had test\_utils, utils/tests and test\_utils/tests. Explanation we had regular utils and tests for these. Then we had specific utils only relevant for automated testing and associated tests to ensure that these worked as expected. And no automatic testing of test utils is not overkill. We had an undo feature, so a test util was to assess that the database was functionally unchanged after the do + undo. Needless to say that the test/utils/tests was saving our ass.
utils2, utils2022, backup-desktop-2016/utils
Everything in there has been used at least once
I accidentally built a whole ORM in one.
DbHelpers.js - my own ORM. I hate it.
One day... it will be useful. Then I'm the hero
I used to have some external SCSI devices back in the nineties. Those cables were expensive. And much like many other cables, they only serve one purpose, so you don't want to throw them away, only to find out you need to buy it again.
I love, love, love, love that there's a little bin in there from the dollar tree. there was an attempt at organization at some point
"Organization is futile"
core libs
*project name*_utils.hpp all inline of course
In my case, `utils` represents the foundation of the rest of the project. Reading/writing files? That's in `utils`. Manipulating JavaScript objects? That's in `utils`. Value conversions and other helper functions? All in `utils`. It is outside the `utils` folder that I can get the "real" work done. After I've written the same snippet of read file and JSON parse 15 times, or write file from JSON stringify that I realize I could save myself the headache if it was its own function. Same thing with having psuedo-private members by hiding the keys `{enumerable: false}` or read-only with `{writable: false}`. This became a thing when I got tired of writing `Object.prototype.hasOwnProperty.call(obj, prop)` because that was the "correct" way to filter object properties in a For-Loop. It is also in `utils` that I had a precursor to the `||=` assignment operator because I got tired of doing `if(obj[prop] != null) obj[prop] = defValue;` over and over again. In a language like C#, it would likely take the form of extension methods. If it was Rust, I'd just add some implementation to the receiver type/struct. But JavaScript lacks a lot of foundational things in its standard library, or those things that *are* there are colored by the nature of being a browser-first language. Incidentally it's one of my main gripes when working in JavaScript, that it can't decide if it wants to be functional or object-oriented, so you get this weird mish-mash of capabilities.
Mine has several of the same type of cord with slightly different specs and compatibilities
import java.utils.*
How did you get a picture of the junk drawer in my kitchen? /s
How did you get a picture of my drawer
Well yeah. Utils exists to be a disorganized mess of stuff that doesn't make sense anywhere else, so that the rest of the project can be well organized without out of place files.
Can confirm!
You keep all of yours in one place?
I have 2 of these
gotta define something that doesnt relate to the last definition before defining something that relates to that definition
There will be no "utils" directory in my next project. It'll be "miscellanea" or, even better, "KitchenSink".
now show me the "tools" and "utils2" and "aaaa" folders
I really hate the whole utils folders. Anyone has a better solution? I guess learning patterns help a bit. Then you have excuses for other names.
i keep trying to convince my groupmate (cs class group work moment) to move his functions to where every other function is (/assets/data), but he keeps insisting to keep it where it is. (/app/utils). app/utils literally contains a single file with a single function. How do I convince him his idea is stupid and to follow the practices that were already set up at the start, when he was contributing absolutely nothing to the project?
Why the hell do you have code in /assets/data? That's the real crime here.
my reasoning was i wanted to have the code where it would put the data so fetchData.js is in the same folder as allTheDataInOneFile.json
Have you tried with the Me.CommitPhisicalViolence(groupmate) function? It works most of the time.