Hacker News new | ask | show | jobs
by avigesaa 4241 days ago
Depending on the language and context, an explicit method name like "findEventsFromLast6Hours" isn't that bad. If it's just a private helper method, I'd let it pass.

Empirically, I've found that methods with ambiguous parameters (e.g. "findEvents(6)") are a much bigger problem (event amongst senior programmers).

1 comments

I also had a problem with this example from OP. It is generally a good idea to implement the minimum amount of functionality to satisfy the requirements. I have seen many complex systems fail because it was over-engineered with the idea that 'we might need this down the road'.

When requirements change, you almost always have to rewrite the code. If you don't have to rewrite the code, you still have to go back and read it to make sure it satisfies the requirements. Less code to deal with will make this process easier. There is no reason to over-engineer today for what might happen tomorrow.

Code for the here and now, and aggressively delete code whenever possible.

If your 'coders' are writing functions like findEventsFromLast6Hours, you are not giving them clear requirements.

I assume you gave this engineer the requirement 'find all events from the last 6 hours.'

You should have given them the requirement to find the latest events for a specified interval.