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

This pretty much sums up how that would go down.

Q:

Should return 3 for this test case

x = add(1, 2) assert.equals(x, 3)

A:

function add(a, b){ return 3 }



I get your point and fully agree with it.

But it makes me wonder when exactly we start to call something over-engineered. The same function will be implemented differently depending what you are going to feed into it i.e. if the numbers are sufficiently large then you need to worry about integer overflow etc. Probably a function definition should be considered incomplete without pre/post conditions.




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

Search: