In your example I don't see the point of the XComponent class.And in both cases I would start with directly using values in the component, like:${properties.jcr:title}Only if need to write logic, write code. Otherwise leave it in the component I would say.