Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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 JUnit source code. I started looking into it and I was impressed by how 'Money' is designed/represented. Similarly are there any suggestible open-source projects.

share|improve this question

closed as not constructive by MichaelT, Martijn Pieters, GlenH7, Walter, ChrisF Feb 17 '13 at 14:41

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Please detail a little bit more what you want to achieve. Learn new parts of the JDK, see how a big application is designed, etc... There are millions of lines of code available on the internet. –  LudoMC Mar 26 '11 at 17:12
1  
In general, I don't think that is how you should go about learning programming practices. –  apoorv020 Mar 26 '11 at 17:39
    
@apoorv020 On the contrary, I think that's one of the best ways to improve yourself in programming, by studying code other people have written. –  Jeff Welling Mar 28 '11 at 11:14
    
Are there any questions like this but s/Java/Ruby/ ? –  Jeff Welling Mar 28 '11 at 11:20

5 Answers 5

I suggest you pickup a good design book instead. Professional code usually does not explain important details such as "this is a factory pattern.". It also often contains loosely implemented patterns (if any) and custom requirements.

Design patterns are just far too complex to just figure it out on your own. It took the Gang of Four years to lay out the fundamentals. So its better to learn to do it correctly then see what others are doing.

Head first design patterns is a solid Java dp book.

Design and simplicity do not necessarily go hand in hand. Good design is heavily focused on proven use cases for a particular pattern. Not that the pattern is simple per-se, but that it works. Simplicity is as much an art as a science. It also requires a good understanding of the business requirements, framework and the customer. Keeping it simple takes years of practice. Even then time limits and reality plays a huge role in what's possible. Remember the triangle.

share|improve this answer
    
+1: Simplicity is very much dependent on what you already know. –  Steve Evers Mar 26 '11 at 23:31
3  
-1: Strongly disagree, studying code done by professionals you can learn a lot. At times more than in a book. Although it cannot replace reading books but can be done side by side –  Imran Omar Bukhsh Mar 27 '11 at 20:30
    
@Imran Omar Bukhsh - 100% disagree with you Imran. I see no way that an inexperienced developer trying to learn on their own by reading code could lead to anything but confusion. Without a solid foundation the inexperienced developer will have no idea what they are looking at. Especially without a mentor (which is the ONLY way I would suggest learning from code meant for real world usage). –  P.Brian.Mackey Mar 28 '11 at 0:34
    
@P.Brian.Mackey Well to be fair he did say "Although it cannot replace reading books but can be done side by side" and written the way he wrote it, I agree with him. –  Jeff Welling Mar 28 '11 at 11:17
    
@Jeff Welling - I still disagree. I've seen too many new developers sway way off topic when going through other people's code. "It is harder to read code than to write it." This is one of the core reasons I suggest to newish developers to read or get a job coding where they can learn from the other devs. –  P.Brian.Mackey Mar 28 '11 at 15:02

I would suggest you this tutorial - http://www.macs.hw.ac.uk/guidebook/?name=Using%20The%20GUI&page=1. It would be difficult to study the source code without explanations.

share|improve this answer

If your already with a software development company you may be in a better position to accomplish this due to being able to ask for help from various mentors within the organization, but don't be afraid of jumping in to source code regardless of career choice if you want to study it.

Studying with a mentor is ideal but not always possible, one way of looking for a mentor if you don't work for a development organization is through OpenHatch.org. If you get stuck and something doesnt make sense, ask for help or clarification from the original developer or from the FOSS community at large.

For a list of some projects you can freely study, you could check out github and search for "language: java" to find all projects in Java. https://github.com/languages/Java

share|improve this answer

Look at Spring Framework's code. It is neatly designed and well documented.

To improve your design skills, step into eclipse plug-in development.This is the best place to learn design patterns and put into practice.

share|improve this answer

One great project to study if you really want to dive into code is JHotDraw. It's an open source graphics framework written in Java as a demonstration of how design patterns can be used in practice. A member of the GOF (Erich Gamma) is one of the authors of the framework. The main page is at http://www.jhotdraw.org/ (includes links to the source code).

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.