0
votes
0answers
60 views

Separating UI from logic

I'm trying to develop a little game and for this I'd like to separate the UI from the game logic. So I'm thinking of using an "Animator" class that will be responsible for rendering the objects, but ...
2
votes
2answers
139 views

Design - Parser.hasInfo(MyClass) vs MyClass.hasInfo()

I'm working on a document processing system. I feel confident with a Document class which represents each document being processed. The issue: Each Document can have a CoverSheet, and if it does, ...
0
votes
0answers
21 views

Designing Document class for Doc Imaging - optional fields

I'm working on a project that processes many Documents. A Document CAN have a Cover Sheet (if the first page is one) A Document CAN have a Stub (if Document is large) It matters whether or not a ...
0
votes
1answer
62 views

Logic based on modified fields of a Hibernate entity

I have a Hibernate entity object MyObject with several attributes and a service MyObjectService containing business logic dealing with MyObject. I also have a view model dealing with user input/output ...
3
votes
4answers
446 views

How to force “program to an interface” without using a java Interface in java 1.6

In java 1.8 they have wonderful new "default interface methods". In 1.6 how close can we come? The goal: keep clients (using code) from being able to tell that a class is not a java interface. If ...
0
votes
1answer
100 views

Static methods vs Interface implementation

Here is my problem: I stared to create a e-commerce web sites info collector. So i created a parser for each site. The parser class is state less. got methods like: getItemPrice(WebElement page) ...
1
vote
1answer
102 views

Java Modal Object Design

This question is not about a specific program. This is about design - the UML phase of the project. I am supervising a Java project. It will contain a lot of modal popup dialogs. From a C/C++ ...
1
vote
1answer
255 views

When creating a library, is there a way to make certain classes entirely internal to the library, and not exposed to the user of the library? [duplicate]

Suppose you were designing a Java library for other people to use. You compile the library into a JAR that they can import into their projects and use. Needless to say, you intend for the library to ...
11
votes
4answers
676 views

Is it an overkill to wrap a collection in a simple class only for the sake of better readability?

I have the following map: Map<Double, List<SoundEvent>> soundEventCells = new HashMap<Double, List<SoundEvent>>(); This HashMap maps double values (which are points in time) ...
0
votes
0answers
101 views

How far to go when future proofing fluent-method-chained-DSL test code?

Is it worth implementing interfaces, or using the getThis() trick, or even static factory methods to future proof against the need to extend this DSL? The current design is a pair of thin ...
2
votes
2answers
89 views

Static Test-Data in Helper Class: Getter vs Public Constant

Currently I am in process of writing large batches of Unit-Tests in the Project I am working on. Additionally we recently Introduced GUI-Testing. This project is a relatively simple webapp, on basis ...
1
vote
2answers
45 views

Should I reference a CopyOnWriteArraySet from the Set interface?

There are two ways to use a CopyOnWriteArraySet: // A Set<Object> set = new CopyOnWriteArraySet<>(); and // B CopyOnWriteArraySet<Object> set = new CopyOnWriteArraySet<>(); ...
0
votes
1answer
119 views

How to generalize a classes that has identical function plus some additional function

I have some designing problems with my project. To illustrate my problem, I'll use the following two classes from my project. public class RAM_UserManagement{ private Map<int,User> userList; ...
0
votes
2answers
93 views

Which layer should service errors be handled in?

I am coding in a multitier architecture in Java, and I perform a query to a web service. Is it better form for the errors returned by the service be handled in the data access layer or in the ...
0
votes
3answers
122 views

Assigning responsibility for cancelling an Order

During a conversation with our Domain Expert we can across this feature: A Customer service agent can cancel an Order by decreasing its quantity. To cancel an Order we decrease its quantity by the ...
2
votes
3answers
246 views

Uses for System.gc() in Java [closed]

In Java, there is a method called System.gc(), which calls the garbage collector (or rather, "suggests" to the JVM to run the GC). Are there valid reasons to call this method? I'm thinking that it ...
0
votes
1answer
142 views

Does lots of Instance Variables within my class suggest flawed Design?

Ok so I am setting out to consolidate some learning I have been doing. What I am going to do is create a small game relating to a game I enjoy called Persona. For reference a persona you can think of ...
0
votes
3answers
125 views

How should I approach storing single boolean results for a whole table?

I previously asked this question on stack overflow. But have not received any responses that might help me. So I thought I would try here. ...
0
votes
1answer
86 views

In a REST service project, where should we put code that calls a third party REST API?

My project is organized in layers like Configuration Controller Service Repository Domain Our REST Controller is in the Controller layer. We need to connect to another API via REST calls and I'm ...
1
vote
3answers
316 views

Passing data between hundreds of objects in java [closed]

Currently, I'm working with a group on building a model. This model simulates interactions between many "agents" in a region. Agents can be any entity such as a city, a farmer, a business etc. Each ...
0
votes
2answers
266 views

how to approach pharmacy software project [closed]

I would like to complete a pharmacy software proof concept. But I have a few questions I do not know. Physician information In order to refill or dispense a new RX the software needs to have access ...
3
votes
2answers
144 views

Program Design clearness vs convenience

