Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If I felt the the person reading the code needed to know... I'd go ahead and make that name even uglier.


That doesn't quite fit with "you already know exactly what it does" - you left out a detail.

Whether it is reasonable to leave that out or not, the point is that it takes a lot of text to unambiguously cover every possible facet of meaning even for tiny, simple operations.


> That doesn't quite fit with "you already know exactly what it does" - you left out a detail.

My mistake. Take it from another perspective. The name is good because it lets you know every single detail about the function except for whether or not it mutates the list.

> Whether it is reasonable to leave that out or not, the point is that it takes a lot of text to unambiguously cover every possible facet of meaning even for tiny, simple operations.

Of course naming is limited, you can't describe an entire program with just names. I'm simply stating a convention: Clarity over elegance. I'd rather make the name as descriptive as possible over as elegant as possible. Perfect clarity and perfect elegance are rarely achievable.

So in short, if I see opportunities to increase clarity, I will do so at the cost of elegance, and I will only increase elegance if there is no sacrifice in clarity.

also:

   createReversedListWithOneAddedToEachElementFrom(input_list)




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: