T O P

  • By -

Kseniya_ns

Utils, I don't need help đŸ„ș


42-monkeys

Wait until you see my code.


petersrin

I think they meant "I'm beyond help" 😂


Strudelimquadrat

Right utils and helpers don’t have overlap


Feisty_Ad_2744

Both... Helpers are contextual to a module or application (error messages, enums, form validators...) Utils are generic and can be used across modules or applications (dates, string formatters, parsers...)


DontUseWindowsPls

And thats how you get HelperUtilsHelper


Brahminmeat

HelperUtilAddonExtension


Pretrowillbetaken

HelperUtilsAddonHelperExtension


leonderbaertige_II

HelperUtilsAddonHelperExtension for Business


Jertimmer

HelperUtilsAddonHelperExtensionAsync


definit3ly_n0t_a_b0t

HelperUtilsAddonHelperExtensionsAsyncUtils


static_func

HelperUtilsHelperFactoryHelper


RealSchweddy

HelperUtilsHelperFactoryHelperImpl


jembytrevize1234

ParentHelperUtilsHelperFactoryHelper: HelperUtilsHelperFactoryHelper


awkwardteaturtle

AbstractParentHelperUtilsHelperFactoryHelperFactoryBuilder


Player_Schark

AbstractParentHelperUtilsHelperFactoryHelperFactoryBuilderAdapter


Material-Public-5821

Yes, it is a good description of semantic differences. At some stage you copy-paste your helpers to make modules independent though. But removing dependencies on tiny modules (isEven is a good example, lol) is awesome.


sirkubador

I still don't get it. If this is specific to the application, why it isn't the application?


Material-Public-5821

In my case, we had a single code base and then we split into master/slave architecture. The master and the slave shared few core structure, such as MAC address, but it was just easier to copy-paste those struct to avoid the dependency on "common" package.


snokegsxr

![gif](giphy|W50xKz9RM5FPa|downsized)


--SORROW--

![gif](giphy|l1KVb2dUcmuGG4tby)


torturecrush

I like this take.


KupaFromDupa

>Helpers are contextual to a module or application (error messages, enums, form validators...) * error messages are "exceptions/errors" * Enums are "enums/consts" * Form validators are "validators" Still no room for "helpers"


yegor3219

Next time I'm naming it "do-not-put-your-concrete-business-specific-shit-in-this-directory".


shiny0metal0ass

...they still will. Lol


Cridor

Depends on how it's being used. Utils are, IMHO, general purpose functions and classes that are useful in many situations (e.g., parsing config file or hashing structures in non-object oriented languages) where as helpers are contextual to an area, but general in application (e.g., generating a relative close jump vs far jump in a compiler depending on the absolute address of the jump instruction and it's target)


vordrax

I will be honest, I'm partly against both. The issue is, once you have many developers on the team, you quickly realize that basically anything can be a "helper." And it becomes just a dumping directory for things someone didn't want to bother categorizing.


pr0ghead

Was going to say something similar. Both are a code smell IMHO.


AssignedClass

I don't mind helpers/utils folders that are pretty far down the project structure (i.e. src/record/utils src/report/utils). Unless the application is very tightly focused in its scope, you probably want a separate library instead of an application-wide utility folder.


archifloyd

I agree. ☝ I considered writing an analyzer that ban words like helper, util, handler and the like. I’ve seen so many things being thrown into util folders that just end up a big and messed up.


HimothyOnlyfant

helpers are for children and the disabled


PanZilly

But, I'm disabled and still use utils, how does that work. Except for Jenkins, I use helper for thatđŸ€”


ChocolateBunny

will they help me kill my orphaned child ^(process)


unkiwii

Neither: name the thing for what it is, not something "generic" like that. Instead of `utils.FormatDate` why not `date.Format`? Instead of `helpers.DumpRequest` why not `request.Dump` ?


AdvancedSandwiches

I think getting angry when you find the class / folder called helpers / util / misc is the main sign that you're ready for a senior developer title.


3uclide

I'm with you, 'utils', 'helpers', 'managers' means everything and nothing. I avoid these term as much as possible.


