Do everything in Java…

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Fri Dec 5 05:26:03 PST 2014


On Thu, Dec 04, 2014 at 09:03:59PM -0800, Walter Bright via Digitalmars-d wrote:
> On 12/4/2014 6:47 PM, ketmar via Digitalmars-d wrote:
> >and what i also can't grok is "test-driven developement". ah, we
> >spent alot of time writing that tests that we can't even run 'cause
> >we didn't start working on the actual code yet. it's splendid! we
> >didn't start the real work yet and we are already bored. i don't
> >believe that this is a good way to develop a good project.
> 
> What I find most effective is writing the unit tests and the code they
> drive at the same time.

Yeah, in D, I find that whenever I'm writing a tricky bit of code, I
always do an :sp in vim and start adding unittests past the end of the
function to record the tricky cases that come to mind. It's proving to
be extremely useful in keeping bugs out, because sometimes there are
just too many special cases to remember to test afterwards, so if you
don't write out the unittests right then and there, you'll probably
forget some subtle corner case which will inevitably come back to bite
you at the most inconvenient time afterwards.

As for TDD... or OOD, or whatever other acronym / bandwagon methodology
that get invented every 5 years, I've always been a skeptic. I'm pretty
sure the underlying ideas are beneficial -- unittests, thinking of your
data in terms of objects, etc.. They are useful tools for getting your
job done, and done well. But when you start pushing that as the be-all
and end-all of programming, it ceases being a tool and becomes an
idealogy shoved down your throat -- everything Must Be A Class Even When
It Only Has Static Methods, You Must Write Tests All Day Before Writing
A Single Line Of Code, ad nauseaum -- that inevitably results in
needlessly convoluted code that isn't actually *better* than more
straightforward code to begin with, as well as coders who hold the
strange belief that by following the proposed magic formula their code
will magically become correct even if they never even bothered to
*think* about their programming problem.

As Walter once said:

	I've been around long enough to have seen an endless parade of
	magic new techniques du jour, most of which purport to remove
	the necessity of thought about your programming problem.  In the
	end they wind up contributing one or two pieces to the
	collective wisdom, and fade away in the rearview mirror.
	-- Walter Bright


T

-- 
Music critic: "That's an imitation fugue!"


More information about the Digitalmars-d mailing list