Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [java]

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.

-2
votes
0answers
52 views

Why is MAIN sometimes called driver in JAVA?

Driver is utilized to interface with computer hardware. So why do programmers call their MAIN as "driver" in MAIN?
1
vote
3answers
132 views

Does saving a file to temp and deleting whenever a checkbox is toggled considered a wise choice?

My team and I have this Desktop client developed in JavaFX. It basically has a "Remember my password" checkbox. If the user ticks this checkbox, reboots, and reopens the app, the user should be ...
0
votes
1answer
47 views

Uploading file to the server for download

I've my front end written using HTML/CSS/Javascript. Front end is communicating with the backend(Oracle database) using Java Webservices (Spring boot app). Situation #1: User clicks on the Download ...
-1
votes
0answers
21 views

Writing a wrapper library for appsyncclient in mobile application

I am trying to develop a mobile UI application for both android and IOS. This application interacts with AWS appsyncclient which in turn talks to AWS. This application interacts with some kind of ...
3
votes
2answers
66 views

How are settings structured when they can be configured in diffferent ways?

Suppose of this question the following: I'm in full control of this project I'm writing a media player Obviously, a media player will allow a user to adjust the volume, so I might have a class that ...
0
votes
4answers
93 views

Is there a mismatch between XSL and OOP? [on hold]

context and background: I prefer OOP for the most part and find it, largely, more intuitive -- this is my bias. When I read that functional language x is better than OOP language y I think to myself:...
-4
votes
0answers
59 views

Java 11 for commercial use [on hold]

Oracle has changed the commercial license since Java SE 11, as I understand. Does this impact products created using Java. For example I have a program written in Java I plan to sell. Also is it the ...
-1
votes
0answers
5 views

Is using LGPL 1.2 or EPL 1.0 licensed jar allowed in proprietary software in Docker? [migrated]

I am creating a proprietary java application which uses some open source jars licensed with LGPL 2.1 or EPL 1.0. I am deploying the application in docker container with all jars inside it. Is there ...
0
votes
1answer
62 views

Generating CSV export

I created a CSV export that works like the code below. There is a LinkedHashMap where the keys are the column title and values are functions where certain properties are read. By reording the lines ...
-2
votes
0answers
10 views

Adjusting table columns width linked to a sqlite database and created using java eclipse

I want to adjust the column widths seperately. Not all having same width. here's my code: //columnModel.getColumn(0).setPreferredWidth(100); table = new JTable(); table.setAutoResizeMode(...
-2
votes
0answers
14 views

How to make an android bot app for performing some background tasks in a cycle?

I am working on a project in which, I want to create an Android App. The app will open a website in background, wait for the page to load. Then, it will find something on the page. After that it will ...
-2
votes
0answers
31 views

Did i need Apache Ant in a Maven Project [on hold]

we converted a old Java Project in a Maven Project. The Programmer before build the Project with Apache Ant. Did we need here Ant or can we do all things with Maven what Ant can do too? What is the ...
9
votes
1answer
359 views

What does “TILT” mean in a comment?

