Project mistakes
This commit is contained in:
parent
449b15902f
commit
a900a18287
10
src/teaching/cse-562/2017sp/project-mistakes.md
Normal file
10
src/teaching/cse-562/2017sp/project-mistakes.md
Normal file
|
@ -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...
|
Loading…
Reference in a new issue