You can also use documentation comments to hide implementation details. In that case, kilometres represents the total distance the car has ever travelled, as shown on its odometer, so you could use the documentation comments to hide the badly‑named field. Let's say you have a getKilometres() method. The whole idea of documentation comments is to make the method/class easier for users to use.īack to the taxi example, where some of the fields have really bad names. You would need to mention the units somewhere, and the documentation comments would be a good place to do that. No, ¼km would be a disastrous unit to use. If you charge so much per 250 metres, you would need to take the parameter in ¼km metres. Even if you live somewhere where they have never heard of miles, it is possible that taxis need a different measurement. Somebody might think it is redundant to say anything about km, but I think it is necessary. I changed Liutauras's suggestion to shorten the parameter name and moved the bit about being measured in km into the documentation comments. In that case, explain what flongler means, or is it simply a word I made up for writing in this post? Let's look at a recent example. Then they should learn to make such comments informative, and then omit them if they add nothing but clutter. Public void setDescription(String description) At least the enforces the discipline that each method has a documentation comment maybe beginners should learn that first. * A String nothing is returned from this method KAA * The Product class defines a product and is used I don't know why I am getting errors that I show below. The function that it is commenting looks like: I don't know what the code A means after param The ones in the book look code A String for the product code. I am new to creating Java documentation from Eclipse.Īfter adding the /** and */, some text and tags such as and I
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |