User "NeilK" posted a comment on MediaWiki.r99619.

Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/99619#c24792
Commit summary:

Follow up to r99618; matching fix made in contest extension

Comment:

We don't care about 'performance' when it comes to a single SQL statement. We 
don't care about 'performance' when we're creating an object, and that happens 
rarely compared to how often it's accessed. We don't care whether it's 14 lines 
or 2. The only thing we care about is clarity, and this code is unclear.

In this case I see you are using the 'name' field as the real key, and the 'id' 
is just another redundant unique key which happens to indicate that this object 
was retrieved from the database. I think this distinction is causing more 
trouble than it is solving. You have a field that's required when initialized 
one way and not required when initialized another way. So objects of the same 
class are dissimilar in important ways.

It's also possible to do this: create a new campaign with the name "foo", then 
edit the campaign name to be an already existing campaign, then press save, and 
it overwrites the existing campaign. This seems surprising IMO.

I'm not sure if it's possible to fix this now, at this late date. I should have 
caught the misdesign earlier. I'll work on it.

_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to