Skip to content

Melonzushi/SE-Collab-Project

Repository files navigation

Software Engineering Collaborative Project

Chosen Computation

Calculate the first prime number greater than the input.

Design Diagram

Shows the system design diagram.

Design Workflow

  1. User sends a request to our compute server containing
  • Delimiters chosen
  • File path (Assume that the computation server has access to this location and can obtain a file handle
  • Result Destination (Either to a file, stdout, null, etc.)
  • User subscribes to the result if opted (Futures potentially as an implementation)
  1. Computation Coordinator starts its work, and will potentially notify our user when complete.
  2. DataStorage has access to our storage infrastructure, and will handle reading and writing. This process will live on the same server as the computation, because sending information over the wire to then write locally makes little sense.

Classpath management

  1. Navigate to your project directory
  2. Run .\gradlew eclipse to update .classpath and .project
  3. Add both to your .gitignore

Build Steps (Generating Protocol Buffers)

  1. Navigate to your project directory
  2. Run .\gradlew generateProto to generate protocol buffers
  3. If this fails on account of inability to delete, delete the build/generated directory manually, then re-run.

Code Standards:

We have a very short list of expectations for code around here.

Code should be self-documenting.

  1. Function names, parameters, and any local variables should aim to be self-explanatory without being too verbose.
  2. Make Javadoc comments for methods (Type /**+Enter and Eclipse will auto-insert the formatting.)

Important

For the sake of readable code, please hit Ctrl + Shift + F in Eclipse before saving a file. It reformats the file in a Checkstyles-friendly way. If Checkstyles still declines your commit, check the reason: Click into the Action, under Checkstyles, click into Print Results in the main column.

Code must compile before attempting to make a Pull Request.

  • It should never be the case that code cannot compile when trying to make a Pull-Request, as that strictly violates any semblance of quality.
  • Try to run the code locally. If it doesn't want to run, debug it.
    • Eclipse is very good about why errors happen.
    • See the Problems tab on the bottom of the main window (If using the default layout).

Caution

Do not add more than a single top-level object per file. Gradle will be angry. The file name has the same name as the class.

  • ClassA.java → ClassA This is Case-Sensitive

Examples of Minimum Quality Standards:

Fibonacci.java

/**
 * @author cameron
 * Handles generating the nth Fibonacci number
 */
public class Fibonacci {

	public static void main(String[] args) {
		int nthFib = Integer.parseInt(args[0]);
		System.out.println(new Fibonacci().findNthFib(nthFib));
	}

	/**
	 * Generates the nth Fibonacci number given an index.
	 * @param nthFib The index of the Fibonacci number to generate.
	 * @return an integer containing the nth Fibonacci number.
	 */
	private int findNthFib(int nthFib) {
		int currentFib = 1;
		int prevFib = 0;
		for (int i = 0; i < nthFib; i++) {
			int nextFib = currentFib + prevFib;
			prevFib = currentFib;
			currentFib = nextFib;
		}
		return currentFib;
	}
}

Checkstyles.java (Could use some more javadoc comments)

package checkstyles;

import java.io.File;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

public class Checkstyles {

	public static void main(String[] args) {
		if (args != null) {
			try {
				DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
				DocumentBuilder docBuilder = dbFactory.newDocumentBuilder();

				File inputFile = new File(args[0]);
				Document doc = docBuilder.parse(inputFile);

				NodeList list = doc.getElementsByTagName("file");
				String curFile;
				NodeList detailList;

				int line, col;
				String sev, msg, src;

				System.out.println("");
				System.out.println("| Severity | File | Error |");
				System.out.println("| --- | ---  | :---   |");
				for (int i = 0; i < list.getLength(); i++) {
					curFile = ((Element) list.item(i)).getAttribute("name").split("/./")[1];
					// If the file has any checkstyles entries
					if (list.item(i).hasChildNodes()) {
						detailList = list.item(i).getChildNodes();
						for (int j = 0; j < detailList.getLength(); j++) {
							if (detailList.item(j).hasAttributes()) {
								// We are in an error node or similar.
								line = Integer.parseInt(((Element) detailList.item(j)).getAttribute("line"));
								col = Integer.parseInt(((Element) detailList.item(j)).getAttribute("column"));
								sev = ((Element) detailList.item(j)).getAttribute("severity");
								msg = ((Element) detailList.item(j)).getAttribute("message");
								src = ((Element) detailList.item(j)).getAttribute("source").split(
										"\\.")[((Element) detailList.item(j)).getAttribute("source").split("\\.").length
												- 1];
								System.out.println(String.format("| %s | %s | [%d,%d] %s <%s> |", sev, curFile, line,
										col, msg, src));
							}
						}
					} else {
						System.out.println("|    | " + ((Element) list.item(i)).getAttribute("name").split("/./")[1]
								+ " | No errors found.");
					}
				}

			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages