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
259 views

“One of some”-type

Say that you have some different classes that does not really have any functionality in common, but somewhere in your program, you need one of them (which one is not necessarily important) because ...
0
votes
0answers
88 views

Java server side : Is this a good design/layered approach? [closed]

We are in the process of designing an application using AngularJS, RESTful service (Jersey) and JPA for CRUD operations.The RESTful layer might call other external services to get data. There could be ...
0
votes
0answers
23 views

Is this code Clean, Effective and SOLID? [migrated]

I've recently read the books Clean Code and Effective Java. I am a huge fan of Object-Oriented Java. I am trying to write as professionally as possible. I have been an Android Developer for 20 months ...
1
vote
2answers
36 views

Testing code in Java that is only loosely defined

My question is about testing in general. At school, professors say that testing has to be written before we begin to write some code. I guess we need to use EasyMock to represent the classes not ...
2
votes
1answer
93 views

Is it OK to deprecate methods that need to be public due to the packaging model but are not to be used outside the codebase in Java?

I am currently working on a semi-large project that has several packages. There are 3 main packages, a "client" package, a "server" package and a "common" package. There are two jars, one for the ...
5
votes
3answers
186 views

Is it conventional to name final/constant local variables in UPPER_SNAKE_CASE?

Pretty simple, I have a method: public final void myMethod(User user, Group group) { final int MAX_USERS_PER_GROUP = group.getMaxUsersPerGroup(); int usersInGroup = 0; // Get users in ...
3
votes
1answer
132 views

Recursively parse without resorting to ugly design patterns

I'm currently building a crochet pattern parser in Java, and I've hit upon some trouble. I'll call the language used for input Crochet Pattern Code (CPC). I have a rather large writeup on the ...
2
votes
0answers
63 views

Fixing years of bad coding [duplicate]

Last year I got my first job with an I.T. company developing industrial Android applications. Unfortunately, when I got there and started working with the code base I was repeatedly confronted with ...
-5
votes
0answers
66 views

Breaking out of an for statement in Java [migrated]

If i do something like this boolean ret; for(int i = 2;i<30;i++) { if ( 30%i == 0){ ret = true; } else { ret = false; } } ret becomes true allready at 2, but also at 5,10 15, is ...
2
votes
2answers
70 views

Creating an auto-patching system for Spring Hibernate Application

I have this question for few months now. We have a web application which has monthly changes and weekly bug fixes if any. Usually we just build the new war, undeploy the old ones and redeploy new ...
6
votes
6answers
578 views

Why are my unit tests so expensive? [duplicate]

I am a Java developer, working on a small project. We are three people in the team, we have a budget for 3 months of coding (+ some time for the Analyst, Project Manager and QA team). It is a small ...
0
votes
0answers
30 views

handling external events in a cluster environment

I have an app written with JSF and Spring using JPA+Hibernate which is running on a Glassfish4 server. Right now I have an Observer pattern which is listening for some Postgresql events. Let`s say ...
0
votes
0answers
4 views

Help with removing circles from javafx pane when clicked [migrated]

I have an assignment for school where i have to make a pane and then make circles appear when i click them, and then remove them with right clicked. this is what i have so far ...
0
votes
1answer
94 views

How to structure programs that interact with databases? [closed]

I've just finished a book on MySQL and I'm in the infantile stages of learning to couple that with Java. I know that the technology I need to learn is called JDBC and that it essentially allows you to ...
7
votes
3answers
1k views

What is the difference in memory between a variable assigned to null and one not assigned

What is the difference in memory between a variable assigned to null and one not assigned? I know that there is a difference in usage, but what is the difference in memory?
-4
votes
1answer
68 views

improve optical character recognition of image using Tess4J [closed]

How to improve optical character recognition of image using Tess4J ? Some case have unstable result especially when you have text inside image. there is my code : try { ...
4
votes
1answer
111 views

Parking Simulation Software Design

I've been requested to develop a quite well known problem for a job interview. The Parking Simulation which an example can be found here. I came up with some ideas for which design pattern should I ...
0
votes
0answers
13 views

Is Java JNLP codebase entry required in the jnlp tag? [migrated]

I have an applet that needs to be served from 50 different servers in an M2M network. The following line in the jnlp file will work <jnlp spec="1.0+" ...
0
votes
1answer
70 views

Making a database and related operators using files and JSON in java [closed]

I'm trying to write a program that reads operations from a file. these operators look like below : CREATE TABLE student(id:integer, gpa:decimal, name:string, family:string,isMale:Boolean) INSERT ...
0
votes
1answer
100 views

Using XML to store and edit data records in Java

I want to use XML to store data for an assignment . In this Java assignment I'll get data from the user in form of lines in a file below INSERT INTO student(id,name,family,isMale) VALUES ...
0
votes
1answer
160 views

Should I always call super in Java? [duplicate]

Anti-pattern considerations aside, should I always call super in Java when overriding methods, even when the method is empty? Take a look at the code below, this is an excerpt from AsyncTask and can ...
0
votes
0answers
37 views

Spring Boot Hibernate and JSR 303 - response formatting [migrated]

Sifting through forums I can't seem to stumble into an issue solution I've been haveing with Spring Boot + JPA and JSR303 bean validation. Simply put validation works but but when say ...
0
votes
0answers
4 views

Java j2ee JSTL cannot print a list of objetcs [migrated]

i'm currently working on a small Java J2E project. I want to print a list of objects in a *.jsp page, but there's an error i can't seem to get rid of. My .jsp page : <%@ page language="java" ...
-2
votes
0answers
14 views

Java Robot class highlighting text help [migrated]

I'm trying to write a program that copies text from TinyChat(https://tinychat.com) and copies it to the clip board. Eventually it will take everything said in chat and paste it in Skype. Every message ...
0
votes
1answer
94 views

Architecture for my Java application [closed]

I try to create small Java tools to help me at my work every now and then. Usually these do not have to be pretty and I find myself coding a single, sometimes massive, Java class. However, now my plan ...
0
votes
1answer
40 views

Reading from html page that needs cookies passed and form data

I am writing a program in java in order to practice tough coding problems and learn more. Program description The program reads first names from a text file one by one, then enters them into facebook ...
2
votes
1answer
68 views

Advantage of Declaring and Initializing Different Object types?

I am learning how to use java to program, and am just learning about abstract classes and how they are useful. Say I have a class which extends another abstract class, which has 2 methods, one of ...
1
vote
2answers
96 views

Pattern for validating rules having different signatures

I have a class in charge of responding to an input event and maybe triggering another event. To decide, it has several rules to check. I'm trying to get away from a class looking like this: public ...
2
votes
2answers
131 views

When to use ANTLR and when to use a parsing library

I've always wanted to learn how to write a compiler - I've decided to use ANTLR, and am currently reading through the book (its very good by the way) I'm pretty new to this, so go easy, but the jist ...
0
votes
0answers
52 views

What are the different types of whitespace referred to by Perl? [migrated]

I am trying to find the Java equivalents of the Perl regular expressions not supported by Java. These are, as listed in the Java Documentation: \h A horizontal whitespace \H A non horizontal ...
27
votes
6answers
4k views

Dynamic Code Evaluation in Java - Clever or Sloppy?

I am trying to create a flexible ACL framework in Java for my application. Many ACL frameworks are built on a whitelist of rules, where a rule is in the form of owner:action:resource. For example, ...
1
vote
1answer
37 views

DataThread class that doesn't extend Thread, poor naming?

I created a DataThread class that doesn't extend a Thread, but has one as a member variable. Favor composition over inheritance, is a rule that I heard of, but I am thinking that the name of the ...
0
votes
0answers
38 views

what is the relationship between CORBA, JMS and MDB?

In the context of my previous fuzzy question on microservices, please help me break down the terminology involved in these technologies: CORBA JMS MDB Utilizing JNDI, I believe it's possible to do ...
-1
votes
1answer
34 views

What's the best way to implement a real time show board to show results from concurrent result producers in Java?

I'm making a load test tool that launches multiple thread to simulate load on the target server. Each thread executes a predefined set of commands in the structure of TestSuite - TestCase- TestStep ...
0
votes
2answers
72 views

How is the best way to work with step by step documentation to software maintenance [closed]

I'm working on a web project in java and I have a problem with the documentation we are making. The goal is to has step by step how to do some basic stuff for system maintenance, like add fields to a ...
1
vote
1answer
80 views

Non-fixed-size Fenwick Tree implementation

I'm planning to implement a non-fixed-size Fenwick tree. That is, a Fenwick tree that allows interleaving range queries with adding/removing elements. All implementations and samples I've seen so far ...
5
votes
1answer
191 views

Sometimes, “programming to interfaces” introduces possible (and avoidable) runtime exceptions?

Please consider the com.google.common.collect.ImmutableMap Programming to its interface, Map , creates a bug that could blow-up in the runtime as such: Map<String, Integer> myMap = ...
2
votes
2answers
99 views

Immutable vs Read-only vs Unmodifiable naming difference

So, I've looked at some similar questions asked here in regards to how these three should be used in naming. Usually, the answer is something along the lines of "it's conventional" and "just be ...
1
vote
2answers
100 views

OOP (possibly Java-specific): Comprehensive Set of Method Categories [closed]

I am working on a coding convention to follow for my Java projects. I find it easier to find my way through a class when I group its methods by category. For example, rather than having each ...
1
vote
2answers
68 views

Is it a good idea to contextually name predefined functional interfaces?

I am currently working with Java 8 and using functional interfaces a lot. I often find myself writing code like this: public interface MessageHandler extends Consumer<String> { } Is this a ...
1
vote
3answers
113 views

What is the best way to hold runtime arguments and use elsewhere in the application? [closed]

I have to design a java tool, which is intended to be called from shell scripts or batch scripts. The behavior of the tool is determined by a set of user defined parameters. This can vary from user to ...
-1
votes
1answer
66 views

JavaFX client side application [closed]

I am thinking of developing a JavaFX client application to connect to my backend database server for retrieval of data etc and display in my client app. For this, i would also need an ...
1
vote
1answer
110 views

Writing Multiple Files in Spring Batch [closed]

So I want to create 6 delimited reports , they all use the same data source and same table , the query is different for each , they all are also independent. The way I have it setup right now I have ...
2
votes
3answers
160 views

Documenting intent Vs knowledge

It is said you should document the intent of your function or class which I agree with. However recently this line became a little bit blurred when I was wanting someone to document why this ...
0
votes
5answers
193 views

classes/inheritance, how do I handle special cases that require more change

I often find myself in this situation where I have a base class that does a lot of graphics. There are, for example, three strings that are positioned top, middle, bottom of an element. Like a scale ...
2
votes
1answer
73 views

How many threads should I use in my NIO server, details inside

I've built a Java NIO TCP server, it currently uses four threads. One ServerRunnable thread that uses a selector and three worker threads. I've been looking around for some information about this, ...
0
votes
2answers
275 views

Is it ok to break the “is a” relationship if I just want part of a class' functionality?

I asked a question about extending TreeMaps into "sort by value" TreeMaps on the "code review" site on stackoverflow. Based on the response, I re-wrote the code. I like it. But, it feels like I might ...
2
votes
2answers
179 views

Make functions that imply other functions

I'm developing a game that often has repetitious code that I can't simplify. Example of what I do normally: Square object; GL11.glPushMatrix(); // Pushes a matrix stack down by one. This allows us ...
7
votes
2answers
237 views

Java System class implementation

The Java System class contains various data members and methods that make perfect sense being there. For instance: System.in (variable) System.err (variable) System.out (variable) System.exit(int) ...
13
votes
6answers
1k views

Is creating the objects you think you will need ok in a first test in TDD

I'm fairly new to TDD and I have trouble when creating my first test when it comes before any of the implementation code. Without any framework to the implementation code I am free to write my first ...