Hacker News new | past | comments | ask | show | jobs | submit login

The only flaw I can see is that the string literal '1' should have been declared as a const somewhere, preferably in another unrelated library, and called something like 'UNITY_VALUE'.



See, this is why I'm tired of freelancers and architecture astronauts at companies who just like to make things more complicated.

UNITY_VALUE? Seriously? The agile approach would be to contact the customer, ask them what kind of user story they need to interact with the number 1, e.g. "As an admin, I want to interact with the number that is the square root of 1, which is also the product of i^4, and the multiplicative identity." There may be some back and forth on this, since regular users (not just admins) will want to work with the number prescribed above.

Then, you need to draw up a quick prototype. We don't need any crap like UNITY_VALUE polluting our beautiful agile code. Instead we'll declare a constant called ONE somewhere. (It doesn't matter where you put it, since we'll probably just Martin Fowler that code anyway in 10 weeks--actually, make that 2.)

Then you go back to the customer, show them the prototype. In my opinion, it helps to show them Euler's identity or the multiplicative identity just to assure them it works, in case they doubt it. (They probably will doubt it, since all this agile process stuff looks like automagic to the unenlightened morons we call customers.)

Then move on. Done. Bam. No need for this UNITY_VALUE junk. No additional libraries. Agile magic.


On the note of that, there should really be a SimpleNumberFactory.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: