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 ...
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
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
vote
1answer
74 views

How to test customer journey with mostly the same structure

I often hear that a test should contain only one assertion (Disregarding testing attributes of a class) and where the whole pre-conditions for the test should be setup before the assertion. In our ...
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 ...
-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 ...
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:...
41
votes
4answers
26k views

Performance of Scala compared to Java

First of all I would like to make it clear that this is not a language-X-versus-language-Y question to determine which is better. I have been using Java for a long time and I intend to keep using it. ...
-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 ...
79
votes
6answers
64k views

Is it better to use assert or IllegalArgumentException for required method parameters?

In Java, which is more highly recommended, and why? Both types will throw exceptions, so in that regard handling them is the same. assert is slightly shorter, but I'm not sure how much that matters. ...
4
votes
1answer
5k views

Are Spring beans declared as static a poor design choice?

The question is pretty straightforward, I'll try to explain why I want some explainations. (All of this is my 1½-year junior Java developer opinion, which may be more than incomplete. Which is why I ...
-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 ...
5
votes
5answers
6k 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 ...
-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 ...
80
votes
11answers
11k views

Did the developers of Java consciously abandon RAII?

As a long-time C# programmer, I have recently come to learn more about the advantages of Resource Acquisition Is Initialization (RAII). In particular, I have discovered that the C# idiom: using (var ...
-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
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 ...
-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 ...
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 ...
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....
10
votes
4answers
9k views

Implementing multiple generic Interfaces in java

I've need an interface that assures me a certain method, including specific signature, is available. So far his is what I have: public interface Mappable<M> { M mapTo(M mappableEntity); } ...
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 ...
0
votes
1answer
315 views

IOC principle - Servlet container implementation

IOC principle can be implemented, using either: Dependency Injection Service locator pattern This article also supports these two approaches for implementing IOC principle. Spring IOC container 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: ...
1
vote
1answer
50 views

Writing Event Process architecture for multiple event handler interfaces

I am working on Java program which will listen multiple kind of events from multiple sources and store information to multiple sinks. Each interface will have its own source to listen and own sink ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
7
votes
2answers
219 views

Data marshalling solution for mult-tier application

I am developing a multi-tier software solution where I have 1 server, n thin client engines(TCE) and m thin clients at the most basic level. I plan on having many other components for scalability ...
0
votes
2answers
270 views

WebSockets vs Ajax call for scheduled event?

Intro I have been weighing the pros and cons of using WebSockets vs. an Ajax call for an event which will happen every x number of seconds (in this case 5). I'll start by explaining the scenario. ...
3
votes
1answer
176 views

Inheritance vs Injection with Template-ish pattern and planned contributors

I'm trying to develop an OSGi application to handle my game engine. This game engine will be making use of the Entity-Component-System pattern. Part of this pattern is the use of GameSystems. I had ...
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 ...
2
votes
1answer
742 views

Is the Model in Spring MVC the same of MVC pattern?

Studying some in-depth concept of Spring framework, I'm facing this doubt. Has the Model, as inteded in Spring MVC, the same meaning of the M in MVC? I mean: I always considered the Model of the MVC ...
-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 ...
0
votes
1answer
119 views

Correct way to receive bulk data from a server in Android?

Ok so to explain I have server in Java that receives data from a C++ program that I have no control over. So the data is transferred over TCP/IP and the Java server just receives it. The volume of ...
3
votes
1answer
108 views

Future/Promise objects in Controllers - Best practice - MVC

I was going through some articles related to Futures and Callables today and was thinking about the best practices when working in an MVC based environment. I was wondering, should one be creating ...
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 ...
15
votes
2answers
2k views

(Dis-)advantages of structural typing

I’ve just watched this talk by Daniel Spiewak where he talks about the advantages of structural typing as compared to Scala’s ans Java’s nominal typing. One example for this difference would be the ...
230
votes
14answers
86k views

Should we avoid object creation in Java?

I was told by a colleague that in Java object creation is the most expensive operation you could perform. So I can only conclude to create as few objects as possible. This seems somewhat to defeat ...