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

22
votes
2answers
1k views

Should You Log From Library Code?

If I am developing a Java library, is it good practice to issue log statements from within the library's code? Having logging within the library will make debugging and troubleshooting more ...
20
votes
7answers
4k views

Is there a more intelligent way to do this besides a long chain of if statements or switch?

I'm implementing an IRC bot that receives a message and I'm checking that message to determine which functions to call. Is there a more clever way of doing this? It seems like it'd quickly get out of ...
16
votes
3answers
1k views

Does decoupling trump DRY in REST?

I am building a REST API to expose most of functionality of an existing Java API. Both APIs are for internal use within my organization; I do not have to design for external use. I have influence ...
14
votes
1answer
1k views

Considerations on which Java version to run in Production

Some people run the bleeding edge of technologies - updating the day that something is updated. In production, this isn't as appropriate. Researching about if the current (Java 7) version is ready ...
9
votes
9answers
12k views

Best way to handle nulls in Java?

I have some code that is failing because of NullPointerException. A method is being called on the object where the object does not exist. However, this led me to think about the best way to fix ...
8
votes
2answers
10k views

Open source projects, how to choose?

I would like to join an open source project since I think I am good enough at programming to progress onto reading others code and to modify it. But the problem is, how would I choose an open source ...
7
votes
9answers
9k views

Most efficient way to learn java if you already know how to code? [duplicate]

Possible Duplicate: Is there a canonical book for learning Java as an experienced developer? I've been coding for close to 25 years now in basic, (C64 & Amiga), (Object) pascal, C, LPC ...
4
votes
3answers
451 views

What is the best use case for selenium?

I've been trying to develop web applications while at the same time creating the testing. I understand unit testing, I can declare a test method and test specific methods in my application. But I ...
3
votes
2answers
1k views

OOP - Composition, Components and Composites Example?

I've been reading a bit about OOP in relation to Composition, Components and Composites. I believe I understand the fundamental principle (not sure). Can someone please provide a code example of a ...
2
votes
2answers
10k views

Java language book for an experienced programmer? [duplicate]

Possible Duplicate: Is there a canonical book for learning Java as an experienced developer? I am looking for book to get up to speed with (start with) a Java language. I am experienced ...
24
votes
6answers
2k views

How is major software protected? [duplicate]

I am a new software developer and I wish to sell my software. I recently realized that from C++ code we can not stop the user seeing parts of the code that are related to scripts or system commands. ...
21
votes
11answers
2k views

Should I use a code repository if I am the only one working on a project? [duplicate]

Possible Duplicate: Version control for independent developers? I am not sure if I should use a code repository when I am the only one working on a project.
17
votes
4answers
1k views

How can I use unit tests and TDD to test an app that relies mostly on database CRUD operations?

At work, one of my projects is mostly about taking data passed in from an external client and persisting it in a database. It's a Java enterprise app using JPA and most of our logic revolves around ...
11
votes
3answers
2k views

How to create better OO code in a relational database driven application where the database is poorly designed

I am writing a Java web application that consists mainly of a bunch of similar pages in which every page has several tables and a filter that applies to those tables. The data on these tables comes ...
10
votes
6answers
813 views

What factors to consider when choosing runtime/language for Windows desktop applications?

My users all have Windows. Some of them use Linux or a Mac, but if they do they're generally capable of using something like Mono, Wine, Parallels or dual-boot. My development team (including myself) ...
9
votes
4answers
1k views

Is there any reason lazy initialization couldn't be built into Java?

Since I'm working on a server with absolutely no non-persisted state for users, every User-related object we have is rolled out on every request. Consequently I often find myself doing lazy ...
8
votes
6answers
869 views

Static functions vs classes

Let's say that I want to build some utility functions to do some basic maths with the BigDecimals, for example I want to have a function that computes the average of a List<BigDecimal>. What is ...
8
votes
3answers
704 views

C++ for Java Programmers [closed]

I am going to have a lecture about C++ for experienced Java programmers. Because C++ is a big language and I have just one lecture, I want to point out the most important "gotchas" and C++ features ...
8
votes
3answers
4k views

Differences between “Java OOP” and “Pythonic OOP”? [closed]

I started with ActionScript 2.0 and then went on with Java. I have learned, or at least used, a bunch of languages since then, including Python (probably my favorite). I'm afraid that my style of ...
2
votes
7answers
1k views

tips, guidelines, points to remember for rendering professional code? [closed]

I'm talking about giving clients professional looking code. The whole nine yards, everything you hardcore professional highly experienced programmers here probably do when coding freelance or for the ...
2
votes
7answers
1k views

Becoming a better C/Java programmer [closed]

I've currently hit a plateau and want to get better at coding in C and Java. I want to improve, but I think I hit a plateau on my learning curve. I can't find any "advanced" tutorials on the net; most ...
1
vote
7answers
4k views

What is the best way to remember Java APIs? [duplicate]

I have been doing Java for nearly a year now and I have difficulty remembering Java APIs and method names. What is the best way to remember them?
34
votes
6answers
3k views

Good or bad practice to mask Java collections with meaningful class names?

Lately I've been in the habit of "masking" Java collections with human-friendly class names. Some simple examples: // Facade class that makes code more readable and understandable. public class ...
23
votes
9answers
6k views

Is there any reason to use “plain old data” classes?