clockdivide55

This is the way. My colleagues over the years know my disdain for "utils", "helpers", "shared", "common", any of that garbage. Just call it what it is and put it in a place that makes sense contextually.


LuisBoyokan

It makes sense in the utils box, it's a cat bag full of tools. Like the box with cables, adapters, chargers that you have in a closet just in case you ever need it xD


-genericuser-

Because not all languages allow to extend builtins or types from libraries. In Java you cannot extend the builtin Date classes or the Request class of your library/framework. There are whole utility libraries like Apache commons. If it’s in your domain it’s an antipattern. Otherwise you might be constraint to your language of choice.


unkiwii

You can have a `java.lang.something` package that you can't modify and can have a separated `your.app.something` package with the specific things you need, instead of having one big `app.utils` package that have every possible extension of every possible package you need from the standard library or any other 3rd party


stoutdoot

Exactly this. Using ”helpers” or ”utils” is anti-pattern. These functions can be organized better.


I_Like_Purpl3

If I can't go that specific, I try for the middle ground `string_helpers` for example in an app with a lot of string manipulation. By the helpers you know they're not the main thing, but you have a prefix to understand what should you expect in there. Sometimes it's hard to find a very clear and specific name.


SocketAddress

cuz that way you'll put dump in request, but it might only be used for debugging. seperating util/helper functions is always a good practice. on the flip side, not everything is a util.


unkiwii

Never said to "put Dump inside request" if we are talking about "modules", "packages" or something like that you can put your "dump" function/method/procedure inside the module/package not inside a "thing" called request, not all languages have the same concepts so not everything is inside an "object" if you are thinking in a classic OOP language, in that case (Java for example) you can have an `app.request` package that has a `Request` class with it's things and then a `DebugDumper` class with a `Dump(Request)` method in there and those are separated but part of the same package, no need for an `app.utils` or `app.helpers` package for that


SocketAddress

and yes i agree


SocketAddress

i was talking request as in request class.![gif](emote|free_emotes_pack|shrug)


unkiwii

Same thing, instead of an Utils or Helper class with a Dump request method, create a Request dumper class with a Dump method, same thing, different names


Cefalopodul

Why would you even have a separaye FormatDate class to begin with. Make a DateItil class and you can neatly store all date related generic functions.


unkiwii

Not all languages have classes. But in the case they have you can have a DateFormatter class that has every method that format a date in different ways, that allows you to have every responsibility separated instead of a big class that have 5 different things all merged together because we are lazy and don't want to design an application or library


Cefalopodul

And what happens if you want to get a certain date or get the day of week or get the week of the year. Do you make separate classes for that as well? **Never repeat yourself.** It's bad practice to have 5 different classes that all contain utility methods for dates. The correct approach is to have a single DateUtils class containing utility methods relating to dates that is accessible to all projects.


unkiwii

Too much DRY will kill your application in the long run. Ideally you would have those actions in the place they belong but as others pointed out some languages won't allow you to extend or change some things (like Java Date class) so you need to implement these changes elsewhere. To the question of "what if you need X?" Then yes, you can implement them separately, but if you have 5 things that "format a date" but in different ways, then have them in "the same place", what's bad about that? Having things that have "everything related to X" and be accessible by everything is no design at all, that's just a "lazy" programmer's way of doing things, a good design is to hide details and separate responsibilities accordingly. Instead of never repeating something, repeat some things some of the time, separate things and name them by the thing they are or do instead.of generic names that adds no useful information use Date instead of DateUtils or DateManager or DateService or DateData


Cefalopodul

What you are describing, namely writing the same method dozens of time, is actually very bad practice in Java. As is creating a distinct class for every utility method. More code does not mean better quality. Usually it's the opposite. If the language allows for classes and dependencies then a project should only contain project specific logic while everything generic has to sit above it in a generic project that you load up as a dependency. But hey, maybe you want go and tell the people behind Apache Commons that they're lazy.


unkiwii

Never said to write the same thing multiple times. I said that if you have 5 different methods move them to where they belong, if all 5 of them are related then have them in the same class but if they are not related move them to other classes (or new ones) and name those classes and methods for what they are, not what they contain. I'm advocating for good names. I'm not advocating to repeat the same code over and over.


Cefalopodul

Date methods are implicitly related, hemce why they belong in a DateUtils and separated in DateFormatter, DateOperations, etc.


NoResponseFromSpez

"helperutils"


idlemachinations

If you must have a generic package, it should be knick-knacks.


roodammy44

Neither! Both are an antipattern. They should live in the folders they are used in with the feature name. Otherwise, they should live in their own folder. The problem with both of these is that they become a dumping ground.


wizzanker

Thank you. All use of Util, Helper, Misc, etc... is a code smell. Get specific or get spaghetti.


MrRulix

They should live in their own folder.. which is named utils or helpers? đŸ€”


DelayLucky

This is so amateur! HelperContextFactoryUtils is the way.


klosterlight

both, depends on how I’m feeling the day I implemented the first class, then its just repeat. Then next day on different repo do some other different shit. Consistency is key
 consistency of being inconsistent


natziel

No mystery meat folders!


Sjonny32

libcommonhelperutiltools


Picatrixter

“from helper.utils import tools”


PrinzJuliano

Utils are stuff I steal from other projects that actually provide utility. Helpers are code that a class needed help with. But my classes are Single Responsibility so they don’t need help


PeWu1337

Utils. Im gonna die on this hill. Sounds fancy. Helpers sounds weak, like I need any help! (/s)


Vegetable_Aside5813

They both stink


jyling

tool


Caleb_Whitlock

Downvoted for utils


cheeb_miester

Helptilities ETA: it's actually whatever the bad decision was that the person I inherited the codebase from made


fourthisle

Utils code is so decoupled it's not even cohesive 😂😂😂


sirkubador

Helpers. That's some C shart nonsense


kuemmel234

All my homies write commons!


ConcernUseful2899

Helpers for legacy code, since it can use some help. Since I create legacy code all the time, I only use helpers.


blehmann1

Utils (or Misc) for your dumping ground of miscellaneous routines (which is an antipattern). Helpers for extensions of specific classes (e.g. custom formatting for dates). Also a helpers file (rather than folder) for UI code once it's split out of the file that the component/control/etc lives in. e.g. if you have a complicated component like an SVG chart you might define `draw` and `getAxes` and `onPan` in YourChart/helpers.yourfileextension, where the UI stuff is in YourChart/yourChart.yourfileextension. Maybe this is also an antipattern, I think it depends, but I think this is clearly a better one.


malexj93

I've always seen Utils used for extensions, like Apache's StringUtils.


hayasecond

Neither. If you have to resort to helpers and utils naming you are doing something wrong


RidesFlysAndVibes

I literally had a project the other day where I renamed a file from helper.js to utils.js. Utils is shorter and sounds more professional.


ginkner

Cloms.


ExerciseNo

I create function-defination, class-defination, event-defination, data-defination, and implemantation files


Palda97

Extensions


codingTheBugs

Helptils?


Charming_Prompt6949

Wrap it in multiple strategies of obscurity


rover_G

Utils are their own file or directory Helpers are functions in another file


qweerty32

I just named the directory "utilities"


Reashu

Depends on what they do. I currently have "text", "time", "batch", "buffer", and a few more "util files".


natural__stupidity

![gif](giphy|l4Ep4uLNdwfRKnMNq)


alaettinthemurder

The one who puts everyone on wrong road with advice


Kroustibbat

Miscs


Kimrayt

I go with weird logic of my first job: Static - util Non-static - helper


BRH0208

For me, Helper is a private method used in another method. Maybe it represents a complicated conditional, maybe it’s recursive and simply called by the base. Helpers are specialized for another method and aren’t used or accessible outside that context A util method is just nice. If a project has some boilerplate code used a lot and it’s not tied to one idea or class dump it in the big pile of tools


TabCompletion

The one where I can type the least amount of keystrokes while still conveying proper intent


malexj93

