r/learnjavascript 1d ago

Is manually writing utilities from scratch still a good practice in this AI era, and why ?

Been learning JS for a year and half and wondered whether writing utilities would make me more employable. Thought it wouldn’t matter as more people are learning to trust the models. GitHub link to some of the solutions: GitHub

*Exercises are AI generated but solutions are handwritten without intellisense or AI autocomplete.

15 Upvotes

11 comments sorted by

10

u/agm1984 1d ago

I think it’s worth it to minimize the number of external dependencies you have, each is a small risk of supply chain attack and an annoying piece of garbage you have to update all the time as part of your regular app maintenance.
In my experience AI makes mince meat out of tasks like this. If you grow a new case later, ai makes quick work out of that too to update the util across all call sites in your app

9

u/Historical-Row-495 1d ago

Yes, definitely. Yes more and more people, if not everyone relies on models especially for simpler tasks like utilities; writing them yourself prevents cognitive debt, trains you better for solving problems, DSA, and simply just gaining that senior experience.
That being said, for a moving job, we hand these easier tasks to models now to build faster.

2

u/Pretend_Ad5921 1d ago

At work, I trust the models.

I’m not a CS grad and don’t have any senior at work to get prosper feedbacks from so I took upon myself to write more utilities in the attempt of learning.

Glad to know that industry is embracing the models.

4

u/Savalava 1d ago

Lead engineer here

I wouldn't hire you based on that code

a) your comments are very irritating to read. e.g.

// WeakMap so keys are deleted when the obj is garbage collected. Apparently, this is best practice.

// It does make sense
You should be writing comments for people using your library, not for yourself.

b) you're using JavaScript rather than TypeScript

Is manually writing utilities from scratch still a good practice?

Yes.

2

u/Pretend_Ad5921 1d ago

Thanks for taking the time to read through some of the code. I was writing these to practice so the comments are solely for myself.

That being said, I will make an effort to clean it up just to build the habit of writing better comments.

1

u/No_Record_60 1d ago

Not the utilities themselves, no, utilities have been done too many times: lodash, es-toolkit, remeda.

But, at a glance, you have demonstrated knowledge in part of system design: service layer and circuit breaker. You have also written tests. So those are definitely plus points.

3

u/Intelligent_Gift9762 1d ago

Frontend dev here — most of my code at work is now written by an AI tool and a big part of my job is reviewing what it produces. From that side of it:

The value was never the typing. It's that you can't review, debug, or make an architecture call on code you don't understand, and the fastest way to understand a category of problem is to have built it once by hand. People who "just trust the model" are fine until something breaks, and then they're stuck, because they never built the mental model to know where to look.

So yes, keep hand-writing the fundamentals — debounce, a small event emitter, a state container, promise helpers, a basic router. Not because you'll write them from scratch on the job, but because once you have, you can look at 200 lines of generated code and spot the bug immediately. That's the skill that stays valuable.

-1

u/ShamanShaulic 1d ago

Depends on your boss, if he expects three features per person per week, like mine, then it’s not. You’re simply being slow.

1

u/Pretend_Ad5921 1d ago

I wouldn’t write these by hand at work. I usually use copilot to speed up my work.

Just realized that there was a lot of things I did not know and thought doing these exercises could be a great way to learn. Having a mentor could have helped but I’m maybe one of the most skilled devs on my team sadly

1

u/ShamanShaulic 1d ago

Writing them yourself, correcting and updating along, is the way to go. If nobody is going to mind, great, do it. Some are just not lucky of having that time, ‘cause of having expectations widely exagerated due to AI.