On 10/22/2013 8:34 PM, Dan Kimmel wrote:
One of the tenets of agile, as I understand it, is to write the tester before you write the code. To make that really successful the tester must rely on a certain amount of reflection in the language. OO languages are reflexive by definition. RPG is in no way reflexive.
You don't need reflection to be able to write tests first.
You have to write unit tests anyway. Using Test Driven Development (TDD,
one of the techniques under the Agile umbrella), if you can write tests
after, you can write them before. The basic principles of Test Driven
Development are is that you write a line of code without having a
failing testcase that demands that line of code.
- write a testcase to test one specific thing (or add another variation
to an existing testcase)
- write the smallest amount of code necessary to make the test pass. If
you have an urge to also code for something else in case you forget, add
it to your list of future tests, don't add more code
- run the test
- run other self-checking tests for that code
Sometimes writing self-checking testcases is difficult, but it's worth
taking the time to automate as many tests as possible. And even if it's
not possible to run all tests after every change, it might be possible
to run all the tests every day. Even if it's not perfect "TDD", writing
unit tests before rather than after tends to give much better test coverage.
Remember that TDD is a developer task, not a tester task. The testcases
for TDD should never be written by someone else (except in a
pair-programming situation, but that's still not a "tester" writing the
testcases, it's just the other half of the development team).
I use TDD to develop the RPG compiler and runtime. The RPG compiler is
probably as far as you could get from the kind of code (Java, OO) that
you usually see in TDD discussions. The testcases are actually RPG
source code, where different RPG statements target different functions
in the RPG compiler.
"Agile" means many things, not just TDD.