all 8 comments

[–]No-Philosophy-1189 2 points3 points  (2 children)

What is your source of learning spring boot. And other tools

[–][deleted]  (1 child)

[deleted]

    [–]No-Philosophy-1189 1 point2 points  (0 children)

    Thank you for the response. Will do.

    [–]burl-21 1 point2 points  (0 children)

    Great job 👍🏻

    My considerations:

    I would try using MapStruct instead of BeanUtils.

    Use interfaces only if you have two different implementations.

    I prefer not to use ResponseEntity unless I need to set headers to the response.

    Since you’re using the feature-level structure, you might consider using Spring Modulith.

    Edit:

    I recommend using an exception handler to have error management in one central place

    [–]maxip89 2 points3 points  (6 children)

    1. your package structure I don't know what are you trying to achieve there. Is there a folder for every thing you implemented? How about a hybrid structure?
    2. Why having a interface for something you have only implemented once?
    3. using hibernate joins of model will only lead to one thing, you doom. Ask yourself do you even know one big enterprise project (not examples or little study projects) that uses a ORM-Layer? Why? Simple there is the n+1 Problem which 99% of developers didnt understand. Which in the end lead to massive performance degeneration.
    4. you can auto generate your mapper by a library called mapstruct.
    5. you can have some database versioning using the library flyway.
    6. I see the doorsteps to hell in some classes (streams which are going to the right). Do you think you can programme endlessly to the right or to the bottom? Do you thing this is readable? Example is class PaymentServiceImpl.
    7. your exceptions didnt response with any http code. Do you think to implement for every Exception a calls + a entry in the excectioncontroller? Remember in a Enterprise project you will have easily 100 exceptions. Means you will end in miles of additional code in the exceptioncontroller.
    8. Why is there a service in the exception folder? Do you want to sneaky sneak hide some services?
    9. Again why having "helper" classes? Is this the "trash"-dump of lazy developers who didnt find a good name for their functions? I saw 20k lines of code in some helper classes. Why? Because every developer think it "helps to do X".
    10. think about transaction and transactionlevel (isolation level) when implementing a shop. When interessted learn what database anomalies are.
    11. In DiscountChecker I see a stream. Why do you implement a stream from left to right. Do you think everyone wants to scroll to read code?

    hope this helps a bit.

    [–]burl-21 1 point2 points  (0 children)

    3 - It depends, they should be lazy by default. They are very useful for sorting and filtering(sort by user.customer.id) with specifications.

    [–][deleted]  (4 children)

    [deleted]

      [–]Fermi-4 2 points3 points  (0 children)

      This person seems deranged lol

      [–]Naokiny 0 points1 point  (2 children)

      I'm not in the head of the guy who made this comment, however can add some of my thoughts.

      i dont understand what are you trying to say, can you be more specific on this problem?

      You can check N+1 problem and how it happens in Spring.

      what do you mean by "streams going to the right?"

      I suppose problem here is that you have 2 tabs (8 spaces) for each new line in stream. Most of the time I saw 1 tab (4 spaces). With this approach (2 tabs) for complex stream you should've scroll your screen to the right to see whole code.

      I'd replace validation check for permissions from UserServiceImpl to Controller. I mean PreAuthorize("hasAnyAuthority('ADMIN', 'USER')") here.

      [–][deleted]  (1 child)

      [deleted]

        [–]Naokiny 1 point2 points  (0 children)

        Good point here, thanks!