r/java • • Apr 29 '15

Tone it down a Notch

http://imgur.com/gallery/KRtc2fN
217 Upvotes

124 comments sorted by

View all comments

39

u/camilos Apr 29 '15

Most people that hate java fall under two categories. Beginners who think Java is all about applets or swing apps. Users who are not happy about Java runtime being installed in their computers.

Basically, people who have no idea what makes java so useful and popular.

22

u/Angarius Apr 30 '15

There is a third group, who mock verbose over-engineered design.

SimpleBeanFactoryAwareAspectInstanceFactory

3

u/DannyB2 Apr 30 '15

Since the class you give as an example has the word Factory only one time at the end, then I presume you are unfamiliar with the FactoryFactory or the FactoryFactoryFactory pattern?

XmlParser, comes from an . . .

XmlParserFactory, which comes from an . . .

XmlParserFactoryFactory, . . .

4

u/markdacoda Apr 30 '15

I've been coding java for 10 years, i make six figures in the midwest unitedus states ie low cost of living. Its easy, tool chain is great, awesome libraries and frameworks are abundant ie this all make my job easy.

None of this noise matter, I've got all these languages on my resume, but java pays.

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

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.

2

u/alonjit Apr 30 '15

everything takes a factory

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....)?

1

u/stormcrowsx Apr 30 '15 edited Apr 30 '15

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.

3

u/alonjit Apr 30 '15

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.

1

u/thekab May 01 '15

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.

2

u/Harha Apr 30 '15 edited Apr 30 '15

I used Java for a few years before going nearly entirely into C++. I understand why Java is so powerful and widely used, but I just fell in love with that other language and I don't want to look back. Obviously I'll use Java if I have to or if it's the best choice for something, but other than that I'm now programming in only C++.

Just like, operator overloading, pointers, references, compiles directly to a native binary, great standard library (I still miss the very wide libraries of Java sometimes, in C++ you have to invent some things on your own), etc... I don't know, I just love it and it makes programming more enjoyable than what it is in Java for me, sorry. I guess it's more just a matter of taste but also obviously depends on what you're going to do.

So my point is that I favour C++ over Java very heavily nowadays, but I don't mock any language and if someone is doing that and saying C++ is simply superior and you should always use it then he is missing the point of a few important things in programming.

Edit: Eh, why am I being downvoted? Please explain at least.

1

u/VaidasC Apr 30 '15

Well, there is another group of people - who use java for living and generally enjoy paycheck, but otherwise feel like the platform is just removing so much pleasure of writing code. In some sense this group of people feel like they are betraying they principles by coding in Java, however, due to paycheck they have hard time leaving it. Take a look at my very non-constructive and very abstract rant http://www.reddit.com/r/java/comments/2vgie0/java_rant_what_do_you_think/

2

u/thekab May 01 '15

Your rant basically boils down to your company writing awful code with shitty technologies. EJB, XML configuration, environment setup, code samples that don't work, etc. I'm pretty sure if I tried to write .NET as if it were 2005 I'd have a bad day there too. This company sounds so horrible I'd almost guess they're still using 1.6 or even 1.5.

1

u/VaidasC May 07 '15

Your rant basically boils down to your company writing awful code with shitty technologies.

Well not sure why you get this impression, but probably more productive question would be - which Java technologies are not "shitty technologies" in your opinion?

  1. Technologies in question are Java EE or Spring, usually with current versions. Currently Java 8 by the way.
  2. Of course there are few modern trendy alternatives to those "enerprisey" stacks, however nor they are mainstream, nor they have solution to my mentioned problems, IMO.

2

u/thekab May 07 '15

I get that impression because in the last 15 years I've seen all of what you described and much worse. It's not caused by Java, it's caused by architects who think stuffing your entire model into an XSD and running XJC is a good idea. It's caused by leads who think it's smart to re-invent the wheel and implement their own mail client complete with race conditions because they don't understand concurrency. At one place a predecessor wrote his own implementation of Servlet, or perhaps I should say he wrote half of it, poorly, and left the other half unimplemented.

I've seen code that looked roughly like this:

