[hibernate-dev] [HV] Design philosophy

Emmanuel Bernard emmanuel at hibernate.org
Thu Apr 12 03:30:54 EDT 2012


On 11 avr. 2012, at 20:59, Gunnar Morling wrote:

> Hi,
> 
>> When adding a feature, we have always implicitly asked ourselves this pool of questions:
>> 
>> 1. Does it feel like the right way of doing things?
>>    If it's not, we have been prone to wait till we mature on the idea. Take collection element constraints as a good example. We know the right way but
>>    it's not available to us yet
>> 2. Can I do it with an existing construct with similar or less complexity?
>> 3. Is this feature wrong? eg validating unicity with a database query is wrong.
>> 4. Is this a popular request?
>> 5. Is this feature useful in the general scheme? "What's your use case?" mantra.
>> 6. Is it the most readable approach?
>> 7. Is the feature designed consistently with the rest of the library
> 
> That's a really valuable catalogue of questions. Is it available in
> the Wiki somewhere?
> 
> I think it might make sense to have some manifest or charter like this
> publicly available, so that we can use it as base for discussions such
> as the one at hand, but also as reference for users why we're leaving
> out certain feature requests.

I have created https://community.jboss.org/wiki/DesignPhilosophyOfTheHibernateProjects
Please improve. I have only mentioned HV, HSEARCH, BVAL but other projects are free to join the list :)

> On using reg exps in general, I guess their power (and thus
> complexity) is their strength and weakness at the same time. So
> another idea might be to provide simplified means of specifying
> patterns by only using "*" (and maybe "?") as placeholder (as known
> from Windows search):
> 
> @Email(pattern="*@hibernate.org")
> 
> or
> 
> @Email @SimplePattern("*@hibernate.org")
> 
> I think that's reads pretty well and might be sufficient for most use
> cases (and all others could still use @Pattern).

The idea of a @SimplePattern annotation is interesting. It would solve the start with / end with / contains typical use cases. You might need a flag for case sensitivity though.




More information about the hibernate-dev mailing list