Skip to main content
added 342 characters in body
Source Link
K.Steff
  • 4.5k
  • 2
  • 33
  • 28

Why should that be a bad thing?

Just because it makes refactoring in Java harder, doesn't mean it is bad. For example, if I want refactoring in C++, it would be almost impossible in cases of some heavy template-dependent code, since the templates are Turing-complete. And in C++, templates are like the best thing in the language. Should we remove them to make refactoring easier?

The major concern in language design should be for the language to make the life/work of its users easier. And thisI think your rule is too narrow, and not intuitive at that.

Plus this strikes me as too stringent: say I am using two libraries, closed source (as much as it's possible in Java anyway). I have a class that needs to implement two interfaces, one from each library. But the interfaces have a method with the same name/signature.

By your logic, I'm doomed! And to think of it, the library designers did nothing wrong: is it their job to know all method names in all classes of all other libraries? There is no chance to ensure this, even if you try hard...

You might say that this should be split in two classes, but what if the library designers actually meant the same thing with the two methods? Having a class implement both interfaces is the proper way in this situation.

Why should that be a bad thing?

Just because it makes refactoring in Java harder, doesn't mean it is bad. For example, if I want refactoring in C++, it would be almost impossible in cases of some heavy template-dependent code, since the templates are Turing-complete.

The major concern in language design should be for the language to make the life/work of its users easier. And this rule is too narrow, and not intuitive at that.

Plus this strikes me as too stringent: say I am using two libraries, closed source (as much as it's possible in Java anyway). I have a class that needs to implement two interfaces, one from each library. But the interfaces have a method with the same name/signature.

By your logic, I'm doomed! And to think of it, the library designers did nothing wrong: is it their job to know all method names in all classes of all other libraries? There is no chance to ensure this, even if you try hard...

Why should that be a bad thing?

Just because it makes refactoring in Java harder, doesn't mean it is bad. For example, if I want refactoring in C++, it would be almost impossible in cases of some heavy template-dependent code, since the templates are Turing-complete. And in C++, templates are like the best thing in the language. Should we remove them to make refactoring easier?

The major concern in language design should be for the language to make the life/work of its users easier. I think your rule is too narrow, and not intuitive at that.

Plus this strikes me as too stringent: say I am using two libraries, closed source (as much as it's possible in Java anyway). I have a class that needs to implement two interfaces, one from each library. But the interfaces have a method with the same name/signature.

By your logic, I'm doomed! And to think of it, the library designers did nothing wrong: is it their job to know all method names in all classes of all other libraries? There is no chance to ensure this, even if you try hard...

You might say that this should be split in two classes, but what if the library designers actually meant the same thing with the two methods? Having a class implement both interfaces is the proper way in this situation.

Source Link
K.Steff
  • 4.5k
  • 2
  • 33
  • 28

Why should that be a bad thing?

Just because it makes refactoring in Java harder, doesn't mean it is bad. For example, if I want refactoring in C++, it would be almost impossible in cases of some heavy template-dependent code, since the templates are Turing-complete.

The major concern in language design should be for the language to make the life/work of its users easier. And this rule is too narrow, and not intuitive at that.

Plus this strikes me as too stringent: say I am using two libraries, closed source (as much as it's possible in Java anyway). I have a class that needs to implement two interfaces, one from each library. But the interfaces have a method with the same name/signature.

By your logic, I'm doomed! And to think of it, the library designers did nothing wrong: is it their job to know all method names in all classes of all other libraries? There is no chance to ensure this, even if you try hard...