I've recently disputed with my colleague about the following situation: I've developed a framework that processes the resources (in java, although its not really important). It goes (simplified, ...
4
votes
3answers
84 views

Returning results of method on batch list?

The title is a bit vague so I'll try to elaborate. I have a function makeFoo(int bar) -> returns Foo or throws Exception. I also have a batch version of this makeFoos(int[] bars) -> ...
0
votes
1answer
96 views

Automatically create or update object in database

I have a database class with the following interface: public Database { //returns false if p (its ID) is already available //otherwise adds p the the list and returns true public boolean ...
1
vote
1answer
143 views

How to design extension mechanism for java app

I have an application where I have a set of core features. The application itself HAS to work in core only mode. I would also want to make the application extensible such that, when certain ...
2
votes
1answer
204 views

How should object identification be managed?

I have a java/swing application in (hopefully good) MVC structure. Here is a overview of my model classes: One or more workers may work at one working location and one worker may work at different ...
0
votes
1answer
80 views

Implement RPC via SIP

Look at the following use case. I have a client (Java) application, which wants to get/set the state of another, remote application (C). The communication between them is done via SIP, which is run ...
2
votes
1answer
161 views

Working with a large, messy object [duplicate]

I have been handed a very cluttered, "One Ring" object (one object to rule them all). The OR class has 40 fields. These fields map to 16 different objects (the OR has all the fields from the 16 ...
2
votes
2answers
155 views

Is it better to draw my own graphics or import images?

I am about to start a Tetris clone using Java as my programming language. While I was designing how it'd be done, I've stumbled upon this question: What would be better, if any difference at all, ...
20
votes
7answers
4k views

Is there a more intelligent way to do this besides a long chain of if statements or switch?

I'm implementing an IRC bot that receives a message and I'm checking that message to determine which functions to call. Is there a more clever way of doing this? It seems like it'd quickly get out of ...
0
votes
1answer
84 views

Interconnect nodes in a Java distributed infrastructure for tweet processing

I'm working in a new version of an old project that I used to download and process user statuses from Twitter. The main problem of that project was its infrastructure. I used multiple instances of a ...
3
votes
3answers
318 views

Is it feasible and useful to auto-generate some code of unit tests?

Earlier today I have come up with an idea, based upon a particular real use case, which I would want to have checked for feasability and usefulness. This question will feature a fair chunk of Java ...
4
votes
3answers
344 views

Inheritance vs containment while extending a large legacy project

I have got a legacy Java project with a lot of code. The code uses MVC pattern and is well structured and well written. It also has a lot of unit tests and it is still actively maintained (bug fixing, ...
2
votes
1answer
165 views

How to fix poorly designed software? [closed]

I am working on large project solo as a hobby, and I made a mistake in the very beginning: I jumped right into programming without giving a second though to design. Now I am nearly 6 months in and ...
1
vote
3answers
107 views

Best way to find whether a collection does or does not contain an element with a specific desired quality

It seems to be a very common thing to have to tell whether some list or set contains at least one object matching a given condition, yet my prior searching and reading have never found a satisfactory ...
2
votes
1answer
218 views

How to design the relation between a Game and a Player in a game?

I am currently attempting to make a Trading Card Game and I have got a whole array of features working already, yet I am stuck now at the portion where one player can attacker another player (more ...
1
vote
1answer
169 views

From a DDD perspective is a report generating service a domain service or an infrastructure service?

Let assume we have the following service whose responsibility is to generate Excel reports: class ExcelReportService{ public String generateReport(String fileFormatFilePath, ResultSet data){ ...
0
votes
0answers
67 views

Suggestion to Design API Centric Application using Appengine

I have been planning to create an new application. So I was designing the application structure.i know this application will be accessed form multiple devices and the app feature will be increased. ...
0
votes
0answers
85 views

Algorithm / working approach to get a random list of data

I am working on a android schedule app but that isn't matter , the problem is a algorithm / methodology so you are welcome to just write the pusedo code to answer. The data is like this Place ...
0
votes
1answer
176 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 ...
2
votes
1answer
130 views

Logging in a latency sensitive system

Requirements: My application is latency sensitive. Millisecond level responsiveness matters. Not all the time, but when it acts, it needs to be fast. My application needs to log information about ...
1
vote
1answer
93 views

What is the idiomatic way to persist the data in this simple data-based application?

I'm looking at developing a simple application in Java for a game which allows a user to keep track of which items they own and how much experience they have obtained while using the item. All of this ...
4
votes
1answer
214 views

Which relationship is more natural?

Have a quick question on how to best structure something for my Java project: I'm a user. I can work at one or more places. At those workplaces, I have one or more roles. For each of these roles, I ...
1
vote
0answers
86 views

Using streams as method parameters and/or return types

So let's say I have a 'Transformer' interface that can transform one file-type to another. Let's say I also wish to use streams to provide the data to the Transformer. Which is the approach that is ...
0
votes
1answer
106 views

Use global variables or methods in an API's frontend

I am currently designing a graphics library in Java and now it's come to making the frontend I am curious why I have never seen libraries using global variables for their settings/properties - in-fact ...
21
votes
2answers
4k views

How to improve upon Bloch's Builder Pattern, to make it more appropriate for use in classes that may be extended and sub-extended many times over?

I have been greatly influenced by Joshua Bloch's Effective Java book (2nd edition), probably more so than with any programming book I've read. In particular, his Builder Pattern (item 2) has had the ...
3
votes
2answers
295 views

It is bad practice to hard couple logging interface/implementation with business model classes?

Should we avoid using logging in business model classes and try to move logging to service/controller classes? In for example java context, logging in model classes will hard couple the code with ...
3
votes
2answers
330 views

Object-Oriented design and proper Java architecture for my program

This is the very first time that I think I want to create a program which really uses OOP principles and I want to do it in the most effective and efficient way. First of all we are given this ...
0
votes
1answer
283 views

Email Content creation | Proper design

Working on an E commerce application where we need to send so many email to customer like Registration email Forget Password Order placed There are many other emails that can be sent, I already ...
0
votes
2answers
153 views

Best way to display domain object summary information efficiently and in an OO way from a large inheritance tree?

I've provided only simplified code as it's more of an abstract design question. So I have many, many nested business/domain event objects, e.g. public class Event { //bunch of properties and ...