Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am a PHP web developer, organising my source code with MVC where all the web pages are in the Views, the business logics are in the Models, and Controllers handles users' requests, pass the right models to the right views. I am starting working with Java. What I know so far is BCE, which is similar to MVC. B (Boundary) contains GUIs, C (Controllers) and E (Entity contains all the models and models can represent database tables).
How to organise source code in Java, comparing to MVC in PHP? Is the following answer correct to this question?
In Java, source code be organised in layers:
- presentation layer
- service layer
- data access layer
Is organising source code about system architectures?
Organising code is about software architecture and doesn't depend on the language. That said MVC, layers, service orientation, micro services etc. are all viable architectures and the choice would depend on your needs/projects.
As with everything there's often no single correct way so start with what you feel most comfortable with. When you gain more experience you'll probably see room for improvement but I'd suggest to start simple and learn on the way.
As for package structure: you'd normally map one aspect of your architecture to packages which could be subsystems, features, layers, etc. Again the choice depends on your preference, project and needs. At work we are using feature/module + layer but that's just one way that works for us.
The MVC structure is also a viable organization of your classes in java.
You can also use the SOA architecture for multi-tier Services-oriented applications. In fact, the choice really depends on your need.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I´m going to build Restful Services Layer (Middleware) using Java/Spring/Eclipse. The goal of the service layer is exposing tons methods, that today exists in different systems.
The Middleware will have the standar layers for each Functional Unit, for example:
UserFacade
UserManager
UserBeans
UserDataAccess
I used to work with a single war project with all the clases inside. This is not good when working more than one team in differents requirements, with different deadlines.
As this is going to be a big project, I would like an architecture that simplify working with many teams in different requirements, and different deadlines.
First question:
What is best:
Create one JAR per Layer (Facade, Managers, Beans, DataAccess)
Create one JAR per Functional Unit (Users, Accounts, Bills, etc)
Both, one Jar per Layer / Functional Unit (FacadeUser, FacadeManager, etc)
Second question:
Should I create a Java Enterprise Application (EAR) with the Web application and modules?
or can I simply create a Web application adding the JARS?
I'd go with a micro services approach - breaking it down by functional units. Whether you use EARs or WARs depends on what application server you are deploying to. But since you specifically mentioned restful service endpoints, multiple web applications, each application exposing specific business functions would suffice. Breaking your project into multiple manageable applications is usually better than building one monolithic application.
This is a good read: https://stackoverflow.com/a/25625813/5150013
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I've to rebuild a swing based application to move it to a web environment. This application has some functionalities that already exist in another web application. I want them both to maintain the same functionalities, even those that are shared, but I don't want duplicated code.
In terms of architecture/technologies, what is the best approach to reuse as much code as I can? A third service-oriented application that controls all the business logic and have the web applications serve only as front-end? But how to avoid code duplication on the front-end?
Any feedback will be much appreciated.
very broad question so it's hard to give exact solution. think about separating common functionality as a different service. then both application can just redirect to it or use its api.
if that's not an option then try to separate that logic to a library that will be included in other application. good frontend frameworks allow you to do it also with frontend code (directives, plugins, validators etc)
You could work with dependencies transforming the common utilities, access data and business rules in libraries. In first moment you can make a refactor separating tiers and responsibilities and then you can incorporate Maven in you environment to generate and start to work with dependencies.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I have a smaller project to organize my finance and several dates and TODOs. Know I need to create different Screens and must often connect to databases to get data. I saw that the spring framework supports some stuff for jdbc and dependency injection. The last point is very important, because I want that my Classes, which creates the screen should be loosely coupled and the code should be more clear.
Is it profitable to use Spring by small projects? I may use 3 components of the whole framework and because of that I'm not sure if it is "good" style to use a big framework like these for such a small project.
Thanks for every comment.
Whether you are going to use Spring Framework or not, that's completely your choice. But I am trying to explain you where your conception about Spring Framework is completely wrong.
You have said-
Is it profitable to use Spring by small projects? I may use 3 components of the whole framework and because of that i'm not sure if it is "good" sytle to use a big framework like these for such a small project.
From Spring reference doc
The Spring Framework is a lightweight solution and a potential one-stop-shop for building your enterprise-ready applications. However, Spring is modular, allowing you to use only those parts that you need, without having to bring in the rest. You can use the IoC container, with any web framework on top, but you can also use only the Hibernate integration code or the JDBC abstraction layer.
It is clear that, you can only use those modules of Spring, which are required for your project without having to bring in the rest.
Spring Modules
The Spring Framework consists of features organized into about 20 modules. These modules are grouped into Core Container, Data Access/Integration, Web, AOP (Aspect Oriented Programming), Instrumentation, Messaging, and Test, as shown in the following diagram.
Any way, although Spring Framework provides comprehensive infrastructure support for developing applications but for the novice user, it is tougher to use the framework quickly as it has complex abstraction and user has to spend more time in assessing the concept, function and it's uses in developing the application.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am working on a small project on metadata extraction from documents and have run into, eh a dilemma. I have some libraries in Java which work well with document-handling for information retrieval, like Apache Tika, POI etc and some more tools in other languages like Ruby(pdf-extract) and a script in bash to fetch data from a RESTful API using wget.
AFAIK, Code reuse is a good thing, right? But then, if its not possible (natively, I mean) to reuse all this code, What approach has to be taken?
Using Java to run terminal-commands is a solution but I don't think it is good programming practice.
Integrating multiple technologies is something that is very common in real world applications. In order for it to scale properly, you probably want to use some methodology to keep things consistent. To me, the weakest part is probably fetching using wget, but that's my opinion.
In order to integrate and for everything to scale nicely you may want to look at some message passing protocols and have some sort of handling of queues where individual workers run in different programming languages and environments. Look at:
https://www.amqp.org/ (message passing standard)
https://www.rabbitmq.com/ (Java, .NET, Ruby, Python, PHP, JavaScript...
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'm intending to design (and provide a reference implementation for) a new Swing Rich Client Framework. My job and personal experience covers many project-specific Swing client frameworks as well as the Eclipse RCP, and every one of them had some original and clever concepts, but also drawbacks and rigid realizations.
My plan is to incorporate the best of those concepts and features into a new framework whose core is very open and extendable.
For my must-have-features list, I'm counting on your input and hope you can share some concept pearls & diamonds you've encountered in other frameworks, or features you always wanted to have or have in a better way.
The framework is intended
for very simple to very complex and sophisticated projects
for clients that need full i18n
for richt clients that execute some or all of the non-presentation logic on the server
to be very lightweight
to be easy to learn and use
Thanks in advance for sharing your insights :)
Docking views / windows supporting predefined layouts! I have not found any good, easy to use, stable docking framework for java.