Anda di halaman 1dari 2

M255 Object-oriented programming with Java

M255: TMA Guidelines and Advice


The guidelines and advice detailed below generally apply to all M255 TMAs. Where there is conflicting advice given in a particular TMA question, you should always follow the advice given in the TMA. The Solution Document referred to throughout this file is the word processor document that you should use to answer a particular TMA. It should be clearly headed with your name, the number of the TMA, and your personal identifier. Your Solution Document must be in Microsoft Word 97 format and have a .doc extension, or be in rich text format and have an .rtf extension.

Plagiarism
The work you present in a TMA Solution Document must be your own. It is unacceptable to copy chunks of text or code from websites, from other students or to request solutions from online programming forums. More information on plagiarism can be found in the Assessment Handbook accessible from your StudentHome page.

Advice on answering coding questions


The following is general advice on how to tackle coding questions.

Saving your TMA Projects


We advise you to create a separate folder in which to keep all your TMA projects. If you have installed BlueJ in the default location, a suitable folder would be: My Documents/M255/MyProjects

Read the question


When tackling coding questions in TMAs you should read through the whole question before starting on your solution. This will give you a better understanding of where the question is going, so that you can answer the earlier parts of the question in a way that may help with later parts.

Advice on TMA wording


If a question says write down, then it is sufficient just to give the answer (no explanation is needed). Where a question says explain the explanation can usually be brief, but your explanation should refer specifically to details of the question. For example, if asked to explain what is wrong with the following code: frog1.position("5"); an answer such as It should be 5 is insufficient. For full marks your answer should be something like: The position() message for Frog requires an argument which is an int, not a String object, so the code should be frog1.position(5);

Copy any code that you are asked to write into your Solution Document
When a question asks you to write code in the OUWorkspace, or in a class in a project, then you must always copy and paste the code that you write into your Solution Document under an appropriate subheading that matches that of the question. If you do not include your code in your Solution Document your tutor cannot mark it. When you are asked to write a method or constructor, you must also always write an initial comment that must be copied, along with the method (or constructor), into your Solution Document.
WEB 02064 7 2.1

Copyright 2010 The Open University

When you are asked to modify a method or constructor, the whole method (or constructor) including the comment and header should be included in your Solution Document unless the question specifies otherwise. Remember that when writing code for a new class you may need to include an import statement at the start of the class, For example if a new class needs to use OUDialog or OUColour you would need to write import ou.*; at the start of your class file.

Testing your code


After writing (or altering) a method or constructor, before moving on to the next part of the question, you are strongly advised to test the method by sending the corresponding message to an appropriate object in the OUWorkspace and: observing the results in the Display Pane (if appropriate); observing the results in a graphical window (if appropriate); inspecting the state of the object.

You need only give details of any testing you carried out in your Solution Document if the question specifically asks you to include the tests in your answer.

If you can't get some code to work


If you do not complete a question, then include in your Solution Document the code for the parts you have completed, together with partial code for other parts that you have attempted but not got to work. You may also want to include notes on the incomplete parts, or those that are not working, so as to help your tutor identify the problem and give you appropriate feedback.

Guidelines on code quality and style


In marking the Java code in your Solution Document, your tutor will be assessing the style and quality of your code, as well as whether it works. In other words, working code may not in itself be sufficient for full marks. Aspects of style and quality include the following, though this list is not comprehensive and includes guidelines on code quality and style which may involve concepts introduced later in the course: clear layout which uses appropriate indentation to reflect the structure of the code; use of a monospaced font such as Courier New for all code; the use of meaningful identifiers for variables and methods; initial method comments; the inclusion of explanatory comments in your code if it is particularly complex; the use of parentheses in expressions, where appropriate, to make code more readable; the use of accessor messages within methods to get and set instance variables; taking advantage of opportunities for reuse where appropriate, including: o o o defining a new class as a subclass of an existing class; when writing methods, making use of messages that invoke helper methods rather than duplicating the code of the helper method; emulating well-established patterns of design and coding;

use of the programming constructs that you have been taught in the course, so as to produce a neat and efficient solution, such as appropriate use of conditionals and looping constructs.

Anda mungkin juga menyukai