<< rCOS Modeler Release v1.2.4 | Home | Donations >>

Pop Quizz: Programming Language Semantics and Software Engineering

If you're doing OO software development, then chances are high that you recently refactored something like...

class M {
A a;
g() { ...
this.a.m();
this.a.n();
...
}

...into...

class M {                  class A {
A a;
g() { ... f() { m(); n(); }
this.a.f();
... }
}

But did you actually check that your program indeed had the same semantics as the following?

class M {
A a;
g() { ...
var A x = a;
this.a.m();
assert this.a == x;
this.a.n();
...
}

If you usually forgot to do things like this, maybe we might have something for you in the future. No more unsound or faith-based program transformations (but you'll have to learn how to use a theorem prover. Yikes!)

Exercise: Write a program in your favourite OO language that violates the above assertion!

Tags : , , ,



Add a comment Send a TrackBack