Predicate-style naming is derived from LISP I believe, where it was common to use _p on the end in lieu of ?. At ManageSoft around 12:30, there were often exclamations of "lunch_p" or "food_p" :-). Predicates are mathematical functions, so it's natural to mathematicians to omit the "is_" in a language that uses object.function notation, but I also prefer the English style.
Clifford. On 10/03/2009, at 4:27 PM, Steve Hayes wrote: > Unless you grew up using English I suppose. > > Aren't we trying to make our code more readable, rather than more > terse? > > On 10/03/2009, at 4:14 PM, Pat Allan wrote: > >> >> It's general ruby best-practices, I think. You don't need the 'is' >> prefix, as the punctuation provides the same effect, and much more >> cleanly. >> >> -- >> Pat >> >> On 10/03/2009, at 4:12 PM, Torm3nt wrote: >> >>> Hi Tim, >>> >>> Is this just personal preference? >>> >>> I was using the method names to exaggerate the example =) >>> >>> But now that I know you hate it WELL... >>> >>> heh >>> >>> >>> >>> On Tue, Mar 10, 2009 at 4:09 PM, Tim Lucas <[email protected]> >>> wrote: >>> >>>> if is_it_good?('apple') >>>> return it_is_awesome! >>>> end >>> >>> Get rid of any "it_is" or "is" in boolean methods please. >>> >>> empty? not is_empty? >>> >>> So something like: >>> >>> def respond_to_bad_joke >>> if @apple.good? >>> eat @apple >>> else >>> throw @apple >>> end >>> end >>> >>> A real example would be much better. >>> >>> >>> >>> >>> >>>> >> >> >> >> > > ----- > Steve Hayes > > Cogent Consulting > http://www.cogentconsulting.com.au > http://iridescenturchin.wordpress.com/ > Mobile: 0403 902 431 > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en -~----------~----~----~----~------~----~------~--~---
