All Questions
76
questions
0
votes
1answer
25 views
How best to structure my Service/Repository layers when persisting a Many to One object?
I'm working on a project where I need to do CRUD operations on Book and Library objects. Naturally the relationship between Book and Library is Many to One, like so:
@Entity
@Getter
@Setter
@...
2
votes
2answers
104 views
MVC: Should my domain model look like this?
Consider the following GUI screen (Java Swing) with a list of persons where the user can select a person and delete it.
According to MVC, the view observes (observer pattern) the model and updates ...
2
votes
1answer
129 views
DRY principle vs decoupling (business from GUI)
Say I have a business model called Vehicle. Vehicle has many fields but to keep it simple say it looks like:
public class Vehicle {
String ownerName;
String brand;
FuelType fuelType;
}...
2
votes
1answer
91 views
How to properly model an MVC model in this case?
I aim to understand pull model MVC. I'm stuck at defining a model for a simple color-guessing game in Java Swing I chose to practice it.
I borrowed the model's initial version from an example which ...
-1
votes
1answer
132 views
Display different panel on button click (MVC pattern)
I have to code a gui like this:
It's an homepage with a left menu and a changing right part, on button1 click form1 must be displayed, on button2 click form2 a so on.
Each form has its own button "ok"...
0
votes
2answers
454 views
Model View Controller pattern for a Java desktop application
I'm struggling to fully understand MVC pattern, I found a lot of information on the web but they are really confusing because it seems there are various ways to do it.
What I understood is that the ...
1
vote
1answer
124 views
Controller class for an input dialog
I am learning OOP, concretely Java, by developing a real life business application for aimed for repair shops. I have followed MVC pattern design for GUI elements of my application. I was wondering do ...
0
votes
1answer
433 views
Manage table relationships in Java dynamic web application that accesses a database, without using any framework
I'm developing a web application for academic purposes.
What i have to do is a simple website which keeps track of realties along with their respective owners and the tags they are bound to.
The ...
3
votes
1answer
134 views
Future/Promise objects in Controllers - Best practice - MVC [closed]
I was going through some articles related to Futures and Callables today and was thinking about the best practices when working in an MVC based environment.
I was wondering, should one be creating ...
1
vote
0answers
645 views
MVC - How should components inside controller communicate?
I'm developing a level editor in Java. I'm designing its code in MVC. From what I've learned: controllers can have a direct reference (fields) to views and models. Views can have direct reference to ...
2
votes
1answer
141 views
Should the Service interface not extend the DAO?
I'm writing the service layer for my DAO and I've made it extend the DAO interface. It looks a bit like this:
public interface FooDAO {
Foo get(long id);
boolean update(Foo foo);
These two ...
-1
votes
1answer
193 views
Java MVC or Rest based approach with security [closed]
I am working in designing Java-based web applications. Although, I have worked with Java core still a novice in designing web-apps and do not have enough confidence in what I am thinking is correct or ...
0
votes
1answer
3k views
When to have more than one controller class?
Would it be correct to assume that in general, I would need as many controller classes as classes that can be accessed/modified by a user?
For example, If a logged-in user can add/modify to a class ...
3
votes
1answer
232 views
Writing decision statement on controller layer
We are developing a REST application based on an MVC architecture.
The service layer is returning Optional<T> where T could be any class.
So on the controller layer there is a conditional ...
-1
votes
4answers
597 views
At what stage of a Java project do you configure GUI components?
I need a little advice with project design. I have taken on a personal project to enhance my knowledge of Java Swing, API integration, JDBC and OOP
I have chosen to do this in Java as I previously ...
0
votes
2answers
154 views
Which End should start first? (MVC)
I am developing a small application and trying my best to make it as professional as possible in regards to design pattern etc.
It is a JavaFX app, and my app works fine but I am uneasy at the fact ...
1
vote
1answer
102 views
What are approaches for building more robust Ajax applications without using AngularJS
Within a Java shop, we are using Spring MVC, some HTML output and some JSON/Rest output as a service. Our client side is more familiar with jQuery for ajax messaging to the server. We have been able ...
3
votes
1answer
242 views
Is it always optimal to preserve encapsulation in MVC?
I've just finished up a project in which I created a visual simulation of the life cycle of an ARM instruction in a single cycle processor. I used the MVC pattern in this project and ran into a design ...
5
votes
1answer
16k views
How to implement the MVC design pattern with JavaFX written in pure Java
I am currently in middle of designing a backup application in JavaFX written in pure Java (meaning without Fxml) .
I am having trouble implementing the MVC pattern for the following reason. The way I ...
2
votes
2answers
3k views
Pattern for a method call outcome
Most often I need to call a service method from a controller, and based on the outcome, if there's an error show an appropriate error message depending on the error (or some other action, showing ...
-1
votes
1answer
597 views
MVC with several MVC-patterns and gameloop
I made a small program using several MVC-patterns. So far I havnt got to much stuff to put in the model so I havnt got any model yet.
My idea is to make one MVC pattern for each panel. And looping ...
1
vote
1answer
767 views
Coding guidlines for Controller and Dao?
My Controller code:
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
ObjectReader objectReader = objectMapper.reader(...
3
votes
2answers
2k views
Using MVC style, where is the best place to put SQL functionality?
I am wondering about best practices here.
MVC (Model - View - Controller) patterns involve separating components of your program that model the data, manipulate those models, and display those ...
1
vote
2answers
93 views
Should a client check for persisted item existence before modifying it?
I'm developing a MVC Web application with a REST interface.
The REST controller performs actions on persisted items through a service class, which translates exceptions coming from the persistence ...
0
votes
1answer
896 views
Dynamic query from view layer
In my current job they are defining a new corporate architecture for java development. It is something like this:
ProjectView: JSF view layer. Uses delegates on the ProjectClient layer.
...
2
votes
1answer
171 views
Getting items from a ListView - without breaking MVC paradigm?
I've got an arraylist of SpecialParts. A SpecialPart is an object that holds a bunch of information about itself: name, ID, date created, etc.
I've got a ListView that presents the user with all the ...
2
votes
1answer
1k views
JEE MVC, controller calls the interface instead of the interface implementation
I'm following this tutorial: http://wiki4.caucho.com/Building_a_simple_listing_in_JSP It creates a basic web application in Eclipse using the MVC pattern with Resin as the web container. Here's the ...
1
vote
0answers
678 views
MVC question for a console application with multiple controllers?
My question concerns an administrator's console application. The requirements around it are that administrators should be able to log in (other types of user cannot), and they should then be able to ...
2
votes
1answer
2k views
role based access control model in object oriented
I want to prepare a swing application. I am designing a role based access control model in mvc design.
When a view wants to request something from a controller, how can this request be realized in ...
0
votes
1answer
214 views
Adding a graphical view to a system
I currently have an program in Java that simulates railway movements. Essentially, trains arrive on platforms, pick up and drop off passengers, and then proceed, respecting signalling where possible. ...
0
votes
2answers
666 views
Develop GUI and logic in a team the right way? [closed]
I am planning to start a small project with a friend. I will be developing the GUI using JavaFX in the MVC pattern and he will be responsible for the model/logic.
My question is: how can we achieve a ...
1
vote
3answers
3k views
Building a calculator using MVC
I've been programming in Java for about 6 months, and I thought a good and challenging test of my skills would be to build a GUI calculator. I have very recently heard about this MVC idea, and I ...
3
votes
0answers
1k views
How to pass control between sub-controller to parent controller in Java MVC Design Pattern?
I'm pretty new in Java, but I've done plenty of research and I know what MVC is. However, to implement MVC in Java was a difficult task. I followed this tutorial, which helped me to realise that the ...
0
votes
1answer
153 views
How do different technologies connect to form a web stack? [closed]
I am a little confused, is it possible to implement a front end using common languages like html, css and javascript and then do server side processing using a language of your choice, say python or ...
3
votes
2answers
995 views
How to efficiently handle related data in MVC?
Talking about MVC with servlets and JSP's, in a context about products and manufacturers , when querying the application for a list of products:
the servlet loads a list of products from the database ...
1
vote
0answers
315 views
URL and Controller structure for parent-child-relationship
I use an MVC web framework to create an application which contains a hierarchy:
Location <1-N> Devices <N-M> Services
I have a number of Locations. Each Locations can have several ...
0
votes
1answer
197 views
Is it fine to skip MVC?
I am building a pair of components that communicates in a one-way fashion:
[ JButton ] --> data...process...process...out --> [ JTextField ]
The JButton allows the user to select a file and ...
1
vote
1answer
450 views
MVC: How to Implement Linked Views?
I'm developing a java application to visualize time series. I need (at least) three linked views, meaning that interaction with one of them updates the others.
The views are:
A list represents the ...
-1
votes
2answers
182 views
How to fit requirements into MVC
Let's say we have a website requirement to allow User functionality. Simple!
We create the UserModel, UserController and UserView. Works perfectly.
However, let's assume that User has a many-to-one ...
0
votes
1answer
1k views
How to update User interface form through database update
I have a client server application. Assume I work as a Support executive, resolving customer tickets. We(our support team) have got two tickets to work on.
Ticket 1: Client "Liver" raised a ticket ...
1
vote
3answers
4k views
What are the steps to grouping related classes into packages
What are the steps needed to be taken to group related classes into packages in Java?
In my case, I have about a number of .java files that I'd like to group into 3 packages according to the MVC ...
0
votes
1answer
816 views
Implementing separation of concerns via MVC
I'm creating a question to see if my understanding of MVC separation is correct, I haven't been able to find a clear answer anywhere online. So is this the right way to implement it (in Java):
I ...
4
votes
2answers
3k views
Managing threads in Java with a good pattern
This morning I began writing a minimal chat using Java socket and threads but it took some minutes for me to experience a lot of problems in the MVC management.
Currently I have 3 classes:
Main, ...
2
votes
1answer
8k views
Java desktop application using MVC + Hibernate
I'm developing a Java desktop application. I'm planning to use MVC architecture described at Oracle site: Java SE Application Design With MVC.
I need to store data in database so I decide to use ...
1
vote
1answer
536 views
how to model a connection to a resource, with rudimentary event processing
For my simple MUD client I'm using Apache Telnet (no, not ssh). A mud client is a strange beast:
Generally, a MUD client is a very basic telnet client that lacks VT100 terminal emulation and the ...
6
votes
2answers
2k views
How does MVC work with the principle “Tell, Don't ask”?
Procedural code gets information then makes decisions. Object-oriented
code tells objects to do things.
— Alec Sharp
So, when a view wants to display some information that is suppose to be derived ...
4
votes
1answer
849 views
Should I use JavaFx properties? [closed]
I'm usually very careful to keep my Model, View, and Controller code separate. The thing is JavaFx properties are so convenient to bind them all together. The issue is that it makes my entire code ...
-1
votes
2answers
245 views
Java generalization
I have a question regarding generalization. I know when it is needed to be done, but is it worth having an extra class for 1 field?
e.g.:
StatisticsCustomer has fields: Customer customer and int ...
1
vote
1answer
413 views
Creating a System Sequence Diagram from an [extended] use case
As I have been taught - one controller = one use case.
But I have:
OutsiderController
SupplierController (which extends OutsiderController)
SubContractorController (which also extentds ...
4
votes
1answer
2k views
Do I need JUnit tests for the controller layer on a MVC when I have a database layer
I have a MVC which has this structure:
ui
controller
db
model
Basically the controller doesn't really do much more than connection ui with db layer.
Do I need to provide JUnit tests for the ...