Archive for the 'Beautiful Java' Category
Bending Java: More readable code with methods that do nothing?
12 Comments Published May 9th, 2008 in Beautiful Java, Bending Java near the Breaking Point, JavaFrom the category “Bending Java near it’s Breaking Point” or “What a stupid but interesting idea”. I like to explore ideas in Java that are inside the language spec but outside of common usage or style guides. I think Java has a lot more to give than what people did the last ten years. Before […]
I haven’t been using the final keyword in Java for 10 years, but more and more I think it’s an excellent keyword in Java. All local variables should be declared final. Today one of the developers of my team made every local variable in a method final and I was wondering how strange that looked. […]
REST: Lean JSON and XML from the same code
4 Comments Published April 4th, 2008 in AJAX, Beautiful Java, JSON, Java, Javascript, REST, XMLGenerating JSON and XML with the same code is difficult. One can create the semantically richer XML and convert it to JSON, but JSON notations for XML like Badgerfish look quite ugly to JSON advocates.
The problem at the core is that XML is typed whereas JSON is not. Every node in XML needs a […]
Simple Java naming trick: now and today
5 Comments Published January 24th, 2008 in Beautiful Java, JavaWhen browsing and reading code, I often find this:
Date currentDate = new Date();
Someone needs a current date. The line is unclear what the developer really wanted to achieve. Does he want the current date or the current time? The Date class in Java is ambiguous: “The class Date represents a specific instant in time, with […]
I’ve recently started to read the best book on object oriented programming. There are other good books that deepen your understanding of OO like “Refactoring” and “P of EAA” from Fowler, “Design Patterns” from the GoF, the McConnell books, “The Pragmatic Programmer”, the OO books from Robert C. Martin and some others. All recommended to […]
Qi4J is the new kid on the block. Forget Scala (not although but because Bruce Eckel, the author who switches hypes faster than other people switch their underware, declares Scala to be the next big thing). Scala helps you solve CS problems nicely, but not business problems. Qi4j is about composite oriented programming. It’s designed […]
Fluent interfaces everywhere
0 Comments Published December 4th, 2007 in Beautiful Java, Fluent Interface, JavaI wrote about fluent interfaces for several times. A comment on my best MarkupBuilder in Java try pointed to a fluent inteface for JAXB. Excellent, thanks Hristo.
var dzone_style=”2″;
The best Markup Builder I could build in Java
8 Comments Published November 30th, 2007 in Beautiful Java, Fluent Interface, Groovy and Grails, Java, Java 7Using Groovy MarkupBuilders spoiled me for other ways to create HTML pages from code. Others think the same. But in some organizations you have to use Java and can’t use Groovy - at least when you can’t sneak it in.
So I tinkered around in Java to see what’s the best MarkupBuilder I can write […]
Beautiful Java: Reflection and the BeanCopier
5 Comments Published November 23rd, 2007 in Beautiful Java, Java, ReflectionWhen reading about reflection on the beautiful code website I thought about solving some problems with reflection and finding new solutions to old problems. One problem is boring code when writing a copy constructor. A copy constructor is a constructor which takes another object and copies it’s attributes. This is often useful when copying objects […]
Explicit Static Types are not for the Compiler, but for the Developer - Duh
9 Comments Published November 5th, 2007 in Beautiful Java, Dynamic, Ruby, Type Inference, TypesLots and lots of people lament the explicit type system in Java, either they are dynamic ducks or inference intellectuals. Taken from the Boo manifesto:
“Nothing more tiresome than writing the same type name over and over just to make the compiler happy. I’m not talking against static typing in general (boo is statically typed), […]