Java is a high-level, platform-independent, object-oriented programming language originally developed by Sun Microsystems. Java is currently owned by Oracle, which purchased Sun in 2010.

learn more… | top users | synonyms

2
votes
3answers
242 views

MVC seems to create dependencies that just “don't feel right”

I might be misunderstanding MVC, so forgive me if that is the case. This is my program structure (Java/Swing): I have a JTable (View) that is pointed to by a custom linked list (Model). When the user ...
1
vote
1answer
76 views

How can I shorten the amount of time it takes to change variables dependent on environment (QA/Dev/Prod)

I'm working on a Java Project, and I wrote a small plug-in to the existing project. I wrote it on my Mac(dev), QA is on Windows and Prod is on Unix. In the code I make specific API calls to a ...
-1
votes
2answers
138 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 ...
5
votes
2answers
3k views

Optimal way to store 18 billion key, value pairs [closed]

I have around 200 million new objects coming in, and a 90 day retention policy, so that leaves me with 18 billion records to be stored in the form of key-value pairs. Key and value both will be a ...
4
votes
4answers
949 views

Is it bad programming practice to check if a class referenced by its interface is an instance of another class?

I have a class (Timer) with an array list of Timable objects. Timeable is an interface. There is some specific functionality that I need for the Trigger class (implements Timable), which has a ...
1
vote
1answer
224 views

How to render graphical interface automatically (behind the scenes) [closed]

I am trying to write a program that shows images of a Java application's GUI automatically (ie, without someone building, running, and then taking screenshots of the interface). I know WindowBuilder ...
-1
votes
1answer
762 views

Java: How to manage UDP client-server state

I am trying to write a Java application that works similar to MapReduce. There is a server and several workers. Workers may come and go as they please and the membership to the group has a soft-state. ...
1
vote
1answer
298 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 ...
1
vote
3answers
439 views

Sorting and averaging the highest values of pixel data

Currently, I am using Android/Java. I am looking for the most efficient means to determine the average of the highest 100 pixel values taken from a greyscale preview. The preview part I am more or ...
2
votes
4answers
5k views

What encoding is used by javax.xml.transform.Transformer? [closed]

Please can you answer a couple of questions based on the code below (excludes the try/catch blocks), which transforms input XML and XSL files into an output XSL-FO file: File xslFile = new ...
2
votes
1answer
463 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 ...
0
votes
1answer
147 views

How do you distinguish your public API interfaces from the interfaces you use for testing/mocking?

Mocking frameworks are useful for creating mock objects that isolate the code under test from its surrounding software environment. Some mocking frameworks cannot mock non-virtual methods, so they ...
45
votes
11answers
3k views

I don't understand how TDD helps me get a good design if I need a design to start testing it

I'm trying to wrap my head around TDD, specifically the development part. I've looked at some books, but the ones I found mainly tackle the testing part - the History of NUnit, why testing is good, ...
1
vote
3answers
934 views

Java: How to make local fields & parameters final without having a 'final' keyword on each declaration

By default, I want all my local variables and method parameters to be final. Unfortunately, the Java language designers chose a different default: variables&parameters are by default non-final, ...
1
vote
2answers
259 views

Simple task framework - building software from reusable pieces

I'm writing a web service with several APIs, and they will be sharing some of the implementation code. In order not to copy-paste, I would like to ideally implement each API call as a series of tasks, ...
2
votes
1answer
485 views

Source code of jar.exe - is it available

This may seem an odd question, but I want to create an executable which runs under Windows written in C++. The program needs to be able to update a jar file even if Java is not installed on the ...
20
votes
5answers
5k views

Efficient way to shuffle objects

I'm writing a program for some quiz software. I have a question class containing the ArrayLists for the question, answer, options, marks and negative marks. Something like this: class question { ...
1
vote
1answer
143 views

Appropriate License for Available-Source, No-Unauthorized-Distribution

I have a program (technically an addon to a program) whose code I want to be freely available for educational purposes or to create derivatives for personal use. However, I do NOT want to allow ...
4
votes
1answer
381 views

Java language constructs to enforce design decisions

What constructs in OOP languages (specifically Java) allow you to enforce design decisions and intent? I think some examples would be the 'final' keyword, access modifiers, template methods, perhaps ...
3
votes
1answer
102 views

Handling ground-breaking changes in a production system - Insert intermediate level Management object

As our client request, we are proceeding to change the base of our system. We already have the following structure: A class has many students. (simple typical one - to - many) Now we must change ...
0
votes
1answer
206 views

Where should I put my method

I am writing a Java program using the MVC design pattern. I have classes Item and Supplier. In the database they are connected through a item_supplier table. I'm writing a method which will give me ...
1
vote
2answers
793 views

MVC pattern with JSF-Spring-MyBatis webapp