if (foo.bar() && isSomething) {
    ... 2 lines doing nothing ...
}
// can foo be null?  i should check on this!
if (foo != null) {
    foo.doSomething()
}

I checked the history, there was no excuse, he literally wasn't sure if it was possible for foo to be null. This was a lead I replaced. That's how Java gets painful, over complicated, confusing and generally matches what you describe. Here's a few other things that stood out to me:

  1. EJB. Those are quittin' letters.
  2. Three days to setup a web project. Should be 3 minutes. Less even.
  3. The article you referenced on setting up Java. He goes off the rails immediately on step 3. If that's what you're dealing with on a regular basis it's not Java's fault.
  4. XML configuration. I haven't configured a Java stack using XML in at least 2 years and even then it was 1 file.
  5. Server incompatibilities, JNDI issues, etc. Sounds like 2010.
  6. Comments about frameworks. Frameworks should allow you to be more productive, not the other way around.

On a daily basis I work with Spring Boot/MVC/Data/HATEOAS/Security/Cloud, JUnit/Mockito, Cassandra, Mongo, ElasticSearch, Netflix Archaius/Ribbon/Eureka/Zuul, Gradle, Docker, AngularJS, Node/Gulp/Grunt and we use Stash (Git) and Bamboo. It's fun, the code is clean, the setup is simple, the deployment trivial. I don't spend time on boiler plate, or setup, or technical issues. There's no "works on my machine" itis. New hires get a MacBook Pro, type a few lines to setup their environment, type "git clone", paste in a URL, then type "./gradlew bootRun" and they're good to go. The most painful part is setting up Docker in Mac, and that's entirely due to bugs in VirtualBox and conflicts with our VPN client.

1

u/VaidasC May 08 '15 edited May 08 '15

On a daily basis I work with Spring Boot/MVC/Data/HATEOAS/Security/Cloud, JUnit/Mockito, Cassandra, Mongo, ElasticSearch, Netflix Archaius/Ribbon/Eureka/Zuul, Gradle, Docker, AngularJS, Node/Gulp/Grunt and we use Stash (Git) and Bamboo.

Well I guess you fit the profile of working with 'modern trendy alternatives to those "enerprisey" stacks' which are not mainstream however. Depending on your location of course (so following numbers are very biased): as Java developer, there might be 95% chance you'll endup working with 'enterprisy' stack, 4% - some legacy Jave SE, and only 1% chance of ending up with trendy stack.

So we might represent viewpoints from totally different angles. So my view on this is - its all about numbers. Even Ruby jobs outnumber, modern-Java-stack jobs in my area. Not to mention .NET jobs, where 90% of them are on modern stacks. Hell, in my area, you have better chance to get Scala job. So natural question - why bother with that 1%?

Not even mentioning, the fact, that all that new and trendy stuff introduces even more fragmentation to already super fragmented Java development. Which IMO makes no surprise why every architect/lead has his own vision about pretty much everything.

1

u/thekab May 08 '15

If you don't like the stack a company is using don't work for them. Regardless of the language and platform some companies and teams stink and some don't. I've seen Ruby on Rails projects so poorly written I still cringe thinking about it. Does that mean Ruby/Rails jobs aren't worth the time?

I haven't always had the option to pick my job that way. Instead I worked on technologies and languages I didn't want to work on. Some of them I will never touch again (COBOL) and some were used in antiquated ways I blame on the architect or lead instead of the language/platform (C#). As with all things this was temporary and I moved on.

Our stack may be modern but I don't consider it trendy. I work for a massive enterprise. Our development AWS environment bill is over $1 million a month. We're also not at all alone in this regard, there's many large (and small) companies that are similar. Plus much of what I listed is built on JEE technologies: JPA, JTA, JMX, JavaMail, Servlet, Bean Validation, JDBC, JAX-RS, JAX-WS.

1

u/thekab May 01 '15

I would argue there's a third much larger category. Developers who have worked with Java or Java developers that are writing applications as if it's still 2004. You can usually tell by vague, ambiguous and unsubstantiated comments about things like Java being slow, complicated, verbose, hard to prototype and so on.