News for hackers. Stuff that matters.
Re:Good Software Development Habits by chambored on Monday November 18, 2024 @11:41AM (#42174117)
I’m only a few years in the industry, and in my CS program, we were constantly told something along the lines of “any time you have to copy paste, look for an opportunity to abstract”. I’ve been running into problems lately where my attempts at abstractions have made things significantly more complicated. Only when I hit the limits of the abstraction I realize the cost of maintaining similar functionality in multiple places was less. I’m going to try your approach in future.
Re:Good Software Development Habits by nzach on Monday November 18, 2024 @12:36PM (#42174755)
I think the reasoning for DRY was kind of lost in translation.

“any time you have to copy paste, look for an opportunity to abstract” assumes that having an abstraction is always better, but I don't think that is the case.

In my opinion the reasoning as to why "code duplication is a code smell" is that if you have to copy and paste code around you are probably missing an useful abstraction for your code. And I think "useful" is the most important thing to keep in mind.

Sure, every time I copy and paste code I know that exist an abstraction I could create to eliminate this duplication. Generally this is pretty easy. The hard part is to understand when this new abstraction will help you to deliver the features the business need.

Re:Good Software Development Habits by jhanschoo on Thursday November 21, 2024 @11:50AM (#42206175)
Surely there is a parallel with standardized testing asking the most needlessly ornate prose of its students and then most writing having more value the pialner it is written.
Re:Good Software Development Habits by jhanschoo on Thursday November 21, 2024 @11:50AM (#42206176)
Surely there is a parallel with standardized testing asking the most needlessly ornate prose of its students and then most writing having more value the plainer it is written.