Archive for the ‘Java’ Category

The java guys “don’t get it”

September 18th, 2007

Just bumped into the twelve best practices for spring xml configurations, and the first one is “Avoid using autowiring”:

The property names of the OrderService class are used to match a bean instance in the container. Autowiring can potentially save some typing and reduce clutter. However, you should not use it in real-world projects because it sacrifices the explicitness and maintainability of the configurations. Many tutorials and presentations tout autowiring as a cool feature in Spring without mentioning this implication. In my opinion, like object-pooling in Spring, it is more a marketing feature. It seems like a good idea to make the XML configuration file smaller, but this will actually increase the complexity down the road, especially when you are working on a large project where many beans are defined. Spring allows you mix autowiring and explicit wiring, but the inconsistency will make the XML configurations even more confusing.

I can’t understand this uncontrolled passion that java programmers carry for xml. Even with the introduction of annotations (in 2004 for god’s sake) there still an awfully lot of xml that you have to write. Write and smile! And write more than you’d need to, as they discourage any other way in the name of “increase in complexity” that you would get if you lower the xml on your apps.

Why is that? Any serious app must have the equivalent in java LOC in xml?

I think that my decision to support and encourage autowiring on MicroKernel/Windsor was the most correct one. You just have to define a behavior, something that is easy to predict, that makes sense, that even people that wont read documentation can “get it” and you’re fine without xml.

Categories: Java | Top Of Page | 4 Comments » |

Java + SpringMVC = depressed programmer

September 14th, 2007

Check this

<spring:bind path="trade.buySell">
<input type="radio" 
       name="buySell" 
       value="true" 
       <core:if test="${status.value}">checked</core:if> >
	Buy
</input>
<input type="radio" 
       name="buySell" 
       value="false" 
       <core:if test="${! status.value}">checked</core:if> >
	Sell
</input>
</spring:bind>

Does it need to be so verbose?

Categories: General, Java | Top Of Page | 3 Comments » |

Open source vs closed source products on Java camp

September 14th, 2007

I just bumped into this

“Our customers, as well as the 750 organizations that downloaded our beta have spoken loud and clear: they want an open source, royalty free framework and engine that allows them to fully exploit the collaborative nature of the community and that does not lock them into a proprietary runtime,” said Byron Matheson, CEO of ClearNova. “We are confident that releasing the ThinkCAP JX framework as an open-source product will provide customers with the ability to realize the power of AJAX-enabled web applications as a better alternative to traditional client server business programs, while greatly accelerating adoption of ThinkCAP as the gold-standard for RAD platforms.”

Contrasting with Microsoft camp is quite disturbing. I can even imagine a similar statement from Scott Guthrie

“Our customers can’t and will not rely on something created collaboratively by the open source community. They need us to deliver something similar. Maybe better, possibly not. But will belong to Microsoft namespace, and that what counts to our customers.”

Microsoft is yet to realize the power of open source to improve and test their products in a large scale. Meanwhile Google’s GWT, Yahoo’s Hadoop, BEA’s Beehive, IBM’s xerces and xalan, leverage on the power of open source communities for quite some time. I only hope that when MS wake up for the 20th century it’s not too late. Afterall .net is a fantastic platform.

Categories: Java, OS | Top Of Page | 10 Comments » |

If there’s one thing I hate about java…

September 6th, 2007

… is checked exceptions. What a pain in the ass! Who was the *brilliant* programming language engineer that thought this was a good idea? I’m starting to remember why C# was such pleasant experience…

I could go with Error approach, but that is not recommended :-(

Categories: Java | Top Of Page | 10 Comments » |

Amazon EC2 + S3 + SQS = thrilled programmer

September 4th, 2007

Last week I started in a Java project — yes, you read that right. But it’s not an ordinary Java project, it’s an ambitious platform that will scale like no other by using the top-notch services offered by Amazon.

The Amazon EC2 offers you a way to allocate CPUs! It loads up an image that you made available, process something and shut down. You pay for the time it was up.

Obviously that leads to a very different kind of architecture and a totally different set of problems. Anyhow it’s exciting to get out of the stuff that I’m usually involved with.

Why not .net?

EC2 runs on *nix. Not even sure if a image loaded with windows is possible. Even if it is, I don’t think the cost would be worthwhile.

Why not mono then?

It’s slightly slower than Java and we were concerned about mono maturity. And everyone on the team is comfortable with Java anyways.

It feels good, amazingly

Hey, java is fun! Aside from that, I can work without starting VMWare Fusion, a big plus. Also, if you stick with intellij, after a few tweaks it feels just like Resharper ;-)

Some things feels weird and overly complex, though, like parsing xml documents using xerces. But I quickly realized that the weirdness was the price of an open platform that allows you to plug your favorite xml parser (amongst other pluggable implementations).

This approach is one of the things that makes Java more complex than .Net, but also more compelling for some scenarios. Especially for control-freaks like me.

What IoC container are you going to use

Possibly none. If the need arises, then Pico, or Guice or I can code a MicroKernel for Java 1.5 in my spare time. Should be fun :-D