Question: I want to share code that calls server for data ... like a service called from multiple components that are not in same containment hierarchy. I want to do this on a lightning component in salesforce community.
I read we can use aura:method to call the methods of one component from a different componentv (not parent/child relationship). 

Does the aura:method work between completely unrelated components ?
If yes, please provide sample code.
Or if there is any alternate approach, please let me know.

Thanks for your time and help

Answer: 
You can create an abstract component and extend it in all the component. In the helper of that component put the re-usable code and if you extend the abstract component you inherit the helper methods which you can re-use.

One of the big use cases for that we use abstract component for is making calls to server from lightning component. Since the structure and most of the code is the same we created a abstract component and placed the call server code in its helper and called it from all components

Abstract Component:

```
<aura:component extensible="true"  >

```

Helper of abstract component:

```
callServer : function(cmp, method, callback, params, cacheable) {
 var action = cmp.get(method);
    if (params) {
        action.setParams(params);
    }
    if (cacheable) {
        action.setStorable();
    }
    action.setCallback(this,function(response) {
    });
    $A.enqueueAction(action);
}

```

In all the future components that i create where i want these methods i will just extend them

```
<aura:component controller="ABC Controller" access="global" extends="c:abstractcomp">

```

In the helper of this sub component i call the super component helper method by doing

```
this.callServer(component, "c.abcmethod", function(response) {
            }, {
                Taxid: '124'
            }, false);

```

I can create a bunch of re-usable methods put it in a utility component and extend it across other components wherever i need to use them.
We can achieve code resuability in multiple ways. I was able to achieve using aura:method in the following link (last option) developer.salesforce.com/blogs/developer-relations/2016/12/… . I personally felt this is better way because I can call multiple service components inside one single component, whereas in your above approach since I can extend only one controller, I cannot access more than one Apex controller. So the aura:method suits my requirement better