Java Documentation on Android Studio

10:55

Java Documentation on Android Studio


If you've coded at some point in your life then you must certainly have come across complaints of unused methods, non functional classes and behaviour of redundant codes.

Issues like these add to the difficulties during implementation and causes trouble when they are being rectified. In order for the project to not become a nestle of connections and non reliable dependencies, it is important to rely on the use of documentation. Using it in your code will make your project consistent and sturdy, with a clear view of goals and scope.

Documenting your project makes it easier to understand what is happening, since it creates a history. And from this point, taking future decisions will be easier. It also brings consistency by paving a way for everyone involved to follow, making it an essential part of the project's success.
In addition to creating a development pattern, you end up helping new team members to interact with the project, thereby increasing the speed, efficiency and reuse at the time of implementation. Bear in mind that the new members will be much more agile and will save time when understanding what is happening in the code.

Here at CouchJumping we are working with many technologies including Java / Android. Our team works towards the commitment of keeping the code clean, intelligible and reusable. Therefore we document the code so that the development process is much more efficient. Below are some examples of comments that you can use.

Simple comments - Usually used before the classes. Here you can explain what the function of class.

1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**

    * This class will be use to keep ever events created for CouchJumping.

    */

    public class EventCJ {


         /**

         * This variable receive the name of event.

         */

         private String eventName;


         /**

         * Method to create a new event name.

         * This variable should receive the complete name of event

         * like 'Picnic on Phoenix Park'

         */

         public EventCJ(String eventName) {

            this.eventName = eventName;

         }

    }

Comments using TAGS - You can define tags like @return and @param. This tags show to developer what happens with the method before using of code. Some of most important are: @author, @see, @version, @return and @param. If you start using these examples, your job will be certainly well done.

1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**

 * Get name of event that will happen.

 * @return the name of event.

 */

public String getEventName() {

    return eventName;

}


/**

 * Change the name of event.

 *

 * @param newEvent This event will receive a new name

 * like 'Picnic on Phoenix Park'

 */

public void setEventName(String newEvent) {

    newEvent = newEvent;

}

And finally, to generate the Javadoc of your code in Android Studio go to the Tools menu and then click Generate JavaDoc ...

Screenshot from 2015-09-10 09:40:03.png

Here you will be able to customize the documentation by choosing the types of methods, classes, and where the documentation will be saved.

You Might Also Like

0 comments

Couch Jumping