I am trying to do the architecture of a new application we are building. We wanted something quite modular. Considering we are open source and we want other people to be able to easily add new features, we opted for a component based architecture.

We have a back end that is made in Java, and a front end that will be made with JavaFX and an other front end which is a website. We want the back end to be the same for users that use our application through a website or through a mobile/desktop device (JavaFX). All of my team, including me, are students and do not have a lot of experience designing new software.

The problem I am facing is that I want to split main features in packages, so they form components that work independently of the front end and can be easily be modified. The thing is that sometimes, different components will interact with the same model. Let me illustrate my problem so you can understand better.

This would be a very partial overview of my IntelliJ project structure:


ApplicationCore would be the package that holds all the back end. DriversCore, LoggingCore and ParsersCore are packages that all represent a feature. They are components. I want ParsersCore and LoggingCore to both use a certain model class, Signal. My question is where should I put said file? This situation doesn't just apply to one file, there are many files in my model that I want different components to use. I know many will just say that I should have a package called model and put all my model there, but from what I've seen, I should keep all the model relative to a component in the same package as that component. So, what exactly is the procedure when you have many model classes that you want to be shared across different components?

  • If Signal.java is an interface, then it should likely reside at the level of ApplicationsCore. The implementation of a Signal class would be in a shared module. – BobDalgleish Jan 2 at 18:43
  • You cannot share classes between modules (or they are not separate modules)! What kind of application are you making? I would not expect any of the "features" you list to truly exist in a business domain. Unless the app is a logger/parser, these really represent cross-cutting concerns that reside outside your core as their own cohesive mechanisms. In any case, what I'm getting at here is that your problem seems to be more about how you have drawn boundaries than some missing "procedure". Your problem is one of design. Without more information it's difficult to offer a more pointed solution – king-side-slide Jan 2 at 19:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.