View
232
Download
0
Category
Preview:
DESCRIPTION
Example /** * Read a stream in PPM format and return * an internal image. * stream stream to read PPM from. imageFactory a supplied factory that can create an suitable * (empty) image, which the PPM is written to. internal image read from the stream. * * TODO Rewrite to a finite state machine using hyperbolic indexing. * TODO Don’t believe everything you read. */ public void readStream(InputStream stream, IImageFactory imageFactory) {...
Citation preview
------TAO, MARKUS
Project IT
JavaDoc
‣ JavaDoc is a standard method of commenting source code (interfaces, classes, methods, instances variables).
‣ The source code can then be run through a tool which extracts the comments and generates, initially, HTML.
‣ Comments of the format /** ... */ are parsed by JavaDoc. ‣ The comment applies to the next element such as a class or
method. ‣ Inside the comment you can use special tags, which will be
formatted specially. ‣ Eclipse can help generate templates for JavaDoc comments
(seeSource>Generate Element Comment) with relevant tags. ‣ Eclipse can also show generated JavaDoc interactively, even
for your own classes,so write it from the start. It helps! ‣ More info on JavaDoc can be found on the web or with man
javadoc or inside Eclipse.
Example
/** * Read a stream in PPM format and return * an internal image. * * @param stream stream to read PPM from. * @param imageFactory a supplied factory that can create an suitable * (empty) image, which the PPM is written to. * @return internal image read from the stream. * * TODO Rewrite to a finite state machine using hyperbolic indexing. * TODO Don’t believe everything you read. */ public void readStream(InputStream stream, IImageFactory
imageFactory) { ...
JUnit
Write test case for each main function.You don’t need to write test case for getter
and setter.Right click the class, choose new and choose
JUnit test.Write your test case in the function and try to
cover the whole path of your function.(we will put the JUnit test in the ant then it can be automated)
SVN
For the windows http://tortoisesvn.net/downloads
It’s a good alternativeEclipse
SVN & Eclipse
Eclipse & subclipse (SVN)1) Download and install latest Eclipse on:http://www.eclipse.org/downloads/ (Eclipse IDE for Java Developers) And download the latest java if you don't have
it, on: http://www.java.com UBUNTU: due to a button bug for Eclipse in
Ubuntu you need to start it through terminal with the following lines:#!/bin/shexport GDK_NATIVE_WINDOWS=1/*your eclipse path*/eclipse
SVN & Eclipse
2) Install Subclipse through Eclipse, using this link:
http://subclipse.tigris.org/update_1.6.x3) In Eclipse, press Help and find "Install new
software...".4) Use "New Remote Site" if you have copied
the download link from above, or use "New Local Site" if you have
downloaded the actual subclipse files.
SVN & Eclipse
5) Fill in the location of your subclipse.6) Remember to check your Subclipse
update, so it is included in the installation, and press Next
(for Mac, include the SVNkit package as well)
7) Accept the agreement and begin the installation for Subclipse.
8) Restart Eclipse
SVN & Eclipse
Check out your project1) File -> Import2) Expand the folder SVN, and choose "Checkout
Projects from SVN"3) Create a new repository location and add the
URL: https://projectit.googlecode.com/svn/trunk4) username is your gmail adress and you get your
password by going to the project page, under the source tab.4) Choose project type and name, and press Finish.
SVN
Remember to ALWAYS update the project before committing your changes!
Code standard
This is the code standard recommended by SUN when writing Java programs.
http://java.sun.com/docs/codeconv/
Code standard
Code that is written according to a set of rules are easier to understand
it will look like the code has been written by a single individual, which makes it much easier to follow.
Code style is a matter of personal opinion, so there is no single True Way of writing code.
Don’t wants to spend time arguing about code style - just use one!
We will build checkstyle and pmd in the ant to check your code standard
Code standard
packages - all lowercase ‣classes - nouns, CamelCase ‣interfaces - as classes; nice to have initial I, e.g.,
IImageSource ‣methods - verbs, camelCase with intial letter lowercase ‣variables - descriptive, camelCase ‣constants - uppercase, words separated with
underscore ‣Additional considerations ‣Names should not reveal representation, access
method or algorithm.
Recommended