# Review Java and Oracle Projects ## Oracle-SQL-Basic-Statements All files must end with .sql instead of .txt as they are written in SQL Tables and Insert are OK ### Select.txt Why are all alias starting with uppercase? eg. `departments.name AS Department` As you are using `snake_case` in all database fields it would be better if all alias also follow the same pattern Example: `departments.name AS Department` would be written as `departments.name AS department_name` and `TRUNC(MONTHS_BETWEEN(SYSDATE,birth_date) / 12) AS Age` would become `TRUNC(MONTHS_BETWEEN(SYSDATE,birth_date) / 12) AS age`. Tip: Maybe it would be nice to also include a query using `HAVING` and `manager_id`. For example: get all employees who have a manager with 4 or more subordinates (you could say we want to know if some employees are getting enough help from their manager, but surveying all employees and reviewing all of them is costly so we will focus only on cases where managers have too many subordinates.) Other than that LGTM (Looks Good To Me) ## Java-GUI-Employee-CRUD Your project needs a `.gitignore` file, `.idea/` folder should not be present in a "production ready" code. Employee and Department are good, nice ### MainPage.java The methods `buildEmployeeList`, `findEmployee`, `getStringEmployee`, `updateEmployee`, `removeEmployee` and `saveEmployee` are not being used outside of `MainPage` class, they should be `private`. A good tip I use is whenever creating a method is to set as `private`, if you need it for inheritance move it to `protected`, if you need it outside the object/class move it to `public`. Beware of generic catches, as a fellow coworker would call them "Catch foda-se". There are few instances where you would want to catch any exception, it's always a good practice to know the exception you are expecting. Example of this would be: ```java import java.util.Random; public class Main { public static void main (String args[]) { String[] favoriteSites = {"youtube", "vimeo", "spotify"}; try { Random rand = new Random(); int randomIndex = rand.nextInt(3); // generates a random number from 0 to 3 String randomSite = favoriteSites[random_index]; System.out.print("My favorite site is: " + randomSite); } catch (ArrayIndexOutOfBoundsException exception) { System.out.print("My luck is not good :/"); System.out.print("Exception was " + exception.getMessage()); System.out.print("Trace is:"); exception.printStackTrace(); } } } ``` Here we know this program will only raise `ArrayIndexOutOfBoundsException`, but it should not be terminated when that happens. Let's say when our host machine doesn't have enough memory, `String randomSite = ...` would raise an `OutOfMemoryError` error, but in this case we want the program to be terminate as this is a critical failure, if we had used a generic `Exception` the program would still try to run regardless.