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

6
votes
3answers
433 views

From an execution perspective is an interpreter the same as the JVM / or the .net Framework

I've recently started two introductory level courses - one using Python, the other Java. I've read the answers to this Question but still have difficulty understanding how each ends up with machine ...
7
votes
2answers
6k views

Comparing TCP/IP applications vs HTTP applications [closed]

I'm interested in developing a large-scale user-facing website that is written in Java. As for design, I'm thinking of developing independent, modular services that can act as data providers to my ...
0
votes
1answer
93 views

How are the forwarding of requests normally managed in the Chain of Responsibilty pattern? [closed]

I was just experimenting with the Chain of responsibility design pattern, implementing my own version. I'm currently reading Design Patterns, but I'm not really sure whether DP tells to stop the ...
4
votes
7answers
27k views

Understanding the difference between mutable and immutable classes

I faced this question in one interview. I explained that String is immutable and StringBuffer is mutable class. I don't know very much about mutable and immutable and also don't know the exact answer. ...
6
votes
4answers
1k views

Naming boolean field that is a verb

In Java, by convention getter and setter for boolean fields will be isField() and setField(). This works perfectly fine with field names that are adjectives like active, visible, closed, etc. But how ...
2
votes
3answers
2k views

Should cucumber step definitions in Java be static methods or instance methods?

We are new to using cucumber with selenium to write automated test suites. Our initial approach was to have one java class per feature file. Now we added instance methods in each class for ...
4
votes
1answer
294 views

Java “module” size

Is it sensible to have micro-modules, say with only a very few (perhaps one) class in it? Or should I store things in bigger repositories? I am long-time Java developer with a software-engineering ...
0
votes
3answers
930 views

Can I run both .Net and Java framework in one computer?

I have .NET 2.5 installed in my computer unit, as a beginner I used VB.net As I went along I've also installed new .dlls that would help me with my VB.net programming Now, I want to study java as ...
0
votes
0answers
645 views

Java UDP Multithread Server

I have multiple threads. Each thread receives data and sends to client an acknowledge packet. Each thread takes aprox. 531ms from start to finish. While capturing packets with wireshark. I was ...
2
votes
3answers
745 views

Animation in Swing

I have a project written using Swing, and I want to make it more smoothly (like JavaFX is) by adding animation to some components(JButton, JScrollPane, JSplitPane) using javax.swing.Timer. UPD: That ...
6
votes
2answers
1k views

Java convention for if/else if order

I have an if/else if structure that on some cases does nothing. From the code I have seen in my career, the "empty" case is normally left out. But when I wrote my code, it just doesn't feel right to ...
5
votes
1answer
407 views

What kind of problems is an Android beginner likely to encounter in using Scala?

I am a hobbyist programmer who makes and maintains one production system, largely coded in Python, which now has to be ported to Android. I don't know Java at all. However, SL4A in Android makes ...
22
votes
2answers
849 views

Is there a data structure for this type of list/map?

Perhaps there's a name for what I want, but I'm not aware of it. I need something similar to a LinkedHashMap in Java, but where it returns the 'previous' value if there's no value at the specified ...
1
vote
1answer
548 views

Applying DDD principles in a RESTish web service

I am developing an RESTish web service. I think I got the idea of the difference between aggregation and composition. Aggregation does not enforce lifecycle/scope on the objects it references. ...
1
vote
1answer
174 views

When should one use composition instead of re-writing the functionality?

Say, I have a class A which has methods m1,m2,m3,m4,m5.... m100. I am making another simpler class B and I require only m2,m3 and m5 in B. Should I be ideally using compositions and put a reference ...
2
votes
2answers
313 views

Refactoring two classes from third-party library that could have extended a base class

I have two Classes, with very similar behaviors, both from a third party library. Both needs to be populated with some value object and sent to specific queues in order for logging. Please note both ...
1
vote
2answers
449 views

developing an android app that include a C++ toolkit [closed]

I'm a java developer and I want to develop an android app that capture a photo and extract its bags of visual words. To extract those bags of words I use the TOP-SURF toolkit which is written in C++ ...
4
votes
2answers
1k views

Managing threads in Java with a good pattern

This morning I began writing a minimal chat using Java socket and threads but it took some minutes for me to experience a lot of problems in the MVC management. Currently I have 3 classes: Main, ...
3
votes
2answers
556 views

Reason for a reflection error

I’m working on an Eclipse plug-in project. Using this plug-in, users can create Eclipse Java projects with some specificities. For example, they can add Java classes’ names which will be saved in a ...
4
votes
1answer
509 views

Shall I separate the admin part from the rest of the war

I built a web-applicationg using struts2. Then I built a small admin interface in the same war. With time the webapp grew and so the admin-interface. Now, I'm thinking to separate the admin interface ...
2
votes
2answers
1k views

OOP Objects, nested objects, and DAO's

Here's something I keep struggling to figure out the best solution to. I've had this problem while working with PHP and Java so it's a fundamental understanding of OOP issue. Examples are in PHP. ...
1
vote
1answer
463 views

JSP Include: one large bean or bean for each include

I want to refactor a webapp that consists of very distorted JSPs and servlets. Because we can't switch to a web framework easily we have to keep JSPs and Servlets, and now we are in doubt how to ...
1
vote
2answers
496 views

Loadbalancing and failover in code

I have HTTPS based webservices (not REST, rather old code). I am generating Java client stubs using Axis & using that to call the webservices. There are around 20 different APIs on the webservice. ...
2
votes
1answer
5k views

Java desktop application using MVC + Hibernate

I'm developing a Java desktop application. I'm planning to use MVC architecture described at Oracle site: Java SE Application Design With MVC. I need to store data in database so I decide to use ...
3
votes
4answers
1k views

Is spying on tested class bad practice?

I am working on a project where class internal calls are usual but the results are many times simple values. Example (not real code): public boolean findError(Set<Thing1> set1, ...
3
votes
4answers
486 views

Casual projects on Github omit error checking, logging, etc., for the sake of clarity?

I just started using GitHub to socialize some projects for simple chat and peer-to-peer apps. With respect to coding, is it customary to omit exception handling, error checking, logging, etc., to ...
1
vote
2answers
382 views

Clarity over Python and Jython

I'm a Java programmer, but I want to program in Jython. I've never coded in Python before, but have been looking through some tutorials and I'm fairly confident I can grasp it. My question is ...
1
vote
4answers
590 views

Using Java Reflection to decouple code modules

I'm involved in a project with several modules. I found that programmers have designed one module to be easily decoupled from its dependent modules using Java Reflection. If other modules need to call ...
-2
votes
1answer
11k views

Why does HashMap allow only one null key? [closed]

A HashMap allows only one null key. Is it because it allows only unique keys? Or is there another reason?
0
votes
1answer
116 views

Is such modification allowed by GPL? Which licences allow this which not?

Assume that I have library X which contains class A with method b and that library X is realeased under GPL licence. public class A { public void b() { // this is an example of b method's ...
2
votes
1answer
615 views

Optimized Special Character Escaper vs Matcher/Pattern

I need to escape special characters which are sent to apache lucent. Since the code will run on a production server I want the code to be the fastest possible. I've seen multiple ways to do it: ...
-1
votes
2answers
1k views

Is it possible to build a custom email client for Gmail using Java APIs? [closed]

Is it possible to build a custom email client for Gmail using Java APIs? Or only Google can do that?
1
vote
1answer
109 views

Mixed licenses inside product

This question relates to software-licensing. Someone familiar with open-source licensing may be able to answer this question. I am facing an issue in trying to interpret/understand some Licenses, due ...
-1
votes
2answers
743 views

Importance of data structures in modern S/W development [closed]

During 1990s when there were no advanced frameworks/paradigms available for S/W development , knowledge on data structures was critical... which I can comprehend. But nowadays, for most of the ...
3
votes
2answers
755 views

Which of these two shuffle algorithms is more random?

Which of below two shuffle algorithms (shuffle1 and shuffle2) is more random? public final class Shuffle { private static Random random; public static void shuffle1(final Object[] array) { ...
4
votes
2answers
2k views

What are the different meanings of 'fixture'?

I have some difficulty understanding the concept of "fixture". I know what a test suite is, a test case, a test run, but what exactly is a "fixture"? A parameterized test case? It seems to me that ...
1
vote
3answers
582 views

How to get Object Oriented Programming Concepts? [closed]

What is the best way or best resources or tutorials to learn Object Oriented Programming? For instance, when I begin a program with Java and all my code goes into just one class and I can't estimate ...
0
votes
0answers
100 views

Design decision for implementing the cache re-arrange logic

I'm working on a webapp which has an existing framework to cache values from the database. I have a requirement which needs multiple values from the database and the values have to be ...
1
vote
1answer
262 views

how to model a connection to a resource, with rudimentary event processing

For my simple MUD client I'm using Apache Telnet (no, not ssh). A mud client is a strange beast: Generally, a MUD client is a very basic telnet client that lacks VT100 terminal emulation and the ...
1
vote
2answers
709 views

What is the story behind Java Vulnerabilities?

I always appreciated the Java language. It is known as a very secure platform and many banks use it in their web applications. I wanted to build a project for my school and I discussed the options ...
0
votes
2answers
417 views

Why is this syntax convention?

It says in the book (APress Ganesh / Sharma) about Java 7: You create a method named fill() in the Utilities class with this declaration: public static <T> void fill(List<T> list, T ...
5
votes
2answers
3k views

Excessive use “this” keyword in Java [duplicate]

The this keyword is primarily used in three situations. The first and most common is in setter methods to disambiguate variable references. The second is when there is a need to pass the current ...
2
votes
1answer
591 views

How to audit an Android application (not rooted) without having access to its source?

How can I check if an Android application running on a not rooted device is "secure" without knowing its source? I would look for: Plain text in Web-Requests (wireshark and emulator) SQL-injection ...
1
vote
2answers
387 views

How to deal with system “static” data in java

I was just wondering if there is some better way how to handle system "static" configuration data. Let say you have a system which offers several operation which are in code translated to operation ...
3
votes
1answer
281 views

Mutual observer pattern in Java

I want to improve my multi-threading and design pattern skills. As such I'm designing an Instant Messaging server. I'm writing the Server first. My plan so far is to have Client "Proxy" Classes to ...
23
votes
8answers
26k views

Why can static methods only use static data?

I don't understand why a static method can't use non-static data. Can anybody explain what the problems are and why we can't do it?
4
votes
2answers
1k views

How does MVC work with the principle “Tell, Don't ask”?

Procedural code gets information then makes decisions. Object-oriented code tells objects to do things. — Alec Sharp So, when a view wants to display some information that is suppose to be ...
17
votes
2answers
855 views

Why does Java not put the filename in args?

In C and C++, the main method holds the filename in the first position of the array at argv[0]. In Java, however, the filename is not included in the args string array. Is there a practical reason ...
2
votes
1answer
234 views

Main method templating

Now that I've gotten into a dependency injection groove, I find main methods for different applications all look basically the same. This is similar to stuff you might find on the Guice documentation, ...
0
votes
2answers
715 views

Languages implemented in Python?

AFAIK, Scala and Clojure are implemented in Java and Java is implemented in C. I suppose that many or most languages are implemented in C, for instance Perl, Python and SQL. I don't know much about ...