EssaysForStudent.com - Free Essays, Term Papers & Book Notes
Search

Essay on Procedual Programming

By:   •  Research Paper  •  746 Words  •  March 28, 2010  •  1,020 Views

Page 1 of 3

Essay on Procedual Programming

Procedural programming Essay

Discuss, the truth or otherwise of the statement: “the more comments the better.”

“In computer programming, a comment is a programming language construct that provides a mechanism for embedding information in the source code that is (generally) ignored by compilers but may be of use to software developers or other programming tools that process the source.” From Wikipedia, the free encyclopedia. There are generally three types of java comments: line, Block and Java Doc. The two main ones are ; Line comments which start with two forward slashes (//) and ends with the same forward slashes, and Block comments which starts with a forward slash and asterisk (/*) and ends with an asterisk and forward slash (*/). Line and Block comments are both used by the programmer to add notes to the code so that other developers can read while viewing your source code.

In this essay I will be analysing views for and against the statement “the more comments the better.” So far we have looked at the definition of �comment’ and different styles of writing comments in java. Now, I will analyse how import comments are for the programmers. Comments are useful information, that will be read in future by other programmers or yourself therefore it is important that all comment are clear and understandable they should be able to explain the programmer what the program dose? And how it does it? This will help the developer summaries code or explain the previous programmer's intent.

Comments could also be used to guide a new programmer through source code that performs some task. In this way a new Programmer could get a useful insight and understanding to programming procedures.

To some extent we could agree with the statement “the more comments the better.” As the more comments you have the easier it is to analyze your code, therefore, the easier it is to debug your code. Therefore we could assume that adding comments to the code is Time saving.

However it could be argued that extraneous comments tend to clutter up a source file, making it difficult to extract the truly useful, reliable pieces of information. Hence the principle from Martin Fowler's book, "Refactoring": is useful. In his book it states that “When you feel the need to write a comment, first try to refactor the code so that any comment becomes superfluous.” In general it means that if you feel you need to write a comment then it means your code is complicated and not easy to understand and therefore it should be rewritten in different way if possible.

We could also argue that over the time the code will be changed by future programmers and when the code changes a developer must also update the accompanying comments. If he/she fails to do this, the comments and code will get out of order. The comments become incorrect and misleading. Over a long period of time the comments will degrade

Download as (for upgraded members)  txt (4.5 Kb)   pdf (87.4 Kb)   docx (11.7 Kb)  
Continue for 2 more pages »