41 points

C) Write a highly specific, custom-tailored boilerplate generator that does 80% of the work and needs only a day or two to implement.

permalink
report
reply
11 points

This sounds just extremely dumb to me, as in “do something manually for 2 minutes or spend 2 days automating it”

Also, DRY in 90% of the cases is a sham

permalink
report
parent
reply
1 point

Completely depends on how often you need to write boilerplate code, and how error-prone it is.

After writing hundreds of instances of ‘fetch this from the server and show an error if it doesn’t work’, I finally wrote a helper for that. It took 2 hours, shouts at me if I use it wrong, and instantly makes my classes easier to read because all the boilerplate is gone. As an added bonus, the invocation is so small that Copilot can write it error-free, which it couldn’t before.

So fetching things is now a thing of a few seconds instead of one minute with a chance of making a mistake. I say it’s worth it.

permalink
report
parent
reply
3 points
*

DRY is usually helpful if you don’t use it in situations where you have like 2 semi-different things. If they’re actually the same and you have 3 or more then the level of abstraction is worth it almost always.

permalink
report
parent
reply
6 points

To me, there are two classifications of DRY - one I find harmful, the other very useful.

First one resembles mathematical extractions, essentially you never allow a single chunk of code to be written twice and you create massive amounts of global util junk. This also creates some bad tight coupling.

The other is more logical, where you only extract logic in places you want to always change together. Simple and effective.

permalink
report
parent
reply
3 points

DRY, but also pre-optimization and dependency hell are bad.

permalink
report
parent
reply
46 points

D) spend millions developing an AI to generate the boilerplate generator badly

permalink
report
parent
reply
5 points

I find DRY often turns into an antipattern because decoupling is far more important than code reuse in practice. Having a function that supports many different code paths can make it very brittle because any changes to it need to consider all the possible use cases. However, if you have two separate functions that are similar, but can evolve independently then you don’t have that problem. As a rule, it’s better to duplicate code first, and then extract parts that turn out to be general purpose functionality once that’s identified through usage, and to put that code into libraries.

permalink
report
reply
8 points

It’s not really that hard to implement AI as far as I can tell, even if it does produce garbage results. Any CEO that thinks otherwise is getting bamboozled.

Not that I’m defending AI, boilerplate is still boilerplate and a crappier product is a crappier product. But they’ll take that trade off anyway which is why heads need to roll, lol

permalink
report
reply
20 points

I don’t get it, what’s so bad about boilerplate?

permalink
report
reply
3 points

Boilerplate is bad because it’s fundamentally just noise. When you read the code you want to be able to tell what the purpose of the code is and what the problem it solves. Ideally, code should be expressing that as clearly as possible. Having a lot of boilerplate is typically an indication that the language semantics don’t allow you to express the solution in a clear way and you have to write a lot of incidental code. The more code you have to read the more cognitive overhead there is in understanding it and keeping it all in your head.

permalink
report
parent
reply
5 points

It’s the most boring thing of the technical side of the job especially at the more senior levels because it’s so mindnumbingly simple, uses a significant proportion of development time and is usually what ends up having to be redone if there are small changes in things like input or output interfaces (i.e. adding, removing or changing data fields) which is why it’s probably one of the main elements in making maintaining and updating code already in Production a far less pleasant side of job than the actual creation of the application/system is.

permalink
report
parent
reply
7 points

It’s boring to write

permalink
report
parent
reply
8 points

well why is it good? why not just assume the boilerplate as the default and require the user to override it if they want to do something fancy?

it’s just busywork to always need to write the same stuff, and it also makes the code less readable and many people look at all that boilerplate and nope the fuck out.

This is why python is so good for getting people to realize that programming isn’t magic, you just write the equivalent of one short sentence and BAM text in the terminal, no need to import the basic ability to print text which is so incredibly inane.

permalink
report
parent
reply
22 points

Found the Java developer.

permalink
report
parent
reply
5 points

Writing code is bad!

Writes condensed configurations and properties files in 3 different languages instead. Cloud deployment uses yet another source of configurations and properties.

Doesn’t write documentation for configuration and properties.

Ah, yes, that’s much more readable.

permalink
report
parent
reply
3 points
*

Sure, though you’re arguing against an entirely different thing. Nobody said writing code is bad.

permalink
report
parent
reply
8 points
6 points

do it like my companies does and do both. lol

permalink
report
reply

Programmer Humor

!programmerhumor@lemmy.ml

Create post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.

Community stats

  • 4.2K

    Monthly active users

  • 947

    Posts

  • 10K

    Comments

Community moderators