Tagged Questions
1
vote
0answers
4 views
Does this violate the SRP?
I just finished (re)reading Clean Code, and one of the ideas I leaned was the SRP, however, I am not quite sure on what defines a "Single Responsibility." In the piece of code below, have a Note class ...
0
votes
0answers
33 views
How to implement MVC on the application scale?
I'm developing a simple conferencing app with a Swing standalone client which connects to enterprise java beans. Users can create "sessions" (conferences) on the server, and then can join those ...
-1
votes
0answers
27 views
my failed solution for sales tax calculator [closed]
Recently I have been on the last stage of an interview process where I was asked to provide a solution to this tax calculator problem
...
2
votes
1answer
34 views
Applying DocumentListener on multiple JTextField
Say I have 5 JTextField: jTextField1, jTextField2...
Now I want them to behave the same on DocumentListener, so I decided to make only one DocumentListener and set it to the 5 components.
Meanwhile ...
6
votes
3answers
419 views
Which of these two java class designs is better and why?
Example 1:
public interface Adder {
public int getSum();
}
public class AdderImpl implements Adder {
private int v1;
private int v2;
public AdderImpl(final int v1, final int v2) {
...
1
vote
0answers
34 views
How do I structure my entities for easier persistence?
I am learning ORM using Hibernate by creating a movie rental application. Currently, I have the following three entities for persistence:
User
Movie
Rental (composite element for many-to-many ...
0
votes
3answers
47 views
Implementation of an UniqueIdentifier class
I have a requirement to implement a generic UniqueIdentifier which can cover identifiers like OrderId, TrackingID, scannableId and other Ids. The ids, as they are now, are either Long or String.
Below ...
1
vote
0answers
22 views
Is this a good approach for a BayeuxClient class?
Is this a good approach for a BayeuxClient class?
Reading cometd reference book, Chapter 6 Java Libraries, I created this BayeuxClient class.
As a newbie to cometd, I would like to know if this ...
4
votes
4answers
204 views
Command line Contact Management
Can you please review the following code and give any suggestions for improvment?
Class ContactList.java
import java.io.*;
import java.util.*;
public class ContactList {
public static void ...
-1
votes
1answer
115 views
design classes for a JAVA swing application [closed]
I am very new in making JAVA swing applications..
My problem statement is to make a library management application,for which i designed classes as below.
Please tell me whether my design of classes ...
1
vote
2answers
99 views
Shortening System.out - which is better? [closed]
Oftentimes people will shorten System.out to just out and make an analog called in (e.g. Scanner in = new Scanner(System.in);). I've seen two methods of doing this
Method 1:
import static ...
0
votes
1answer
126 views
Review algorithm of this code
In this piece of code i have to display some set of
data in serpentine order.In an experiment there are Replication,range,plot
Replications contain range,plot.A range contains plot.
if there is 2 ...
0
votes
2answers
88 views
A sample java class for review
Let's say the method foo() has lot of code and it also includes doing something for bar1, bar2 and bar3, maybe setting some status or print something or something else which is being done in just one ...
2
votes
1answer
87 views
Java Swing Panel layout
I am working on a Java project for college that involves us setting up a TCP Server and Client. I have that part working and now to add more of a feel to my project I want to add a GUI.
We have not ...
5
votes
1answer
104 views
Please review following code
Please review the following code. Methods getFirsts and getSeconds return a list of objects which implement CommonInterface and both of them are private. Is it a good or bad design.
@Override
public ...