concept method in category design

appears as: Methods, method, The method, methods, method, The methods
Object Design Style Guide

This is an excerpt from Manning's book Object Design Style Guide.

  • Methods and properties can have private, protected, or public scope. The scope relates to the class, not the object, so any object has access to private properties and methods of any other object of the same type:
     final class Foo
     {
         private string foo;
    
         public function equals(Foo other): bool
         {
             return this.foo == other.foo;
         }
     }
  • 5.1. A template for implementing methods

    Whenever you design a method, you should remember the following template.

    Listing 5.1. A template for methods
    [scope] function methodName(type name, ...): void|[return-type]
    {
        [preconditions checks]
    
        [failure scenarios]
    
        [happy path]
    
        [postcondition checks]
    
        [return void|specific-return-type]
    }
    Figure 6.2. There should be no calls to command methods hidden behind a query.