Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Geoff listed some interesting examples of consequences with software failure, such as the Therac-25 radiation incident. With real time systems you don't get a second chance; testing is critical.

Test-driven development

Develop tests prior to or during development. Comes TDD comes from Kent Beck and the Agile/Extreme movement. And because there are methodologies there are also holy wars, but there's lots of good here. 

...

Geoff gave an example of some test code that fails with a Stop() message, forcing you to acknowledge the failed test. 

He once found a bug in InString while doing his own string testing. It was fixed in a later Clarion release. 

If possible get someone else to write the tests. Test for edge/corner case - he gave a number of good tests for string replacement.

Excellent video illustration Geoff showed an excellent video illustrating the dynamics of refactoring...

Michael Jackson's rules of optimization:

...

Knuth: premature optimization is the root of all evil. But don't pass up the 3% that needs to be done. Find the slowest part of the program and make that part faster.

Recommended book: the Programming Pearls books.

All changes have some risks. When you add new functionality, refactor. When you add a bug fix, add new tests. 

Code smells - are an indication that something is wrong. If you're logging bugs and you notice that you're getting a clump of reports, that's a code smell. There are lots of others - see Wikipedia. Martin Fowler says the number one code smell is duplicated code. 

And speaking of duplicated code, Geoff finished off with a discussion of code analysis using n-gramsWhat does Google n-gram corpus  have to do with code optimization? Can we use ngrams n-grams to detect duplicated code? There are challenges - indents, split lines, case inconsistencies etc.

Geoff worked on a way to standardize Clarion code. He processes the code into ngrams and has demonstrated a utility he wrote (available to conference attendees) that standardizes Clarion code and provides various ways to query the results. He demonstrated finding a huge block of duplicated code in data. Geoff then showed how he used the utility to find a massive block of mostly-duplicated code inside a single procedure.