Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue for migration #1

Open
KafkaProServerless opened this issue Jan 22, 2024 · 0 comments
Open

Issue for migration #1

KafkaProServerless opened this issue Jan 22, 2024 · 0 comments

Comments

@KafkaProServerless
Copy link

KafkaProServerless commented Jan 22, 2024

Hello Dan,

I am following your youtube series, and they are very cool.

If not anything else, just wanted to say thank you for the videos you are creating. they are clear, easy to follow, and very interesting.

I am facing one particular issue and would like to reach out.

  • What I am trying to achieve

I wish to use "Package by Feature" for my @configuration files.
Currently, I am using "Package by Layer".
Just to be clear, this is not an opinion based question of type which is better between "Package by Feature" and "Package by Layer", but rather a question on how to properly migrate.

  • This is the current code structure:

Package by layer:

├── com.app
    └── configuration
        ├── KafkaProducerConfiguration
        ├── MongoRepositoryConfiguration
        └── RestClientConfiguration
    └── controller
        ├── CompanyController
        ├── ProductController
        └── UserController
    └── model
        ├── Company
        ├── Product
        └── User
    └── repository
        ├── CompanyRepository
        ├── ProductRepository
        └── UserRepository
    └── service
        ├── CompanyService
        ├── ProductService
        └── UserService

The kafka producer is needed by the company service to send messages to other parts of the company
The rest client is needed by the user service and the product service in order to query some external information
the mongo repository is needed to configure all three classes in the repository layer.

  • What I tried:

Following this guide: https://medium.com/sahibinden-technology/package-by-layer-vs-package-by-feature-7e89cde2ae3a

I am refactoring to this:

├── com.app
    └── configuration
        ├── KafkaProducerConfiguration
        ├── MongoRepositoryConfiguration
        └── RestClientConfiguration
    └── company
        ├── Company
        ├── CompanyController
        ├── CompanyRepository
        └── CompanyService
    └── product
        ├── Product
        ├── ProductController
        ├── ProductRepository
        └── ProductService
    └── user
        ├── User
        ├── UserController
        ├── UserRepository
        └── UserService
  • Issue:

Unfortunately, I am facing difficulties to refactor the configuration layer, and I would like to avoid a hybrid package by feature + package by layer.

  • Question:

How to refactor this configuration layer into the "Package by feature"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant