Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

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.

Filter by
Sorted by
Tagged with
1
vote
1answer
607 views

How to Define the Bandwidth in Mean Shift Clustering?

I am making a program using Java todo colo quantization using mean shift clustering algorithm and the image is RGB with resolution of 512x512. I want to reduce the image file size by reducing the ...
3
votes
1answer
92 views

Externalized properties for an Java EJB application

I am not sure if this is the right place to post this question, but I think this might be better suited than Stack Overflow. I have got an online application, a Java EJB application. Requirement is ...
0
votes
1answer
55 views

Objectreference vs Equality [closed]

While coding I stumbled upon something like this (extremely simplified example): public bool Func() { Object[] array = new Object[] {false, false}; return array[0] != array[1]; } I was ...
-1
votes
3answers
259 views

Can an object in java have behaviour without having any state

I was just studying the interdependence of state and behavior exhibited by the state of an object and its behavior.was wondering if an object can have behavior without having state. Because i am very ...
109
votes
12answers
15k views

Rationale to prefer local variables over instance variables?

The codebase I'm working on frequently uses instance variables to share data between various trivial methods. The original developer is adamant that this adheres to the best practices stated in the ...
1
vote
4answers
101 views

filter + map api design

I am writing a library call that will allow you to filter and map in the same iteration of the loop, this is async/callback style in Java. The problem of course is that for filtering we usually return ...
0
votes
2answers
216 views

How best to avoid member implementation of class' Abstract/Interface instance variables

I'm sorry if the phrasing of the question is a bit unclear but let me try to clarify below. (If anyone can word it better, feel free to edit) I have a Map instance variable, groups, which is defined ...
1
vote
1answer
112 views

Have generic methods that transfer DTO's from different packages, but contain same fields

I have 3 services Service A, B, C which put and get data to/from Service D +============================================+ | Service A | Service B | Service C | +==============================...
2
votes
1answer
290 views

Do we include output space in space complexity?

For example. I have a function which generates an array with random numbers. int[] generateNum(int n) { int[] result = new int[n]; /* Logic to generate random number */ ............... ...
0
votes
0answers
48 views

Messaging engine architecture with front-end and ORM layer (spring)

I'm looking to push my first QuickFixJ messaging engine into production, and I would like to know the best way to do so. Bear with me. The gist of the responsibilities is as follows: Through ...
1
vote
3answers
291 views

Is it sometimes okay to intentionally violate the Dependency Inversion Principle?

I am doing some work to refactor a class. It currently a 'God class' and contains all different logic/operations solely in that class. One of my solutions is to extract all different parts of logic to ...
-1
votes
1answer
143 views

Best practice - Single or Multiple source code repository

As mentioned here: The main aim of CI is to prevent integration problems, referred to as "integration hell" Our project is a 3-tier web application, with frontend(Angular 6), backend(Springboot) &...
0
votes
0answers
104 views

Frontend JSON payload that defines which classes to use in the backend

Payload: { "selection": { "ids": [1,2,3,4,5] }, "image": { "backgroundColor": "#FFFFFF", "headlineColor": "#000000", "format": "PNG" }, "processors"...
0
votes
0answers
148 views

Decorator Pattern Java

This is an object-oriented design question that is specific to Spring Boot. I'm extending a Spring Boot application that has an interface that is being extended and used inside another service. The ...
1
vote
0answers
61 views

How to solve circular dependency scenario while executing http calls which require authentication?

I am working on a project which requires me to execute standard HTTP calls with session tokens. I am building a custom HTTP client, with a custom authenticator, something like this: Client client = ...
0
votes
2answers
87 views

Make lambdas concise using enumerations?

Generally, we are looking to create a logging framework that can target human readable output as well as various structured data formats. So, a goal is minimizing code duplication in packaging the ...
0
votes
1answer
154 views

Efficiency in Java: Object reference vs id reference

I have to represent a certain data structure, in which I have nodes that are related between them. Each node has its numeric id, and a list containing the next directly related nodes and another list ...
0
votes
0answers
158 views

Best practice for Asynchronous CRUD operations in Android/Java

A few months back, I was working on designing a client API (FooManager) for adding/removing/fetching a list of objects (Bar). The requirements were simple- 1. Fetch operation is CPU-intensive and ...
0
votes
1answer
56 views

Understanding the flow of sending stored procedure to JMS Queue

Suppose I have a REST end point. UI sends some parameters to this REST end point which are required for a stored procedure to run properly. Since this stored procedure is going to take a long time ...
-2
votes
1answer
265 views

How to serve the front-end in a Spring microservice architecture?

I want to create the following distributed system: Spring back-end microservices containing the domain logic, a UAA (authentication) service, a Eureka service registry/discovery, a Spring Cloud Config ...
0
votes
1answer
64 views

Figuring out sql /stored procedure processing using JMS queue

I am trying to figure what could be the flow since I am using JMS for the first time. Locally, I have ApacheMQ installed on my Windows Machine. And using this simple Spring JMS example mentioned here, ...
0
votes
0answers
119 views

How to handle error responses in a chain of CompletableFutures?

I have a long chain of completable futures in my project, with each step calling a backend API, which can give multiple error responses and one success response. Now, after parsing the response, I ...
0
votes
2answers
430 views

Creating a list of functions in java [closed]

I have a list of functions which need to be tested against a list of inputs to measure their relative performance. I have already create a test function like below: public static String testFunction(...
1
vote
0answers
159 views

Performance impact of JPARepository save() on a large database table with index

We have a few tables with a large amount of data and with indexes on those tables to help in faster retrieval. We are also using Spring Data JPA JpaRepository for adding data to those tables using the ...
3
votes
2answers
255 views

Does method argument self-sanity checking violate the SRP?

I have a method login() which essentially sends a login request to a remote server. As I do not want to waste server resources on processing invalid data, I decided to consider sanity checking the ...
2
votes
2answers
894 views

What are application and domain services in onion architecture?

Onion architecture has a core which is composed by domain model, domain services and application services: I'm in doubt about those two service layers, domain services and application services. I've ...
0
votes
2answers
83 views

Designing a modular CLI tool

I am building a CLI tool which will potentially support many commands. Ideally, I want to abstract out each command to implement an interface that demands a "run" method. From there on, it would be a ...
0
votes
2answers
181 views

How to design an API wrapper with bulky operations on domain object? (Need guidance)

I need some guidance in designing an API wrapper for my backend APIs. I have tried to keep it as specific as possible. Context: We have a project which supports certain file operations like edit, ...
0
votes
0answers
59 views

Two Web clients and Java server (HTTP and Websockets)

I have 3 software components of a Web Application: 1. JS-client application 1 (JSApp1) 2. Java Spring (REST and Websockets) server app (SRV) 3. JS-client application 2 (JSApp2) My current task is to ...
3
votes
1answer
175 views

Applying Domain Driven Design - Model/Implementation

I'm quite new in the DDD-World and I'm just trying to figure out all the basics so please bear with me! I have the following Entities: - Datamodel - Object Types - Object Fields A datamodel can ...
1
vote
3answers
418 views

Why is the whole Hadoop ecosystem written in Java?

Developing Big Data processing pipelines and storage, you probably come across software which is more or less a part of the Hadoop ecosystem. Be it Hadoop itself, Spark/Flink, HBase, Kafka, Accumulo, ...
1
vote
4answers
113 views

Passing Information to a method using primitives vs and object instance

I have trouble understanding if I should pass an argument to a method as a primitive value or as an already-obtained object. Consider this simple example interface Channel{ String getId(); ...
0
votes
2answers
177 views

Convert UML Class to Java Class

Suppose I have 3 UML Class diagrams. One is University, other is College, the other is Department. Each University can have multiple colleges, each college multiple departments. I have the UML class ...
1
vote
2answers
143 views

How to parse DSL file to HTML?

There's DSL format for creating and distributing dictionaries. Every dictionary article in such formats looks like this: algorithm [m0][b]al·go·rithm[/b] {{id=000001018}} [c rosybrown]\[[/c][c ...
0
votes
1answer
386 views

How to have parent and child modules in Maven that both package as jar files?

I have an unresolvable dependency issue in a Maven project; different pieces of code depend on different versions of dependency A (i.e. most code needs A:0.15; some needs A:0.18). Fortunately, the ...
0
votes
0answers
33 views

Open URL if new document enters alfresco folder

I have a java applications where the user can add documents using alfresco. If fact the user uploads (scans) a document that is moved to the corresponding application folder then it is display in the ...
0
votes
1answer
110 views

When to use logger.info in sl4j

For my application logs for a REST server, I'd like to log some details about each http request. I'm using sl4j. Should I use logger.debug or logger.info More generally what sort of things should be ...
1
vote
1answer
69 views

concept for de- and encrypting personal data in web portal

Issue: I provide a small web portal for customers with partial personal data like name, address etc. which is stored in the database in plain text. Now I need a safe concept to encrypt the personal ...
-6
votes
1answer
36 views

Give a list of a from area code and to area code and a distance between them,which data structure?

What data structure i can use to lookup given a fromCode and toCode apart from hashMap which results in more number of entries in the memory. We are ok with log(n) efficiency also. Example data: ...
0
votes
1answer
39 views

Service lifecycle with non blocking start and stop

So the basic scenario is I have a class that starts/stops service objects with the methods start(String serviceid)/stop(String serviceid). It is designed to then forward various execution tasks to the ...
6
votes
5answers
354 views

Design pattern for 2 methods one has 70% arguments of other one

I am trying to do a design for notification part in the system I have 2 parts inApp notification and email notification so I used strategy pattern where I have interface NotificationSender with one ...
1
vote
1answer
75 views

Database Authentication - Are 2 database trips better than 1?

Scenario I have an application where some operations require the authentication of an admin. Example Steps: I need to validate the admin's username & password insert a row into a MySQL table (...
1
vote
3answers
156 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
70 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 ...
3
votes
2answers
91 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
122 views

Is there a mismatch between XSL and OOP? [closed]

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:...
0
votes
1answer
74 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 ...
9
votes
1answer
679 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 (...
0
votes
4answers
503 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 ...
-1
votes
1answer
35 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 ...