In looking through the current codebase I can't find a single reasonable use of computed properties, and the tests that use them would be significantly simpler if a plain method was used. If a Property absolutely is needed, then it can either be created by the client and delegate to that method, or you could use a plain Property (mutable) that is updated as needed.

So, @Computed is gone.

/Rickard

On 6/24/11 12:23 , Rickard Öberg wrote:
Hi,

As I go through the runtime of Qi4j, I can see that computed properties
mess things up quite a bit. Specifically, their creation require a
PropertyInfo to be supplied, which is a bit messy, and there's also
quite a few "if"'s in the code for computed properties. Also, I've
implemented Qi4jSPI.getPropertyDescriptor(property), but that one
doesn't quite work for computed properties.

So a question is: how useful are they, and could they be replaced with
something else? How many of you are actually using computed properties,
and what are the use-cases? In your usecases, what would happen if they
were simply replaced with methods?

I.e. instead of:
@Computed
Property<String> comp();

Property<String> comp()
{
return new ComputedPropertyInstance(...)
{
public String get()
{
return ...;
}
}
}
could you do:
String comp();

String comp()
{
return ...;
}

That would simplify things a whoooole lot :-)

/Rickard


_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to