News for hackers. Stuff that matters.
Re:Ask HN: For those programming 10+ years, what do you wish... by pvdebbe on Friday May 19, 2017 @06:43AM (#14374338)
Tests and TDD are different things.

I view TDD as a workaround for a lack of a REPL.

When the code is finished, the tests can be written or polished but writing them before any code is just one variation of testing.

Re:Ask HN: For those programming 10+ years, what do you wish... by zepolen on Friday May 19, 2017 @12:42PM (#14377314)
The point of TDD is you can define the behavior before writing the code. ie. you define the expected result:

  def test_sum():
      assert sum(1, 2, 3) == 6
  def test_sum_no_args():
      assert sum() == 0
  def test_sum_negatives():
      assert sum(-1, -2) == -3
etc, and then you write the function.

This means you only do the "REPL" testing once ever for each case - and you can rerun the tests for all future changes. If ever type the same function + args into the REPL more than once - you have done redundant work and are wasting your time.

Likewise if you're in the habit of writing tests after your function is made - it shows you haven't put much thought, which means you haven't done the proper analysis of why the function exists, if the function is really one function or should be two functions, what arguments it can take, what it should return etc.

Re:Ask HN: For those programming 10+ years, what do you wish... by arenaninja on Friday May 19, 2017 @05:06PM (#14379361)
> if you're in the habit of writing tests after your function is made - it shows you haven't put much thought, which means you haven't done the proper analysis of why the function exists, if the function is really one function or should be two functions, what arguments it can take, what it should return etc.

I'd say that's a pretty broad brush you're painting there with

Re:Ask HN: For those programming 10+ years, what do you wish... by zepolen on Friday May 19, 2017 @09:24PM (#14380528)
I'm not wrong.
Re:Ask HN: For those programming 10+ years, what do you wish... by arenaninja on Saturday May 20, 2017 @06:15PM (#14384635)
I would say that you are, but you've convinced yourself otherwise.

But testing is important, for sure.

Re:Ask HN: For those programming 10+ years, what do you wish... by pmarreck on Saturday May 20, 2017 @12:19AM (#14381015)
> I view TDD as a workaround for a lack of a REPL.

Every manual test you do of your code in a REPL is literally a unit test screaming out at you that it wants to live in your suite.