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

This reminds me of the old saying "if you don't have time to do it now what makes you think you'll ever have the time to do it later?"


What I need right now might be a working algorithm which gives the right output and gets the job done for the handful of inputs it's being given.

What I know right now (since I've just been working on the code) might be a much more efficient way to do the same thing, which requires some tricky implementation details, handling of edge-cases, etc.

YAGNI, premature optimisation, etc. says I should stick with the working, slow version until it becomes a bottleneck. The future dev (or future me) who hits a speed issue, does some profiling, and sees this function eating resources, may appreciate finding a comment there listing known issues and potential alternatives.

Depending on how bad the performance gets, they may definitely have time to implement the replacement, as they wait for the slow version to finish ;)

(Disclaimer: I'm currently trying to speed up an O(n^3) algorithm which was fine for n=200 but is now taking hours for n=3500)


Exactly - YAGNI essentially says you don't need TODOs littering your code. You can cross that bridge if and when you get there.

Your disclaimer is interesting. What's more useful than a code base littered with potentially useless TODOs is a codebase containing an explicit set of assumptions agreed upon by the product stakeholders, product owner and implementation team. Then when some aspect of that implementation was influenced by one of those assumptions, say your n=200 and the assumption was n<=500, then you can reference the assumption right there in your code. Then if at some later point in time that assumption should change you can easily find all the code needing to be revisited.


Because thousands of times in my life I've had more time the day after today.


What makes you think you ever won't?

Plus, sometimes, it might not need to be done tomorrow, if it turns out to be obsolete.


Because I need to push the code out today and I have other obligations to meet in my life.




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

Search: