Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 KB | None | 0 0
  1. Next commments strarting from most important:
  2.  
  3. 1) Validation framework:
  4. - In general it is good idea when objects can handle it's own validation. But self-written implementation is suck. Java already had implement it for you: javax.validation package. And this validation approach could be reused as far as with rest framework like javax.ws.rs or for persistence engine like hibernate. Write own bycicle is arguable desing.
  5.  
  6. - In details:
  7. Every object return hard-coded String of possible error it is have. If no errors object returns empty string. BUT when it is a list of objects and try to validate them all - it is not possible to distinguish which exactly objects incorrect.
  8.  
  9. 2) Model objects is not clean and has dependency on exact json parsing library implementation. For example typical constructor signature is:
  10. public Option(JSONObject json) {
  11. default constructor not available.
  12. JSONObject came from json-simple:1.1.1. Now we can't reuse model objects without it library.
  13. What was the reson to use simple-json? Perfomance? Easy to use? I would not stop on this library.
  14.  
  15. 3) Is it a web app? The only rest api it is exposes is only one
  16. @GET
  17. @Produces("application/json")
  18. public Response main() {
  19. and in this method it is load test data from war file and validate it. I would expect it is able to validate separate TradeInformation.
  20.  
  21. 4) public class Util
  22. public static <T> boolean listContainsClass(Collection<?> arrayList, Class<T> clazz)
  23. - could be replaced with java 8 lambdas in one short line. And in advance - this class is used only in tests while resides in main source folder and will be not used in prod code.
  24.  
  25. 5)Using System.out.println, let see how many times:
  26.  
  27. (Get-ChildItem -Filter "*.java" -Recurse | Select-String -pattern "System.out.print" -AllMatches)
  28.  
  29. src\App.java:28: System.out.print(tradeInformationValidator.validate());
  30. src\dataProvider\JSONDataProvider.java:29: System.out.println("File " + source + " not found");
  31. src\tradeinformation\model\Option.java:45: System.out.print("Wrong data format");
  32. src\tradeinformation\model\TradeInformation.java:42: System.out.print("Wrong data format");
  33. src\tradeinformation\model\TradeInformationWithValueDate.java:25: System.out.print("Wrong data format");
  34.  
  35. will be refactoring for using logging. Searching for every System.out could not be so handy. Is familiar with slf4J?
  36.  
  37. 6) Commiting unnecessary eclipse files. Familiar with .gitignore and with git usage?
  38.  
  39. 7) While mvn clean install is able to run, don't follow strict maven folder structure. Why?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement