Skip to main content

All Questions

1 vote
1 answer
192 views

Is it an acceptable pattern to put derived classes inside an abstract base class in Java?

Suppose I have some Java code such as the following (in this case, the use of the name "interaction" is referring to interacting with an object in a video game): public abstract class ...
micheal65536's user avatar
1 vote
4 answers
1k views

Pattern / solution for Boolean decision making chains

I need a solution for decision making chain. There are number of criteria that may return true, false or be inconclusive. A non-functional code (Java) would look like this: Boolean res = ...
Dariusz's user avatar
  • 423
0 votes
2 answers
181 views

How to write the following snippet in more cleaner way?

When the caller gives me a call, I need to evaluate n number of criteria which currently I'm doing like if (a & b & c & d & e) Day by day the conditions are growing and it's ...
Tom Taylor's user avatar
4 votes
1 answer
745 views

Design pattern to instantiate implementations depending on properties

I have an interface: public interface MyInterface{} And two implementations: public class Imp1 implements MyInterface {} public class Imp2 implements MyInterface {} My program is a CLI. I want to ...
Rahul's user avatar
  • 149
0 votes
3 answers
30k views

How to design the classes for a simple shopping cart example using Strategy Design Patterns

First year of Software Engineering, and we're learning OOP within Java. Came across an extension task to gain more credits. But could not think of what to do: First Step: Design a checkout system ...
Tom Bradely's user avatar
2 votes
2 answers
2k views

Joshua Bloch Enum Singleton and Third Party APIs

In the book Effective Java he give the best Singleton pattern implementation in his, that is implement by a Enum. I have doubt to how to implement this pattern with a third party API. I'm using an ...
alexpfx's user avatar
  • 303
6 votes
1 answer
2k views

Which patterns/architecture to apply for "Import Data, Process Data, Export Result"

I was wondering which architecture/patterns to choose for the following problem divided into three steps: Import TestScript Description from File (e.g. .xls, .txt) Process Described TestScript Export ...
kaeLum's user avatar
  • 61
0 votes
1 answer
83 views

How to record/store edits?

In many programs and web apps (stack exchange included) the program is able to backtrack what edits where made to the piece. My issue is similar: I want to be able to store a "timeline" of edits, ...
sinθ's user avatar
  • 1,311
8 votes
2 answers
324 views

Low coupling processing big quantities of data

Usually I achieve low coupling by creating classes that exchange lists, sets, and maps between them. Now I am developing a Java batch application and I can't put all the data inside a data structure ...
Vitaly Olegovitch's user avatar