DEV Community


Posted on

Confidence level. Do you trust devs that extract duplicated code to funtions by hand instead of using IDE support?

Top comments (9)

andrewlucker profile image
Andrew Lucker

Welcome to the editor wars. Pick a side and grab a torch.

mortoray profile image
edA‑qa mort‑ora‑y

This idea that you'd trust an IDE over a person is completely foreign to me. I don't use an IDE. I don't trust developers that rely heavily on IDEs.

Perhaps an IDE can do some refactoring, but the type of refactoring I normally I doubt any of them can do. If they can, then they have an AI far more impressive than I've ever seen.

mjb2kmn profile image
MN Mark

Difficult to answer without context. (Although I lean towards "by hand")

Consider and older app with thousands of files and millions of lines. Unless you're intimately familiar with it, I'd recommend letting an IDE do the heavy lifting of refactoring.

Ultimately, the right way is the one that works best for the developer and project in question. I'd rather the dev use the tools they are familiar with and are productive with rather than forcing them to do it my perceived "right" way.

And by "by hand", I'm assuming still includes using tools such as grep, find, sed, etc.

kspeakman profile image
Kasey Speakman

I rarely use refactors like that, so I guess I trust myself... :)

To be fair, most editors don't have a lot of built-in refactorings for F#. And the compiler catches a lot if you write pure functions.

dmfay profile image
Dian Fay

I try to have enough test coverage that any refactoring, automated or manual, poses minimal risk.

antjanus profile image
Antonin J. (they/them)

I don't use an IDE that has this feature (or maybe I just don't know about it). I always refactor and extract duplicated code by hand.

kodengo_com profile image

Every time i try doing it manually i end up introducing bugs.

mohr023 profile image
Matheus Mohr

It's kinda natural if it's a technology/language you don't fully understand (for instance, trying to refactor code that uses a library you don't know, unless you take your time and understand it, you'll probably leave/delete a line that will unleash havoc in your software).

One of my usual ways to refactor "on-the-go" is to completely extract a code block, using IDE or not, and as I test, refactor that code block. That way I usually avoid mistakes like that and also stay productive, since the tests itself usually help me understand the flow my code should have.