Forum OpenACS Development: Re: Why unique constraints should be treated with care

Collapse
Posted by Don Baccus on
So if you have this case where a bunch of users have "info@company" as their e-mail rather than individual e-mail ... is there any particular reason why you can't simply set their e-mail to "null"? They can still log in with their username in this instance, right?

After all, if "mailto:oct@openacs.org"; were to be my e-mail address in an OpenACS instance, I would be unhappy if I were to get 10 copies of every alert sent out for a forum post.

Wouldn't you?

ISTM that while getting rid of the unique constraint might be the SIMPLEST solution to your problem, it can hardly be considered the BEST solution. Your solution might make the person who has to read "info@company" unhappy if there are 100s of employees making use of it as their "token" e-mail.

The datamodel doesn't presume that every person will have a unique e-mail address. It assumes that shared e-mails form a group, a party, that (say) "info@company" belongs to the company itself, not any individual.

Perhaps this isn't practical but it does allow modelling of real world scenarios. The datamodel allows for group as well as individual e-mails, in other words. The toolkit doesn't support it well out of the box, and perhaps the datamodel might be more awkward than you'd prefer, but you are WRONG to flatly claim that the datamodel doesn't support this real-world scenario.

As far as process goes, Malte, my issue here is that there's a tendency to commit changes that avoid roadblocks that follow the path of least resistance - the simplest change to solve your personal problem - rather than raise flags and ask for discussion.

If you had approached this by first posting "hey, I've got a problem, any ideas on how to best solve it?" my reaction would be a bit different.

Likewise the addition of the additional table after code freeze. I am in no way convinced that you and/or Timo have solved the problem in the best way, but given that this core datamodel change was made at (past) the last minute without any prior discussion was not even been given the chance to think about the problem.

If it were just me it would be no problem, but given Daveb's reaction (a man whose life seems to be spelled "IRC") it seems pretty clear that changes of this sort are being made without discussion with anyone.

That's not good. The plea for public discussion before such changes are made rather than afterwards when folks read your commit message isn't meant to make it painful for you to make changes. Rather it is meant to make life less painful for us as a community by discussing fundamental issues first, while making changes later.

The data modell does not support the real world example that an organization can have the same e-mail address as an individual within this organization at the same time. Due to this constraint all applications are forced to write some code which allows them to find the best e-mail address to use. In contacts we do this for employees by using the nasty hack of saying "if e-mail empty, check for employer e-mail and use this one". Though this spells trouble for the users who work at two different organizations but have a prefered organization e-mail. Dropping the unique constraint allowed us to do exactly this.

But anyway, I will not bring up a TIP but use this in our own patch which we just don't commit (as this has proven the best way for other companies who have the need for changes and don't have the luxury of lengthy debates). Which should solve the process problem from our side as, if we accidently make a commit which you feel should be discussed, we immediately remove it and put it into a patch. No big deal. If you feel this puts an unnecessary burden on the community (as obviously I disagree with your interpretation of the TIP rules and therefore am prone for running into this conflict again and again), feel free to ask us not to commit anything to core anymore, then we at least know where we stand.

As you mentioned the issue with application data links, feel free to start a discussion on that and we will make our point why we did it this way (as we did earlier, but I don't think that a list of IRC logs and forums posting links would change your perception). If you don't like then we will just put it into a seperate package as it would be totally unfair if we put this into a patch as nearly all packages we have been working on rely on that API [yeah, I know, very *evil* and sneaky behaviour of making a core change and making sure that removing it will render 5 packages useless 😊].