I have a class that has loads of functions, and I can't divide it in multiple class :
Class A {
// attributes
/**
* Descriptive of foo
*
* @param i ...
* @param j ...
*/
public void foo(int i, double j) {
....
}
// doc for foo2
public void foo2() {
....
}
....
// doc for foo8
public void foo8() {
....
}
}
Question is, is it a good practice to make it implement an interface which will take care of the comments ?
/**
* No function bodies, so there is more place here !
*/
interface AHelper {
/**
* Descriptive of foo
*
* @param i ...
* @param j ...
*/
public void foo(int i, int j);
// etc
}
/**
*
* @see A
*/
class A implements AHelper {
public void foo(int i, int j) {
....
}
// etc
}
This way, the interface looks the same way as C headers. The idea behind it is having two files with around ~150 lines and not a single file (the Class) with 300 lines.