Karsten's Blog

June 26, 2009

Using fit4oaw for complex Xtend functions

Filed under: fit4oaw — Tags: , , — kthoms @ 10:08 AM
This is my first try to use posterous. I’m excited what this service will provide me. To have something worthful to write about I decided to write about my current work I’m on today.
I have a customer who has defined a data transformation language with Xtext. Part of this language are declarations and usages of variables. No wonder. Of course variables can be used just within their scope – and here it becomes interesting. Xtext does not provide this out-of-the-box. The functions that we need to detect scoping are rather complex to develop. Basically we need just one function which detects for a given variable reference if the referenced variable is within the scope.
I use fit4oaw to go for a test-first approach. This helps me develop this function test-driven.
As you can see from this screenshot I evaluate expressions and compare their results. In the loaded model there are several variable references, and the function inScope() detects whether the referred variable is in scope. Now I have managed to get them all green, but work is not completely done. I now have to construct more complex situations and I know of at least one situation that would fail now. So – change the test model, add the test and it should fail again. Then develop further on the functions to handle this situation and the test should execute successful.
Writing complex Xtend functions was never so easy!

Posted via email from Karsten’s Blog

The Silver is the New Black Theme. Create a free website or blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 375 other followers