In legacy code I occasionally see classes that are nothing but wrappers for data. something like: class Bottle { int height; int diameter; Cap capType; getters/setters, maybe a ...
13
votes
6answers
515 views

Expected behavior when an request for a collection will have zero items

Let's say you are given the following... List<Thing> theThings = fubar.Things.All(); If there were nothing to return, what would you expect fubar.Things.All() to return? Edit: Thanks for the ...
13
votes
2answers
2k views

What does “GPL with classpath exception” mean in practice?

Oracle seems to license all their Java-related open source code under the GPL with a classpath exception. From what I understand, this seems to allow to combine these libraries with your own code into ...
12
votes
6answers
4k views

Are Java's public fields just a tragic historical design flaw at this point? [closed]

It seems to be Java orthodoxy at this point that one should basically never use public fields for object state. (I don't necessarily agree, but that's not relevant to my question.) Given that, would ...
11
votes
8answers
1k views

Does low latency code sometimes have to be “ugly”?

(This is mainly aimed at those who have specific knowledge of low latency systems, to avoid people just answering with unsubstantiated opinions). Do you feel there is a trade-off between writing ...
11
votes
3answers
650 views

Introducing a new JVM programming language into an established enterprise environment

Imagine that your current workplace is a Java shop. There is a lot of built-up knowledge about the Java language and there is a comprehensive build and deployment process in place to handle everything ...
10
votes
2answers
5k views

How to debug/change Java code while the program is running?

I just saw a video showing how Notch (of Minecraft fame) is debugging and changing Minecraft while it is running. He pauses the game, changes something in the code and then unpauses the game where the ...
10
votes
4answers
450 views

Is it better idea to call an external command-line application or to internalize that application's logic?

I have a "pipeline" sort of process that is essentially just linking together a bunch of existing tools to automate a workflow. For one of the steps, there is an existing command-line tool that ...
10
votes
5answers
2k views

What are you thoughts on GWT? [closed]

Since I'm learning Java in this period and I just finished with the tutorials I think I'm ready to start contributing to a project (since I know from experience this is the best way to really learn). ...
8
votes
10answers
7k views

Can programmer certifications substitute for degree requirements [closed]

I am a Computer Technician without a computer science background and planning to become a Java programmer. My question is, if I pass a Java certification, would that be enough to for me to get a job ...
7
votes
2answers
3k views

Is it a bad habit to (over)use reflection?

Is it a good practice to use reflection if greatly reduces the quantity of boilerplate code? Basically there is a trade-off between performance and maybe readability on one side and ...
7
votes
5answers
2k views

Suggest other people's code to study [closed]

What open source Java code would you suggest for me to study? EDIT: I'm interested in the design, simplicity(?), their programming style, logic. EDIT2: The first thing that came to my mind is ...
5
votes
2answers
12k views

Why shouldn't I be using public variables in my Java class? [duplicate]

In school, I've been told many times to stop using public for my variables. I haven't asked why yet. This question: Are Java's public fields just a tragic historical design flaw at this point? ...
5
votes
4answers
795 views

Starting Java Web Services and feeling lost [closed]

After building mainly Java desktop apps and some small GWT services, I'm trying to learn how to build Web Services in Java but I feel overwhelmed by the sheer amount of buzzwords, terms, ...
4
votes
5answers
17k views

Java web application folder structure

As a beginner to J2EE, I have recently started developing my own project from scratch using the Core of J2EE : Servlets & Jsps. I could not evaluate whether my project folder structure is right ...
4
votes
5answers
1k views

Switching Programming Languages [duplicate]

I'm a senior level Delphi developer looking for move into either C# or possibly Java roles. I have around 8 years of development experience of which pretty much all of it is in Delphi, I have very ...
2
votes
2answers
189 views

Problems with OO design for application with pluggable components

I'm trying to refactor an ugly code and make it easly extendable in the future. The application should be nothing else but a series of components that have input(s) and output(s). The components ...
2
votes
2answers
7k views

Do pointers really exist in Java? [duplicate]

I read quite a few resources on the internet and now I am quite confused about the existence of pointers in Java. Some claim that there are pointers and some claim that there is no such concept. So ...
2
votes
3answers
799 views

What is minimalistic setup for Agile Development for a small team?

I have 10 developers and 3 Testes team and I want to setup CruiseControle as CI for automated builds, tests and deployment to production server and some repository for SCM ( Source Code Management). ...
0
votes
4answers
2k views

what is best book to learn optimized programming in java [duplicate]

Possible Duplicate: Is there a canonical book for learning Java as an experienced developer? Let me elaborate a little: I used to be a C/C++ programmer where I used data structure ...
27
votes
16answers
5k views

How do I explain a “Hello World” program for beginners? [closed]

I am going to give some beginners a presentation about writing first program in Java. This program will be about printing "hello world". I'm not sure how can I explain the concepts such as main method ...
18
votes
7answers
1k views

How do I avoid “Developer's Bad Optimization Intuition”?

I saw on a article that put forth this statement: Developers love to optimize code and with good reason. It is so satisfying and fun. But knowing when to optimize is far more important. ...
13
votes
8answers
17k views

Best practices for constants

How do you guys handle constants, especially in Java (static final) and C++ (define)? Do you use dedicated headers (C++) or classes (Java) for all constants? Do you turn all literal values into ...
10
votes
2answers
430 views

Java: why is there a Comparator interface but no Hasher and Equator?

This issue is most apparent when you have different implementations of an interface, and for the purposes of a particular collection you only care about the interface-level view of the objects. For ...
10
votes
6answers
21k views

A way to return multiple return values from a method: put method inside class representing return value. Is it a good design?

I need to return 2 values from a method. My approach is as follows: create an inner class with 2 fields that will be used to keep those 2 values put the method inside that class instantiate the ...
9
votes
6answers
734 views

Is there an infinite amount of knowledge in a programming language?

I can program in Java, C#, C, Scala, and Javascript fluently. I'm comfortable with Objective-C, but I don't remember the conventions used for memory management. I can read Python and Ruby and I've ...
9
votes
1answer
1k views

Multiple Dispatch vs. Function Overloading

I'm trying to understand the difference (if any) between the two. According to the Wikipedia page for Multiple Dispatch it is synonymous with Function Overloading, but then later on goes on to say: ...