Where to put comments and javadoc? Model or Controller?

1

I'm doing an MVC program, but when it comes to describing in%% of what each window does, I was in doubt whether to put those comments in the javadoc (Model) itself, or forms of its windows . Which one would be the most correct? Because controllers is the essence of the window, and form is who does most things ... Help me!

    
asked by anonymous 03.06.2016 / 01:48

2 answers

1

We should give at least a brief description of both, so that the programmer who goes to get them does not even have the possibility of not understanding what it is.

/**
 * Modelo para criação e validação do Código de Barras da Caixa
 * 
 * @author João Victor B. Magalhães 
 * @since   0.1
 * @version 0.1
 * 
 */
public class CodigoDeBarrasCaixa implements CodigoDeBarrasBoleto {
    private String digitos;
    private BoletoBancario boleto;

    private static final int TIPO_DE_COBRANCA = 2;
    private static final int ID_EMISSOR_BOLETO = 4;
    private static final int TIPO_MOEDA = 9;
}

I do not see a need to document Getters and Setters, but if you have a more complex method or a hard-to-understand attribute, you should also document it. In the controller the same thing, give a description of what it does and if it has any method outside the "common" document it. If it is already a program that is distributed in a team always put @since for the team to know when you added the method and @version as well.

    
03.06.2016 / 03:44
1

javadoc is not the best tool to describe how to use the application's graphical interface , if that's what you're trying to do. It is for you to describe how to use the classes (and methods, consequently) of your project.

In case, if what you want to do is actually document the classes, you should do this in both the model and the controller.

    
03.06.2016 / 02:15