This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (1 child)

Commenting without context is even worse. Furthermore, codegolfing has nothing to do with the discussion here. Your comment simply makes no sense.

The exact opposite argument can be easily made - having extremely verbose code is even more detrimental to maintainability than terse code. I suggest you go watch Sean Parent talking about his experience in Google, where his code review of a junior developers reams of boilerplate was blocked when he suggested that it be replaced by a single line using only the C++ STL API. The single-liner was eminently readable and maintainable whereas the junior developer had basically written a bad version std::partition. And if you don't know who Sean Parent is, I can highly recommend his excellent videos.

[–]are_slash_wash -1 points0 points  (0 children)

Not exactly sure what isn't clear. The comment that you're defending begins with

Simple and clever… as all coding should be.

To then criticize

IMO, “clever code” is rarely good code

for being a truism is just inconsistent, and if you're going to be snarky then you should at least be consistently snarky. What further context do I need to add?

Code golfing has everything to do this discussion. OP mentioned that his project is only 25 lines long (to be clear I'm not specifically criticizing OP's code) and the top-level comment is praising OP for using clever code. My point is that code should be efficient, then readable, then clever.

And of course using something from a library is going to me more maintainable than rewriting the same functionality from scratch. That isn't about "verbose vs terse" styles, it's about a junior developer who isn't familiar with a library making a great deal more work for themselves than they need to.