4 just grammar
source | link

How bad it'sis it to have two methods with the same name but differentsdifferent signatures in two classes?

I have a design problem relationated with therelated to a public interface, the names of methods, and the understanding of my API and my code.

I have two classes like this:

class A:
    ...
    function collision(self):
        ....

...

class B:
    ....
    function _collision(self, another_object, l, r, t, b):
        ....

The first class havehas one public method named collision, and the second havehas one private method called _collision. The two methods differs in argumentsargument type and number. In the API _collision method is private.

For theAs an example let's say that the *collision* method checks if the object is colliding with *another* _objectcollision checks if the object is colliding with another object with certain conditions l, r, t, b (for example, collidecollide on the left side, the right side, etc) and returns true or false according to the case. The public collision method, on the other hand, resolves all the collisions of the object with other objects.

The two methods have the same name because I think isit's better to avoid overloadoverloading the design with different names for methods whothat do almost the same thinkthing, but in distinct contexts and classes.

This isIs this clear enough to the reader or I should change the method's name?

How bad it's have two methods with the same name but differents signatures in two classes?

I have a design problem relationated with the public interface, the names of methods and the understanding of my API and my code.

I have two classes like this:

class A:
    ...
    function collision(self):
        ....

...

class B:
    ....
    function _collision(self, another_object, l, r, t, b):
        ....

The first class have one public method named collision and the second have one private method called _collision. The two methods differs in arguments type and number. In the API _collision method is private.

For the example let's say that the *collision* method checks if the object is colliding with *another* object with certain conditions l, r, t, b (for example, collide the left side, the right side, etc) and returns true or false according to the case. The collision method, on the other hand, resolves all the collisions of the object with other objects.

The two methods have the same name because I think is better avoid overload the design with different names for methods who do almost the same think, but in distinct contexts and classes.

This is clear enough to the reader or I should change the method's name?

How bad is it to have two methods with the same name but different signatures in two classes?

I have a design problem related to a public interface, the names of methods, and the understanding of my API and code.

I have two classes like this:

class A:
    ...
    function collision(self):
        ....

...

class B:
    ....
    function _collision(self, another_object, l, r, t, b):
        ....

The first class has one public method named collision, and the second has one private method called _collision. The two methods differs in argument type and number.

As an example let's say that _collision checks if the object is colliding with another object with certain conditions l, r, t, b (collide on the left side, right side, etc) and returns true or false. The public collision method, on the other hand, resolves all the collisions of the object with other objects.

The two methods have the same name because I think it's better to avoid overloading the design with different names for methods that do almost the same thing, but in distinct contexts and classes.

Is this clear enough to the reader or I should change the method's name?

3 added 8 characters in body
source | link

I have a design problem relationated with the public interface, the names of methods and the understanding of my API and my code.

I have two classes like this:

class A:
    ...
    function collision(self):
        ....

...

class B:
    ....
    function _collision(self, another_object, l, r, t, b):
        ....

The first class have one public method named collision and the second have one private method called _collision. The two methods differs in arguments type and number. In the API _mcollision method is private.

For the example let's say that the *collision* method checks if the object is colliding with *another* object with certain conditions l, r, t, b (for example, collide the left side, the right side, etc) and returns true or false according to the case. The collision method, on the other hand, resolves all the collisions of the object with other objects.

The two methods have the same name because I think is better avoid overload the design with different names for methods who do almost the same think, but in distinct contexts and classes.

This is clear enough to the reader or I should change the method's name?

I have a design problem relationated with the public interface, the names of methods and the understanding of my API and my code.

I have two classes like this:

class A:
    ...
    function collision(self):
        ....

...

class B:
    ....
    function _collision(self, another_object, l, r, t, b):
        ....

The first class have one public method named collision and the second have one private method called _collision. The two methods differs in arguments type and number. In the API _m method is private.

For the example let's say that the *collision* method checks if the object is colliding with *another* object with certain conditions l, r, t, b (for example, collide the left side, the right side, etc) and returns true or false according to the case. The collision method, on the other hand, resolves all the collisions of the object with other objects.

The two methods have the same name because I think is better avoid overload the design with different names for methods who do almost the same think, but in distinct contexts and classes.

This is clear enough to the reader or I should change the method's name?

I have a design problem relationated with the public interface, the names of methods and the understanding of my API and my code.

I have two classes like this:

class A:
    ...
    function collision(self):
        ....

...

class B:
    ....
    function _collision(self, another_object, l, r, t, b):
        ....

The first class have one public method named collision and the second have one private method called _collision. The two methods differs in arguments type and number. In the API _collision method is private.

For the example let's say that the *collision* method checks if the object is colliding with *another* object with certain conditions l, r, t, b (for example, collide the left side, the right side, etc) and returns true or false according to the case. The collision method, on the other hand, resolves all the collisions of the object with other objects.

The two methods have the same name because I think is better avoid overload the design with different names for methods who do almost the same think, but in distinct contexts and classes.

This is clear enough to the reader or I should change the method's name?

2 Improved question
source | link

I have a design problem relationated with the public interface, the names of methods and the understanding of my API and my code.

I have two classes like this:

class A:
    ...
    function mcollision(self):
        ....

...

class B:
    ....
    function _m_collision(self, another_object, cl, dr, t, b):
        ....

The first class have one public method named mcollision and the second have one private method called _mcollision. The two methods differs in arguments type and number. In the API _m method is private.

For the example let's say that the *m**collision* method checks if the object is interactingcolliding with *another* object with certain conditions cl and, dr, t, b (for example, collide the left side, the right side, etc) and returns true or false according to the case. The mcollision method, on the other hand, resolves all the interactionscollisions of the object with other objects.

The two methods have the same name because I think is better avoid overload the design with different names for methods who do almost the same think, but in distinct contexts and classes.

This is clear enough to the reader or I should change the method's name?

I have a design problem relationated with the public interface, the names of methods and the understanding of my API and my code.

I have two classes like this:

class A:
    ...
    function m(self):
        ....

...

class B:
    ....
    function _m(self, another_object, c, d):
        ....

The first class have one public method named m and the second have one private method called _m. The two methods differs in arguments type and number. In the API _m method is private.

For the example let's say that the *m* method checks if the object is interacting with *another* object with certain conditions c and d and returns true or false according to the case. The m method, on the other hand, resolves all the interactions of the object with other objects.

The two methods have the same name because I think is better avoid overload the design with different names for methods who do almost the same think, but in distinct contexts and classes.

This is clear enough to the reader or I should change the method's name?

I have a design problem relationated with the public interface, the names of methods and the understanding of my API and my code.

I have two classes like this:

class A:
    ...
    function collision(self):
        ....

...

class B:
    ....
    function _collision(self, another_object, l, r, t, b):
        ....

The first class have one public method named collision and the second have one private method called _collision. The two methods differs in arguments type and number. In the API _m method is private.

For the example let's say that the *collision* method checks if the object is colliding with *another* object with certain conditions l, r, t, b (for example, collide the left side, the right side, etc) and returns true or false according to the case. The collision method, on the other hand, resolves all the collisions of the object with other objects.

The two methods have the same name because I think is better avoid overload the design with different names for methods who do almost the same think, but in distinct contexts and classes.

This is clear enough to the reader or I should change the method's name?

1
source | link