diff --git a/src/teaching/cse-562/2017sp/project-mistakes.md b/src/teaching/cse-562/2017sp/project-mistakes.md new file mode 100644 index 00000000..07f11362 --- /dev/null +++ b/src/teaching/cse-562/2017sp/project-mistakes.md @@ -0,0 +1,10 @@ +--- +title: CSE-562; Common Project Mistakes +--- +### Use Strings instead of Enums in inner loops + +`myString.equals("test")` is slooooooow. If the number of times that you need to call this function scales with the number of tuples in the data, consider using an [Enum type](http://docs.oracle.com/javase/tutorial/java/javaOO/enum.html) instead. + +### Non-compositional code + +Maintaining separation of concerns is important. You *can* create one big main function that evaluates the entire query, but by checkpoint 2 it's going to become a mess of spaghetti code and a nightmare to maintain and debug. Break it up into smaller components. As mentioned in class, if you could have all of the logic encapsulated in a function, that would be the best possible option. However, since that requires `O(N)` memory, instead you should encapsulate the logical elements in iterators: Create a "Filtering" iterator, a "Mapping" iterator, an "Aggregating" iterator, etc... \ No newline at end of file