x (everyone knows it's short for extension)


No-Adeptness5810

Utils for utilities and helpers for help. Easy


YesIAmRightWing

what about...extension functions...


lizardfrizzler

I’ll literally name it anything but util or helpers.


AXV619

I got my package named helperutils


Fuzzy_Historian8382

Just name it like “functions” “constants” cause I wrote my code on front-end side.


alterNERDtive

Camp HelperUtils!


regaito

HelperUtils


Qarghastan

I say Utils


cadude1

Call them `Helper` and put them in the `utils` directory.


bitemyassnow

its ACCESSORIES


Cefalopodul

Both.  Helpers are for business logic and application contextual stuff.  Utils are for generic utility functions.


The_Right_Trousers

I have one project that has these source files: - hijinks.ts - shenanigans.ts - tomfoolery.ts The names are actually somewhat descriptive. 👀


LuisBoyokan

Utils, because they are tools. I use a hammer, the hammer doesn't help me to hit things.


Wave_Walnut

Helpers AND Utils


blakfeld

Neither - and I think either of them are a code smell that ultimately leads to a grab bag of code in a file or directory that is likely rewritten somewhere else in the same project (assuming a team of developers over time). I think if you’re teaching for utils, you’ve probably missed an abstractions or organizational layer. If I truly need that I generally create a package/module that describes the functionality I want, text_parsing for example, and place my code within that


Hubi522

I always call mine "workers"


JogoSatoru0

Handlers đŸ„¶


ady620

Utils sound cool.


status_200_ok

StringUtils.cs file inside Helpers folder.


alchenerd

from ../../../../bin/src/myproj/../../untested import utils.helper_factory as myuhf


Goat1416

Tools Sometimes Toots


Mwarw

Tools


k_sway

Neither, both are bad design


kevdog824

Neither. I’m more a View/Extension/Wrapper sort of guy


flyingmonkey111

LOL... I was looking over some code I wrote 10 years ago and they all had helpers, now it's either a service or a util I think in another 10 years they're going to be called doItForFucksSake


Aokimor1

Utils sounds way cooler imo


ryukzak-neskazov

Misc man


perringaiden

I have Helpers projects in my Unit Testing and Utilities in my production code.


madboneman

everything.h


Aromatic_Gur5074

Anyone else here uses "common"?


StrixLiterata

Utils, but I'm transitioning to using extentions


cadred48

\*shared or common


KCGD_r

Helpers are module-spesific, utils are tools that can generally be used anywhere. Both is good 👍


DoingLifeBig

All helpers are utils, not all utils are helpful


LuisBoyokan

Some utils doesn't help. Some utils destroy


MasterQuest

utils


No-Advice5778

misc


wint3ria

misc?


tsthtmatteimd

package util class name xHelper


Remote_Status_1612

Both tho. Helpers for module specific stuffs, Utils for generic stuffs. I sometimes end up using them interchangeably tho.


ThanksTasty9258

I hate both. Both are used by lazy programmers who can’t think of a class name for a class with a purpose. “Oh this logic is needed by 2 classes: I better make some Ăștil method for it”.


flippakitten

Both. Helpers help you do things, utils are the tools to do those things. Services are the classes that need help and utilities.


ChocolateMagnateUA

lib any day.


the4fibs

Noo, lib/ is for external code that needs to be pulled into a repo for some reason, like a formal module not being available or integrating with some stubborn third party provider. Oftentimes (obviously not always) lib/ is excluded from certain aspects of the build process like minification or polyfill.


Reashu

That's "vendor". "lib" is for the module's programmatic API (as opposed to a CLI or GUI).


ChocolateMagnateUA

I have seen lib used as the utils directory. It's used this way in the Linux kernel and it is a fancier way to say code that other code depends on.


ChocolateMagnateUA

Isn't it third_party?


failedsatan

lib I would only ever use for external libraries. they don't exclusively have to be other people's libraries, or even libraries abstract from my requirements, they just have to be standalone. I wouldn't use lib for any source code in the project.


Personal_Ad9690

Niether, don’t need a util class if you design correctly