17 ms·
Java: Real or Not?
- ibejoeb 11y agoIt's been a few years since I've seriously used Spring, but I when I did, I used the hell out of it. I'm pretty surprised by how many times I was fooled.
- lkrubner 11y ago"The principle of least surprise" is sadly missing from this API.
- lmm 11y agoNot true. The reason these class names are so long is that they explain in great detail what the class does.
- overgard 11y agoIt never hurts to study the masters in serious enterprise software: https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris...
- 10098 11y agoOnly 85% coverage? Tsk tsk tsk...
- gfodor 11y agoThis is great but it brings up a serious question I've always had. Taken to the extreme, things like the single responsibility principal, the open closed principal, etc, result in messes like this. I've been wondering if anything has been written around a concrete methodology of doing OOP that doesn't naturally converge onto something like this, and why it happens.
- RyanZAG 11y agoUnfortunately, it's more of an art than a science. The simple rule is: it should be as simple as possible, and no simpler than that. Obviously, everybody has a different idea of where exactly that line is. Usually though, if you try to make the code clean and as small as possible while still allowing unit tests to be written, you normally hit a decent spot. YAGNI applies very heavily here too and it's often better to make the code less generic and refactor it later when required.
- vbezhenar 11y agoI use Spring and I'm not agree that it's a mess. It has a lot of functionality but good architecture allows to keep it under control and easily enhance when needed. Spring is one of the best open source frameworks I've ever seen.
- smoyer 11y agoBoth Spring and JavaEE (as compared to J2EE) have gotten a lot better by using annotations for meta-programming. I was about to give up on enterprise Java programming when the clutter/over-engineering started to get better. Curiously, I'm going to at least partially credit Ruby for introducing the idea of convention over configuration.
- mooreds 11y agoWhy curiously? RoR hit hit java web development like a ton of bricks, with its convention over configuration and quick start. The end result are java projects like Play and Spring Boot. I am not really a ruby guy, but I'm very thankful RoR came along and shook things up.
- overgard 11y agoYou might enjoy this: http://mollyrocket.com/casey/stream_0019.html http://mollyrocket.com/casey/stream_0019.html I think the problem is that OOP is automatically considered "virtuous", despite the context. There's nothing wrong with the single responsibility principle and what not, but there is something wrong with thinking that classes and objects are always the best way to approach a problem. Java ends up being the target of jokes because by forcing everything into classes/objects even when it doesn't make sense, it leads to cartooned versions of those ideas.
- mkozlows 11y agoIt's not surprising that a Markov chain could put together plausible sounding class names, because yeah, there are definitely patterns that class names fall into. What's surprising is that one third of the names it's showing me are actually real. I mean, "MetaMetaContextHierarchyConfig" actually exists?
- McGlockenshire 11y ago> I mean, "MetaMetaContextHierarchyConfig" actually exists? Apparently. https://github.com/spring-projects/spring-framework/blob/master/spring-test/src/test/java/org/springframework/test/context/hierarchies/meta/MetaMetaContextHierarchyConfig.java https://github.com/spring-projects/spring-framework/blob/mas... "Custom context hierarchy configuration annotation that is itself meta-annotated with MetaContextHierarchyConfig"
- agency 11y agoIt's worth pointing out that this is test code.
- the_af 11y agoI got "ConfigClassesAndProfileResolverWithCustomDefaultsMetaConfig.ResolverConfig" as real (which I failed to pick... I mean, really?) and had to doublecheck it really is. Sadly, it's true. What the hell, Spring Framework?
- cecilpl 11y agoDon't forget you can't test the ConfigClassesAndProfileResolverWithCustomDefaultsMetaConfig without a set of ConfigClassesAndProfileResolverWithCustomDefaultsMetaConfigTests. And of course, what about testing the custom overrides of that config? Well just use the ConfigClassesAndProfileResolverWithCustomDefaultsMetaConfigWithOverridesTests! Seriously.
- clamprecht 11y agoAre you calling the Spring developers Markov chains?
- elevensies 11y agoAre the generated names verified to be non-real? There could be some overlap.
- parasubvert 11y agoThey're not, there is quite a bit of overlap because most of the names are reused (i.e. once you know what a Context is, Handler, etc., smashing these words together makes sense
- guard-of-terra 11y agoThere is definitely overlap, it tells me that HttpSession is not real, and guess what, https://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpSession.html https://docs.oracle.com/javaee/6/api/javax/servlet/http/Http...
- icebraining 11y agoThe real ones are supposed to come from Spring, not the Java stdlib.
- soup10 11y agoMost of the atrocious stuff is in J2EE related frameworks (looking at you spring and hibernate). I think core java libraries are amazingly designed and a good part of why the language became popular. You won't find many FactoryFactories there, The land of c,c++ libraries that came before is incredibly fragmented, inconsistent and difficult to use by comparison, not to mention the documentation. Good lord the docs ;x.
- haddr 11y agoSome answers are not 100% right. I got: - HttpServlet - AbstractXmlWebMvcResultProcessingInterceptorAdapter - MockJtaTransaction While there is HttpServlet class, it is considered wrong, and 3rd option is considered correct :(
- mike_hearn 11y agoIt's only talking about classes from Spring specifically. HttpServlet isn't a Spring thing.
- Terr_ 11y agoThat makes it even-more-pointless. It's like people criticizing command-names in linux and going "LOL a computer made that one" even though the command actually exists in another distribution or shell.
- kaddar 11y agoNote that some classes exist (even if not in Spring, at least in base Java) http://imgur.com/sNk4mE2 http://imgur.com/sNk4mE2 The key thing to keep in mind with generative models based on real data is that just because results were based on random generation doesn't mean they can't match something real.
- Nitramp 11y agoThe names are extremely predictable (as shown by this Markov chain), which is actually a Good Thing (tm). The bad thing is that things got complex enough to warrant these names. It's the knee jerk reflex of decoupling everything, to the point that you have 80% configuration/wiring/setup vs 20% of code that actually does something useful. Each extension point in the framework is represented by a couple of these classes to handle the layer of indirection. Maybe Spring should run a study and see which of their extension points is actually used, at all, or by more than x % of users, and then cut down all the useless ones. I'm not too familiar with Spring these days, but I'd expect that the vast majority of indirections isn't actually useful for anybody. The other problem is that our mechanisms to introduce and handle these abstractions are too verbose. Each extension point spawns multiple classes where it's really just one little method that needs to be called instead of another block of code. That makes software systems extremely hard to understand and use, and the overall bloat does actually slow things down - if not in production, then in deployment, startup, and build.
- acdha 11y ago> Maybe Spring should run a study and see which of their extension points is actually used, at all, or by more than x % of users That last part seems key: I'd be shocked if you didn't find someone, somewhere for every one of those features – and, based on some of the enterprise apps I've seen, doing so because it allowed a quick hack rather than solving a problem more correctly and expensively. The question really should be “Is the value from having this work the non-trivial obscurity and maintenance cost?” to emphasize that features and extensibility aren't free.
- Gibbon1 11y agoWhat struck me is it looks seriously like Hungarian notation applied to function naming.
- dmcg 11y agoNice. We made fridge-magnets in my last project to help generate excellent names like these.
- therealidiot 11y agoHaha, I need to try this but for the whiteboards at work. We sometimes try to come up with ridiculous names too
- tibiapejagala 11y agoI don't like complaining about submissions not working in my browser, but this time I feel like I'm missing a lot of fun. On Firefox DevEdition nothing past "Pick the one that's not made up!" appears. On latest IE it's every time "ComplexPortletApplicationContext.EditController" vs "ModelMapBasedHandlerMethodProcessor" vs "AbstractPlatformTransactionAttributeSource". 16 times the same question. Well, this could be just bad luck if questions are random. With randomness you never know.
- Nikhil_teja 11y agoTrust me you are having more fun than anybody out here.Unless being humiliated in a way that you will never dare claim mastery on any thing (even when its the only thing that you think you are good at) sounds like fun to you ;)
- ExpiredLink 11y agoHN goes reddit. Java, oink, oink, lol!
- parasubvert 11y agoThis is sort of like making fun of German for using long combinations of smaller words to denote a concept. Or making fun of medical jargon. (ha ha, you said subdermal hematoma not bruise) Once you know what the individual words mean, you can use them in different places, and know right away what the class does. Do you need to use 80% of these? No, but they're there, like parts in a car, in case you need to tinker.
- the8472 11y agoAnd it's not like anyone is typing these words out. IDEs have auto-completion for that purpose.
- therealdrag0 11y agoMoreover, in Eclipse you can do camel-case completion. So you can type "ACV" and get "AbstractCookieValueMethodArgumentResolver". (I'm not sure if other IDEs do this)
- bitmapbrother 11y agoI believe IntelliJ does this also, but Eclipse did it first.
- impostervt 11y agoSpring is not the only framework with bad names; look at this class name from aspectj: org.aspectj.weaver.patterns .HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor
- jhallenworld 11y agoIt amuses me that names in Verilog 1995 (a language with no structures) look pretty much the same: oc48_transp_decode_data.
- dschiptsov 11y agoLike any other primitive, dogmatic religion, Java will stay for ages, because there will never be a shortage of idiots to repeat the dogmas and mediocries to have a decent living by manipulating the crowd. Java is triumph of the "packers mindset". http://the-programmers-stone.com/the-original-talks/day-1-thinking-about-thinking/ http://the-programmers-stone.com/the-original-talks/day-1-th...
- peterashford 11y agoThis post perfectly sums up a mindset I detest. Engineers get shit done and don't care about whatever the most recent hipster programming language is. They can probably spell "mediocrity" as well.
- wumbernang 11y agoI'm with you. I really don't think people with that mindset could put together the sort of shit we do on the enterprise mindset side of things. The tools are carefully picked to be entirely the opposite to the contrarian mindset. So we have a system that has about 500 HTTP endpoints, 600 service endpoints, 4MLoC, several TiB of data, several TiB of documents, handles 5000 concurrent users 24/7 ramping up to 2 million euro consumers (not concurrent) and 10 full 42U racks of kit in two facilities. Oh and strict security isolation through several layers. Java+c# is the only answer. But 50 times a day someone says, hey rewrite it all in Ruby and Monogo. That's a joke.
- dschiptsov 11y agoTell us that you at least use nginx at these 500 HTTP endpoints, not servlets...)
- wumbernang 11y agoNo we don't use nginx. F5 big-ips in front of a large IIS cluster serving through WCF + ASP.Net MVC.
- 11y ago
- deleted 11y ago[deleted]
- peterashford 11y agoNice job blaming all of Java for Spring's foibles
- davelnewton 11y agoThe chained names are often too long; I find it hard to believe that my very rusty Java/Spring is the reason I got almost all of these right.
- antod 11y agoRusty Spring? Reminds me of that literary classic by I.P. Knightly.
- billrobertson42 11y agoIt's utter bullshit to conflate Spring and Java like this.