I've a Java webapp with these frameworks and I want to know if my implementation meets with MVC pattern: Controller Layer (V) I'm using JSF @ManagedBean public class Controller{ ...
6
votes
3answers
272 views

How will writing the transaction part in Java benefit the security of the application, when all other parts are being written in PHP?

A friend of mine while working on a PHP application asked me to write one part of the application in Java. The part that involved transactions. He said it will be better to write this portion in Java. ...
0
votes
1answer
67 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, ...
1
vote
2answers
380 views

Making a class pseudo-immutable by setting a flag

I have a java project that involves building some pretty complex objects. There are quite a lot (dozens) of different ones and some of them have a HUGE number of parameters. They also need to be ...
1
vote
1answer
127 views

Languages & Their Licensing?

Firstly, apologizes for any bad terminology, lack of research, or poor delivery of my question. I should note that originally I had one big question, but I figured the first half is sort of ...
1
vote
2answers
111 views

When to store values in constants/finals

This might seem like an odd question, but I'm worried that I'm putting too many things as constants/finals at the top of my java class. I've started to put every value that is in my program into a ...
1
vote
3answers
877 views

What is the preferred access modifier for instance variables of a data transfer object?

I'm creating a data transfer object and can't decide whether it would be better to just give public access to the instance variables or if there would be a purpose to using getters and setters to ...
1
vote
2answers
235 views

Is repeating links to the same class in a single javadoc comment a bad practice?

I'm currently writing an API and its documentation. For example I have something like this: public interface Event { } public interface Process { } public interface EventProcessor { /** * ...
33
votes
4answers
4k views

What did Rich Hickey mean when he said, “All that specificity [of interfaces/classes/types] kills your reuse!”

In Rich Hickey's thought-provoking goto conference keynote "The Value of Values" at 29 minutes he's talking about the overhead of a language like Java and makes a statement like, "All those interfaces ...
1
vote
1answer
1k views

Matrix Pattern Recognition Algorithm for a 2D space

I have a picture that I elaborate with my program to obtain a list of coordinates. There is a matrix represented in the image. In an ideal test I would get only the sixteen central points of each ...
17
votes
4answers
14k views

Why are nested loops considered bad practice?

My lecturer mentioned today that it was possible to "label" loops in Java so that you could refer to them when dealing with nested loops. So I looked up the feature as I didn't know about it and many ...
1
vote
1answer
2k views

Should I obtain a licence from Oracle before developing Java software? [duplicate]

Should I obtain a licence from Oracle before developing Java software? I'm in the preliminary planning stages of developing a server on top of the the Hadoop/Java platforms. I'm not much at all ...
19
votes
6answers
2k views

A programming language that allows you to define new limits for simple types

Many languages like C++, C#, and Java allow you to create objects that represent simple types like integer or float. Using a class interface you can override operators and perform logic like checking ...
0
votes
1answer
339 views

Java Design Question

I am considering the options for designing a system in java which accepts data files from different systems applies some transformations to the data, concats data from multiple files to produce some ...
1
vote
1answer
372 views

How to find method and class usages along git repositories

We got some code in a git repository that's used along different projects (with git different repositories), the problem is that we got now so many different projects that's difficult to track which ...
2
votes
1answer
718 views

Migrating Web based projects from Java to PHP

At our work place after hours of coding, testing and QA we have successfully added a couple of software tools in our product line. We specialize in web based software solutions so in order to tap on ...
0
votes
3answers
131 views

Should a complex unifying class be doing computation?

I have a large application in Java filled with independent classes which are unified in a PlayerCharacter class. The class is intended to hold a character's data for a game called the Burning Wheel, ...
2
votes
1answer
177 views

Dependent Object Serialization

What's the recommended way to serialize dependent objects, especially when objects are being freshly constructed (to avoid malicious byte streams, or whatever)? For example.... After creating a ...
6
votes
2answers
8k views

Best way to structure a Git repository for Maven

I need some advice on how to structure our projects in Git. We use Java and Maven is our build tool. Maven kinda assumes all of your projects have a common ancestor eventually. Maven can also be a ...
2
votes
1answer
124 views

Java MVC extra classes

I have a simple MVC project. My current packages: gui controller db domain I want to put extra classes which I will use, e.g. md5 hashing, email validator (methods which I will use in more than ...
1
vote
0answers
367 views

Maximum flow and minimum cut undirected graph java

I need to implement an algorithm where I find the maximum flow and the minimum cut of an undirected graph and I cannot really find an algorithm for this. I have looked at the Ford Fulkerson algortihm ...
1
vote
1answer
111 views

MorphAdorner Licensing confusion

I want to use the MorphAdorner library available free for commercial use. But it uses several other libraries that restrict commercial use (like Gate etc). Can I use this library in my application?
15
votes
5answers
969 views

Is this pattern bad? [duplicate]

I notice that when I code I often use a pattern that calls a class method and that method will call a number of private functions in the same class to do the work. The private functions do one thing ...
10
votes
2answers
9k views

Entity to DTO Usage

Been trying to come up with a flow for a basic tiered web application, and have been reading conflicting information online. What I'm trying to figure out is if there is an advantage to still using ...
-1
votes
1answer
613 views

Name of this algorithm (Create binary image)

Some days ago I saw in this site the algorithm below to convert color images to binary images and I used it in my application (with some small changes). However, I need to know what is the name of the ...
2
votes
4answers
633 views

Find the count of each word in a string

I am in a search of a better performant algorithm to implement a program, to find the count of each word in a sentence i.e.., a String in the programming sense. I know my algorithm is too basic and ...
0
votes
1answer
453 views

Is there a tool that will list all dependencies of a method in Java? [closed]

Say I'm looking at some code and I see: MessageDigestPasswordEncoder encoder = new MessageDigestPasswordEncoder("SHA-512"); Now, in that file I also see: import ...
2
votes
1answer
96 views

Way to allow inspection of java data model after exporting to file

I've refactored a program to remove its dependency on an sql database by storing all the state in a memory model. However the manager liked the ability to easily inspect the domain state just by ...
0
votes
1answer
222 views

Standard Java Error Reporting

I am currently working on creating a toolkit for work and I've gotten to the point where I'm wondering about error reporting. Basically all of my tools, which consist of a grouping of classes, will ...