<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-3933266989882835478.post6999702038716982148..comments</id><updated>2009-03-13T14:05:08.698Z</updated><title type='text'>Comments on David Peterson: Avoid not using positive method names</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.davidpeterson.co.uk/feeds/6999702038716982148/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3933266989882835478/6999702038716982148/comments/default'/><link rel='alternate' type='text/html' href='http://blog.davidpeterson.co.uk/2009/02/avoid-not-using-positive-method-names.html'/><author><name>David Peterson</name><uri>http://www.blogger.com/profile/03475136061061572446</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3933266989882835478.post-1252149953933414966</id><published>2009-03-13T14:05:00.000Z</published><updated>2009-03-13T14:05:00.000Z</updated><title type='text'>Yeah, or maybe use a "tell, don't ask" approach an...</title><content type='html'>Yeah, or maybe use a "tell, don't ask" approach and, instead of asking UserDetails all those little "getter" questions, tell it to assertIsValid().</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3933266989882835478/6999702038716982148/comments/default/1252149953933414966'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3933266989882835478/6999702038716982148/comments/default/1252149953933414966'/><link rel='alternate' type='text/html' href='http://blog.davidpeterson.co.uk/2009/02/avoid-not-using-positive-method-names.html?showComment=1236953100000#c1252149953933414966' title=''/><author><name>David Peterson</name><uri>http://www.blogger.com/profile/03475136061061572446</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='01215506581573414240'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.davidpeterson.co.uk/2009/02/avoid-not-using-positive-method-names.html' ref='tag:blogger.com,1999:blog-3933266989882835478.post-6999702038716982148' source='http://www.blogger.com/feeds/3933266989882835478/posts/default/6999702038716982148' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3933266989882835478.post-3741114651919433775</id><published>2009-03-13T13:38:00.000Z</published><updated>2009-03-13T13:38:00.000Z</updated><title type='text'>This really confuses me too. It gets awfully tangl...</title><content type='html'>This really confuses me too. It gets awfully tangled when client code starts calling negative-sense method names with a ! operator and then doing most of the work in the 'else' branch of an 'if'.&lt;BR/&gt;&lt;BR/&gt;Rather than inverting the sense of these methods (which, like David, I prefer) you can sometimes make things more comprehensible by dropping the slavish devotion to the 'is' prefix and using ordinary English words like 'unlocked' over constructions like 'nonLocked'.&lt;BR/&gt;&lt;BR/&gt;If the docs for 'isAccountNonExpired' say "true if the user's account is valid..." why not call the method 'valid'? Or 'isValid'?&lt;BR/&gt;&lt;BR/&gt;If you want to preserve the distinction between credentials vs accounts expiring (and I would be interested to hear why you'd want to), you could make it 'accountIsValid' or 'accountIsUnexpired'.&lt;BR/&gt;&lt;BR/&gt;BTW 'isCredentialsNonExpired' is a weird - and probably incorrect - use of grammar. It forces even more cognitive load on the reader.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3933266989882835478/6999702038716982148/comments/default/3741114651919433775'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3933266989882835478/6999702038716982148/comments/default/3741114651919433775'/><link rel='alternate' type='text/html' href='http://blog.davidpeterson.co.uk/2009/02/avoid-not-using-positive-method-names.html?showComment=1236951480000#c3741114651919433775' title=''/><author><name>Duncan Pierce</name><uri>http://duncanpierce.org/</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.davidpeterson.co.uk/2009/02/avoid-not-using-positive-method-names.html' ref='tag:blogger.com,1999:blog-3933266989882835478.post-6999702038716982148' source='http://www.blogger.com/feeds/3933266989882835478/posts/default/6999702038716982148' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3933266989882835478.post-1721848410463083611</id><published>2009-02-24T11:11:00.000Z</published><updated>2009-02-24T11:11:00.000Z</updated><title type='text'>Also the codebase we "inherited" has several insta...</title><content type='html'>Also the codebase we "inherited" has several instances of non positive (negative?) method names; the definition of a "negative" name itself looks like a smell (smells like a smell?).&lt;BR/&gt;Even weirder, we have both positive and negative method names declared as public, so they are both shattered through the codebase, and it is not clear whether sometimes one method is preferred over the other; we started refactoring everything to eventually delete all references to negative names.&lt;BR/&gt;Negative names only clutter code: that's bad, because we want our code to clearly communicate its intents, and this negation is a small but disturbing impedance between brain and code.&lt;BR/&gt;"Keep your code clean" is always a good advice :-)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3933266989882835478/6999702038716982148/comments/default/1721848410463083611'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3933266989882835478/6999702038716982148/comments/default/1721848410463083611'/><link rel='alternate' type='text/html' href='http://blog.davidpeterson.co.uk/2009/02/avoid-not-using-positive-method-names.html?showComment=1235473860000#c1721848410463083611' title=''/><author><name>.MOz</name><uri>http://www.blogger.com/profile/13289303319829436255</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.davidpeterson.co.uk/2009/02/avoid-not-using-positive-method-names.html' ref='tag:blogger.com,1999:blog-3933266989882835478.post-6999702038716982148' source='http://www.blogger.com/feeds/3933266989882835478/posts/default/6999702038716982148' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3933266989882835478.post-3711535904106338580</id><published>2009-02-19T23:37:00.000Z</published><updated>2009-02-19T23:37:00.000Z</updated><title type='text'>Thanks (I think).</title><content type='html'>Thanks (I think).</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3933266989882835478/6999702038716982148/comments/default/3711535904106338580'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3933266989882835478/6999702038716982148/comments/default/3711535904106338580'/><link rel='alternate' type='text/html' href='http://blog.davidpeterson.co.uk/2009/02/avoid-not-using-positive-method-names.html?showComment=1235086620000#c3711535904106338580' title=''/><author><name>David Peterson</name><uri>http://www.blogger.com/profile/03475136061061572446</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='01215506581573414240'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.davidpeterson.co.uk/2009/02/avoid-not-using-positive-method-names.html' ref='tag:blogger.com,1999:blog-3933266989882835478.post-6999702038716982148' source='http://www.blogger.com/feeds/3933266989882835478/posts/default/6999702038716982148' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3933266989882835478.post-226422200743756980</id><published>2009-02-19T14:05:00.000Z</published><updated>2009-02-19T14:05:00.000Z</updated><title type='text'>In the words of Bill and Ted, this is a most non-n...</title><content type='html'>In the words of Bill and Ted, this is a most non-non-non-non-non-heinous article :-)&lt;BR/&gt;&lt;BR/&gt;I have issues with negative method names too :-)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3933266989882835478/6999702038716982148/comments/default/226422200743756980'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3933266989882835478/6999702038716982148/comments/default/226422200743756980'/><link rel='alternate' type='text/html' href='http://blog.davidpeterson.co.uk/2009/02/avoid-not-using-positive-method-names.html?showComment=1235052300000#c226422200743756980' title=''/><author><name>Andy</name><uri>http://www.blogger.com/profile/15414690619832854980</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.davidpeterson.co.uk/2009/02/avoid-not-using-positive-method-names.html' ref='tag:blogger.com,1999:blog-3933266989882835478.post-6999702038716982148' source='http://www.blogger.com/feeds/3933266989882835478/posts/default/6999702038716982148' type='text/html'/></entry></feed>