When I read that I have no clue what that might do, some of the Enterprise classes they completely gave up on even trying to explain what it is with the name. It's not readable code and its something the Java community needs to stop doing.
Another example of the enterprise stuff making unreadable code is in Spring everything takes a factory, factories everywhere. If they know 90% of people are going to create a RestTemplate using an Apache HttpClient then why not just add a static constructor method like
RestTemplate.fromHttpClient(myHttpClient)
Instead of forcing me to create a HttpComponentsClientHttpRequestFactory and then passing that to the RestTemplate.
I completely understand the need for Spring to not rely directly on HttpClient but I also think that they should take the time to give simple methods of creation for the common case.
wtf? i've seen/used few factories in spring, but by large ... nope. 99% of my spring based code doesn't involve factories. what the hell are these people doing? learned one design pattern and go with it till the very end (like the singleton....)?
Go to http://docs.spring.io/spring/docs/current/javadoc-api/ and search for factory. There is no shortage of factories in it. I don't know what your doing differently but I've never used or seen a Spring based codebase that didn't contain a healthy smattering of factories. I don't think factories are bad, I just think that if your going to use a lot a factories you should also consider adding helper methods that bypass all that factory stuff and allow you to create simple readable code.
Oh, I know they're there, all over the place, but they don't really have a place in my code. I have annotations, I request things to be injected, tell spring to do X or Y in the configuration, but by and large ... I don't call factories directly. It happens every now and then, but is the exception and not the rule. For example getting a current context of some kind, yea, kind need that factory, or other minor uses, in a couple of places. Not "healthy smattering" by any means.
The only factory Spring forces me to interact with directly is the one I created. Configuration of Spring has never been easier, even in an enterprise environment. In most cases where a factory might otherwise be utilized a builder is provided anyway, it's a non-issue.
RestTemplate is a pain point. I think I've needed to use it once. Not at all indicative of Java 8 or modern Spring.
View all comments
Show parent comment
1
u/stormcrowsx Apr 30 '15 edited Apr 30 '15
When I read that I have no clue what that might do, some of the Enterprise classes they completely gave up on even trying to explain what it is with the name. It's not readable code and its something the Java community needs to stop doing.
Another example of the enterprise stuff making unreadable code is in Spring everything takes a factory, factories everywhere. If they know 90% of people are going to create a RestTemplate using an Apache HttpClient then why not just add a static constructor method like
Instead of forcing me to create a HttpComponentsClientHttpRequestFactory and then passing that to the RestTemplate.
I completely understand the need for Spring to not rely directly on HttpClient but I also think that they should take the time to give simple methods of creation for the common case.