I'm reading Clean Code by Robert C. Martin, and the phrase TILT inexplicably appears in some code samples. Example (it's in Java, by the way): ... public String errorMessage() { switch (...
-3
votes
0answers
19 views

Retrieving user likes per case versus retrieving all likes made and storing them in the browser, which is better?

I am making a web application where people can like and favorite vegetable descriptions, they can also like other peoples vegetable journals. When a user opens a seed description page the like button ...
-3
votes
3answers
128 views

Method with 2 parameters and IF statement to check all possibilities. What is the best approach? [closed]

So, let's say I have a method: public Object getResult(Long A, Long B){...} And I want to check all possible states, so I've done: if (A == null && B == null){ return all objects; } if ...
0
votes
4answers
296 views

Is using the Pair class a sign of primitive obsession code smell?

Let's say I use a Pair in this way: Pair<Long, Date> signup = getSignup(); System.out.println("User with ID " + signup.getLeft() + " signed up on " + signup.getRight()); Is it a form of ...
0
votes
1answer
30 views

Deleting a list of dependent OPbject using chain of Responsibility design pattern

my requirement is i want to delete a Object A A-> B-> C- here if you want to delete A you have to delete B which is dependent on B , then If you Want to Delete B you Have to Delete C which is ...
-2
votes
1answer
50 views

How to implement a CLI interaction with running java programm? [closed]

I would like your tipps about implemening a command line interface to interact with a running java application. Example: The Java Application is a webserver and a cli-client should interact with it: ...
2
votes
4answers
223 views

Meaning of Machine in Compiler Theory

Can anyone tell me what does "machine" means in Compiler Theory? Does it mean computer in general or operating system? Actually, the problem is I understand the definition of machine language as "the ...
0
votes
1answer
48 views

what is the best way to store tabular data which changes rarely in java code

I'm working on some software at the moment and I'm not sure which route to take with this. I have to use some tabular data which may get change rarely, so I can use the collection for it but it will ...
0
votes
1answer
76 views

Why does the Thread Class implement Runnable interface

My question is that is there any reason for Thread class to implement Runnable interface by itself. Are there any specific use cases where overriding Thread makes more sense than implementing Runnable ...
4
votes
2answers
286 views

Interface Segregation Principle in Clean Architecture

In Chapter 10 of Clean Architecture, Martin gives an example for the Interface Segregation Principle. I have some trouble understanding that example and his explanations. In this example we have ...
1
vote
1answer
40 views

java rule based data collection

I'm building a home project using EWS and SQLite. I have a bunch of really similar (and not so similar) Mails (that hava the usual subject sender body etc fields). These mails contain similar ...
-4
votes
0answers
26 views

How to create reusable component-like views in javafx (mvc)

I know how mvc works, and what belongs into the different parts, but I am pretty new to javafx. Let's use the simple tic-tac-toe game as an example. I would probably end up creating a MainView, ...
-4
votes
1answer
37 views

Will a JavaDoc and a little handwritten documentation be enough for a library? [closed]

I am wondering if I wrote a little simple documentation and provided the JavaDoc, would it be enough documentation for a application GUI manager library for java?
0
votes
1answer
39 views

Java design pattern for handling configuration options and responding to changes in them

I'm working on an overlay/HUD for a Java game, where the user should be able to enable or disable certain components and choose configuration options. One such example is a health bar, which the user ...
6
votes
3answers
280 views

Should a high-performance API expose low-performance utility functions?

Context: I'm working on an open source project to solve a problem that comes up in ad-tech and social media data mining: indexing boolean expression trees, and matching them against incoming documents....
2
votes
2answers
50 views

Architecting a distributed file processing system with leadership election

I'm in the planning phases of trying to build a distributed file processing system in Java and I'm looking for feedback and advice: Problem : There are a large number of files continuously posted on ...
1
vote
1answer
41 views

Utils, Service class and Persistence Layer

I have a method in API handler which does API validation, performs business logic and then makes a call to db. Is it a good idea to move the business logic to utility class or service class? IMO the ...
-3
votes
1answer
45 views

Need of advice on server code design [closed]

I want to build a web application in Java on Tomcat server (I am open to change the type of server if needed) The requirement for me is for the user to be able to login and download sensitive data (...
1
vote
1answer
46 views

How to control multiply consoles from Java code?

I have Java application. I try to realize multiplayer chat with TCP protocol, but I have an issue. I cannot output all messages I get on client tier (server tier works perfectly), because I give ...
2
votes
1answer
90 views

Passing a list of base class objects to a method and using instanceof to filter them

I'm working on a Java reverse engineering project, where I am analyzing bytecode and trying to identify classes, methods and fields using the ASM framework. After identifying these I transform some ...
2
votes
4answers
126 views

Check if resource exists before inserting to the database or wait until the DAO throw the Exception?

I have two paths: /students /students/{id}/addresses ...with the following behavior: POST to /students - 201 Created (if successfully created the Student) POST to /students/{id}/addresses - 201 ...
-2
votes
1answer
20 views

Filtering the Data and summing on one field Should I do in JAVA or write query with aggregate query with filter clause?

I have one table in which there would be millions of records. The requirement is to the records based on the condition and then total on one of the fields. Selectivity would be around approx 50. ...
-1
votes
0answers
37 views

Failure handling and response code mapping in a (HTTP/REST) service architecture in Java

TLDR: I am looking for established standards to deal with translating error codes from a downstream remote call to an error code handed out upstream at a service interface, that allows to easily know ...
0
votes
1answer
56 views

Java convention - Implementing two similar functions for two different objects

I have two classes, let's call them Foo and Bar. They both extend different classes (Foo extends X, Bar extends Y), which have some common ancestor "way up" the inheritance tree, something like this: ...
1
vote
3answers
66 views

Proper Connection Pool Use

I'm confused as to how to properly interact with my Postgres database throughout the typical user experience on my web app. I'm seeking clarification on the most efficient method of communicating with ...
1
vote
1answer
55 views

Functionality design: Multiple sources, multiple consumers with configuration

It is a Design Problem which I am listing out here. I have multiple event sources in my app, each one produces events with the different set of data (but each source is producing only one type of ...
6
votes
1answer
245 views

Is it a good practice to create new variable to see the output of a function?

Consider these 2 types of implementation: public int add(int x, int y) { return mysteriousAdd(x, y); } public int add(int x, int y) { int output = mysteriousAdd(x, y); return output; } ...
2
votes
2answers
125 views

Does it make sense to implement a Class Factory design in an RPG Character Creation module

I'm a self-taught Engineer, a beginner in Java and I am trying to create a Dungeons and Dragons character creation module for a bigger game to solidify my understanding of core concepts while learning ...
2
votes
3answers
79 views

Is a setter with the composed object as a parameter better or separate setters for each parameter within the composed object?

I have two ideas on how to proceed with an availability class but I'm not sure which one is better. public class TimeRange { private Timestamp startTime; private Timestamp endTime; public TimeRange()...
0
votes
1answer
127 views

Is Java-like restrictiveness OK Python style?

Good Pythonic style is much looser than Java's uptight restrictiveness: In Java, good style means private on methods wherever possible, all fields encapsulated, type declarations, defined ...
-1
votes
1answer
106 views

How to organize the build system of a project as it starts including multiple languages across multiple operating systems and compilers?

I wrote a Music Player and Library in Java for GNU/Linux and Windows. My build process is currently in ANT, but I intend to migrate away from that to something more modern after the next release. I'...
-4
votes
1answer
41 views

LL(K) grammer generation for postfix expressions [closed]

I have a problem in formulating LL(K) grammar for this postfix expression problem, given (4 3 / 2 * 4 5 / +) as an input must output 52/12
2
votes
2answers
158 views

What is recommended way to create test data for unit test cases?

I am new to TDD/unit testing. I am going to write a complex scheduling algorithm in Java. As this module is a core part of our application and there are number of scenarios in it, I want to write ...
1
vote
1answer
76 views

Improvements in a “data - manager - wrapper” architecture

I have programmed using the architecture below, where "client, order, piece" are just data classes, have no methods, and "managers" are the manipulators of that data, the "ClothingStore" is a wrapper ...
-3
votes
2answers
80 views

How to have zero or one of and object in a class? [closed]

I want a class A, and I want the relation that A can have zero or one X. So I wrote this class: public class A { private X x = null; public A() {} public A(X x) { this.x = x; } ...
2
votes
2answers
87 views

A good way to represent an object with multiple interconnected states?

I want to program a simple budget application. In my application, the budget is divided into budget periods (months by default, but it can be bi-weekly or weekly periods). In each period there is a ...
1
vote
1answer
85 views

Best Way to Store List as Constant

Let's say I want to parse some JSON and I store the path in a Java constants class the path that I want to follow. For example: public static final List<String> path = Arrays.asList("a", "b",...
2
votes
1answer
143 views

Is it efficient and a normal practice to have one class with thousands of lines of code? [duplicate]

I am currently in a continuous software product development project on base of legacy Java code. The source code is very complicated, which is good and bad. But I am surprised to see that in the core ...