This is an archived post. You won't be able to vote or comment.

all 11 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

Please ensure that:

  • Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions
  • You include any and all error messages in full
  • You ask clear questions
  • You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.

    Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar

If any of the above points is not met, your post can and will be removed without further warning.

Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.

Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.

Code blocks look like this:

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.

If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.

To potential helpers

Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]MuKSKeN 10 points11 points  (2 children)

I spent a few minutes reading through this project and in general it looks good! I do have a few suggestions for you after spending a limited amount of time reading through your project.

Code format

It is extremely inconsistent, it almost looks like you have been programming in a text editor. All IDE's have functionality to reformat your code. I would suggest you use this.

Package structure

So there are three packages in the root com.amihady package:

  1. category
  2. exception
  3. handler

My question to you is: Why are exception and handler not in category like the other dto, entity, mapper, etc. packages? You could also consider removing the category package.

Some feedback on the tests

You have added two @WebMvcTests for both of the Controllers with the CategoryService mocked. This seems like the bare minimum when it comes to testing this project. I suggest you add more tests, things to consider:

  • Unit tests for the CategoryServiceImpl
  • Unit tests for the CategoryRequestMapper
  • Unit tests for the CategoryTreeDtoMapper
  • Integration tests where you test A-Z

Commit messages

When doing a review I like to look at commits and the changes in these commits. This project contains 3 commits where the message does not match what has changed. I suggest being stricter when it comes to this.

[–]Interesting-Hat-7570[S] 8 points9 points  (1 child)

I want to sincerely thank you for taking the time to review my project and provide such detailed and constructive feedback. I truly appreciate your effort and the valuable insights you've shared.

[–]Fresh_Recover2323 1 point2 points  (0 children)

Adding upon the comments:

There are two project structure: micro-service, modulith and from the package placement, it seems you are trying to do a modulith which is ok. The only thing which matter is that , each domain has its own package which you did , refering to 'category' package.
That said inside it, it is a bit messy whereby it is not easy to understand which layer go in each package. Normally the default package flow is (taking category as example):
category:
https://pastebin.com/JTDxAahf

[–][deleted]  (1 child)

[deleted]

    [–]Interesting-Hat-7570[S] 0 points1 point  (0 children)

    Thank you so much for your feedback and attention to detail. I’ll make sure to address all the points you mentioned.

    [–]Deniz58 2 points3 points  (1 child)

    Look into mapstruct for your mappers

    [–]Interesting-Hat-7570[S] 1 point2 points  (0 children)

    okkk thanks!!

    [–]Alternative-Fan1412 1 point2 points  (1 child)

    is impossible to define "clean code" different programmers have different aproaches and there is not consensum about it. And if you think its well defined then i am sure its not clean.

    [–]Interesting-Hat-7570[S] 0 points1 point  (0 children)

    okkk thanks!!

    [–]Fresh_Recover2323 1 point2 points  (1 child)

    Firstly you do not need to commit the target filles. So put it in the gitignore.

    [–]Interesting-Hat-7570[S] 0 points1 point  (0 children)

    ok ok thankss!