10 ms·
InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonPainter
- Mamady 14y agoWhy? Because Java is awesome. But seriously, this just highlights one of the downsides of following "coding standards" religiously.
- edwinnathaniel 14y agoIf the upsides are plentiful as opposed to cowboy-development-methodology then I don't feel bad about it.
- Mamady 14y agoI dont have a problem with coding standards. I have a problem with following something so strictly, even when it makes no sense at all - such as this class name.
- Cieplak 14y agoReminds me of the FactoryFactoryFactory pattern.
- joshfraser 14y agoOr ififtpiftpmbp as I like to call it for short.
- gdg92989 14y agoyou know... the one that "Actually performs the painting operation."
- bbayer 14y agocreating inheritance by using name conventions is really good idea!!
- gkoberger 14y agoMore information [2007]: http://www.pushing-pixels.org/2007/11/07/and-the-longest-jre-class-name-is.html http://www.pushing-pixels.org/2007/11/07/and-the-longest-jre...
- nostromo 14y agoSomeone on StackOverflow suggested we think of ugly Java class names as poetry; he provided an example: InternalFrame InternalFrame Title Pane, Internal Frame Title Pane. Maximize Button Window, Not Focused State. http://stackoverflow.com/questions/1697215/what-is-your-favourite-java-api-annoyance http://stackoverflow.com/questions/1697215/what-is-your-favo...
- leoc 14y agoSteve Yegge has written Java poetry before: http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom...
- biscarch 14y agoI'm going to be singing Java class names for the next week because of this.
- cmccabe 14y agoSomeone on StackOverflow suggested we think of ugly Java class names as poetry Vogon poetry, to be specific.
- bfrs 14y agoworth rewatching: https://www.youtube.com/watch?v=mrIrcV9Bgmc https://www.youtube.com/watch?v=mrIrcV9Bgmc
- cfontes 14y agoDon't Panic. just put your towel over your ears!!!
- ludflu 14y agoyes. sometimes i feel as if i need special restraints built into my desk chair to properly "appreciate" the java code i am required to read and debug.
- stcredzero 14y agoInternalFrame InternalFrame We should be able to make this fit with "Silver Bells."
- ww520 14y agoSome people like to document their code with long name instead of comment. It's an internal class anyway. Why would anyone care? JDK has a superb auto document building tool to extract all the classes in JavaDoc and letting people to find internal classes easier.
- imglorp 14y agoAs good or bad as the Java language may be, I think plenty of people are turned off by the Java culture that encourages this to happen. This is a little bit of an understatement since Sun setting the defacto coding standard gives a very strong message to followers. The rest of the world might simply say blah.bah.frame.paint and be done with it.
- markokocic 14y agoThis one[1] from .Net comes quite close. Though, it was almost decade ago, they might have passed Java on class name length by now. [1]http://weblogs.asp.net/rchartier/archive/2004/02/05/68350.aspx http://weblogs.asp.net/rchartier/archive/2004/02/05/68350.as...
- jivatmanx 14y agoSystem.Windows.Forms.IDataGridColumnStyleEditingNotificationService Interesting. It's long, but it's also pretty clear on what it does, and doesn't have any repeated words. Reading this, I would guess that it's a notification of when the user starts editing a column, and indeed that's what it does. "Informs the System.Windows.Forms.DataGrid that the user has begun editing the column." is the official description in the API.
- markokocic 14y agoBut .Net is not open source, so you don't have information about the internal classes used in it. Anyways, we are shaming Java here because of one obviously automatically generated internal class.
- mcgwiz 14y agoIMHO it's not close at all. First, the namespace shouldn't be counted, leading to a huge difference in sheer length. Second, the words in the BCL name, more or less, form a comprehensible noun phrase. Third and anyway, this is the longest public class in the BCL, whereas the article describes an internal class; a much higher bar should be held for public names.
- markokocic 14y agoSeems like automatically generated class name. You shouldn't ever see that as a Java developer unless you work for Sun, since this is internal package. The name, though long, seems pretty consistent with the rest of the names in the package [1]. If you look at it once more I guess that it is used as a Painter for MaximizeButton located in InternalFrameTitlePane of InternalFrameTitlePane of InternalFrame. How would you name such thing? [1] http://javadoc.bugaco.com/com/sun/java/swing/plaf/nimbus/package-tree.html http://javadoc.bugaco.com/com/sun/java/swing/plaf/nimbus/pac...
- wtallis 14y agoGiven the name, it sounds like this piece of code is drawing window decorations despite not being part of a window manager. (Though it's unclear, it might be doing window decorations in an MDI-like context.) This object probably shouldn't even exist in the first place.
- plaguuuuuu 14y agoUsing private internal classes or something. Even with namespaces it'd look okay, so you'd go InternalFrame.TitlePane.MaximizeButton.Painter() or something (I've forgotten Java tbh) and that actually looks okay to most programmers IMO. I'm guessing this shouldn't even be exposed to anything outside of an InternalFrame anyway.
- riffraff 14y agothese are indeed autogenerated, as people reported when this hit reddit some days ago.
- espinchi 14y agoAlso, in the package com.sun.java.swing.plaf.nimbus, there lies the infamous class InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState (http://codenav.org/code.html?project=/jdk/1.6.0_22&path=/Source%20Packages/com.sun.java.swing.plaf.nimbus/InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState.java http://codenav.org/code.html?project=/jdk/1.6.0_22&path=...). Quite a precise name for a class that has only 36 lines. Talking about design patterns, the folks that develop the Spring framework apparently tried to put as many of them together as they could: there is a class named AbstractSingletonProxyFactoryBean (http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/aop/framework/AbstractSingletonProxyFactoryBean.html http://static.springsource.org/spring/docs/2.5.x/api/org/spr...) in the aop package. And, the class description is no less than "Convenient proxy factory bean superclass for proxy factory beans that create only singletons". Take that, GoF.
- Aardwolf 14y agoI love how it says "convenient" :)
- RandallBrown 14y agoAbstractSingletonProxyFactoryBean has to be a joke right?
- chris_wot 14y ago
- evmar 14y agoHere's a query for [\w{60,} lang:java] on Google Code Search: http://code.google.com/codesearch#search/&q=%5Cw%7B60,%7D%20lang:java&type=cs http://code.google.com/codesearch#search/&q=%5Cw%7B60,%7... E.g. TraversableResolverSpecifiedInValidationXmlNoDefaultConstructorGwtTest , DeleteContentTypeXmlDocumentResponseDeleteContentTypeXmlDocumentResult , and so on.
- edwinnathaniel 14y agoExclude unit and integration tests, sometimes the naming convention don't matter as long as the tests describe what it does...
- robrenaud 14y agoI know these test names might seem insane. And I personally hate the Java FactoryFactory culture of over-engineering. But, the super long test class names are actually pretty nice. I've personally never gone quite that crazy with the names, but I have definitely used more than 80 characters total for the class and particular function named for a test. These super long names not part of any client interface, no one is ever going to have to type that monstrosity except for the guy writing the test. But when you see the failing test output that prints the test name, you already know what is failing. You can have a small class name and a (comparatively) long comment, or just a long class name. Considering there is now no need for a comment and the test name is actually useful for debugging failed tests easily (you don't need to "dereference" the short test failure name to get the surrounding comment), this style is actually a win.
- smsm42 14y agoSome test tools generate test descriptions from names - so TraversableResolverSpecifiedInValidationXmlNoDefaultConstructorGwtTest looks in test report as "Traversable resolver specified in validation xml no default constructor gwt". Which may actually lead to more readable reports and nobody uses test classes to instantiate them except for automatic tools anyway. So these class names are not as insane as it seems. For non-test classes such name would be completely insane of course - or routine in case of Java :)
- twp 14y agoYou've most likely already seen this, but, if not, it's a relevant, great read: http://discuss.joelonsoftware.com/default.asp?joel.3.219431 http://discuss.joelonsoftware.com/default.asp?joel.3.219431
- LnxPrgr3 14y agoIt's said that Lisp programmers often work by first building a domain-specific language for solving their problem, then solving the problem in that new language. Some object-oriented programmers do something similar, where their programs are expressed in a domain-specific language written as an object relationship graph. Only they skip the part where that language is supposed to make it easier to solve the problem. What do I mean? Here's my (somewhat ancient) attempt at parody: http://pastebin.com/TyNrvRmB http://pastebin.com/TyNrvRmB It has all the hallmarks of production code I've seen in this style: it's about 20 times more than the necessary amount of code, it's subtly buggy, and it needs explanation because what it does is completely non-obvious. It is arguably slightly easier to extend than the obvious solution, but at a great cost, and in a silly one-off program at that. The worst part? This doesn't scream parody in some circles. This is just how things are done, as if anything less involved is fundamentally broken.
- stcredzero 14y ago> It's said that Lisp programmers often work by first building a domain-specific language for solving their problem, then solving the problem in that new language. This is precisely how good Smalltalkers operated. It was very doable, because even constructs like conditional logic and "looping" (really iterators) were just ordinary calls. For example, if you wanted to implement "fuzzy logic" in Smalltalk it would just take a mere minutes to implement some methods like: ifTrue:ifFalse:ifMaybe: Then define a Maybe class and use it as the Maybe value and park some methods like that on it. Then this would let you write code like: result ifTrue: [ "condition 1" ] ifFalse: [ "something else" ] ifMaybe: [ "handle maybe" ].
- sage_joch 14y agoI'm a bit worried at how easily I was able to follow that code. And that my initial reaction was to think "Iterator.next() should throw a NoSuchElementException if there is no next element!"
- anthonyb 14y agoAh, naming things. One of the two hard problems left in Computer Science.
- jacquesm 14y agoI just did a quick analysis of a system with a large number of globally exposed names written in C. About 1000 functions in all (so that's just the globals), of those a hundred have names > 30 characters. There are some real 'gems' in there, consistency - even if self enforced - has a price. The record holder weighs in at 53 characters, it (fortunately) drops off quickly after that. There are only 2 things hard in programming, cache invalidation, naming things and off by one errors. Personally I think this name is bad because in spite of the enormous length it still doesn't tell me what it actually does. It just uses a lot of characters to indicate its spot in a hierarchy. Names like these are what gave rise to jokes like 'Q: What is the spelling of bureaucracy? A: J-a-v-a'. Which of course does a dis-service to java the language and the community behind it. I can see why they're funny, but you have to realize that when you get out of the trivial program length domain into projects that are 100's of thousands of lines that this problem will sooner or later rear its ugly head. And I have not yet seen any really good solutions. The things that can help you to extend your runway a bit in this respect are: - be consistent - reduce scope wherever possible - pick short names for primary objects But even with those rules you'll have a 53 letter name in there somewhere... I'd be very wary of casting stones in situations like these without knowing exactly how the person that picked it originally made their choice. Chances are there were a whole pile of external factors dictating this monstrosity and the guy or girl (or the code generator!) that did it never was happy about it either. Laughing at others that have tackled some problem is easy. Coming up with real solutions and doing a better job of it is a lot harder.
- icelancer 14y ago>There are only 2 things hard in programming, cache invalidation, naming things and off by one errors. :)
- mturmon 14y agoIt is funny. The embedded error is, of course, in itself off-by-one, but the actual cause could be cache invalidation -- the list was extended from two things to three without updating the length counter.
- jakubp 14y agoI've only touched Java a bit, but AFAIK it has quite strict package hierarchy system that allows naming and grouping things nicely. Why then people keep creating long class names in the first place? I get it that this particular example might be a generated name, but still, why not just create package hierarchy that represents the code properly? Also wouldn't using package hierarchies automatically lead to a bit better design (more modular, more understandable)?
- i386 14y agoRefactoring tools and laziness is my best guess. Eclipse and IDEA can extract methods into new classes and suggest a name for the new class.
- 1010011010 14y agoAh, yes. Java is really just the macro language for Eclipse.
- columbo 14y agoI primarily do java work (consulting) for enterprise. I've always seen it as a combination of convention and time. There are java applications that have been around for decades. I've worked in codebases that are over twenty years old. Some of these systems are responsible for billions of dollars and have been heavily tested (the others are responsible for billions of dollars and have been barely tested). Say you are a consultant, and you're working on a shipping application that has been around since the late 90's and is responsible for moving goods where the sum total of all items in transport over a year is larger than the GDP of Taiwan. In that application there is a Warehouse interface. Simple thing, basically it has a receive() and distribute() method that moves product from one location to another (warehouse.receive(truck) or warehouse.distribute(200,truck)). Around 2000 someone needed to create an edge case because specific warehouses are only available during specific times of the year. Like black Friday to Christmas. Usually it is too much overhead to keep all these warehouses running so they are only open 1/2 the year (this doesn't happen, but work with me). So someone created class TimedWarehouse that will do this calculation (on date X no longer receive). Now it is 2012 and you are just a contractor. The big problem with the TimedWarehouse is at the end of the year you MUST VACATE ALL GOODS (because the warehouse is going to shut down). For the last couple of years product has been lingering in these warehouses keeping them open longer (costing more money). The best way to handle this is perhaps a batch process job that sends emergency shipments as it gets closer to the end of the year. So something that cleans the timed warehouses out. Now you're just a consultant, you can't rework the entire framework but you must keep with convention... what to do TimedWarehouseProcessor (nice... but doesn't indicate that it is only used towards the end of the year) TimedWarehouseYearlyCleanout (makes more sense, but is terribly specific, what about warehouses that are open twice a year) TimedWarehouseCleanoutManagementUtility (Bingo! More generic sounding, and it is a 'utility') Imagine the poor sap who might need to extend that class. The process repeats over time. More contractors following the rules of convention, larger and larger class names.
- SCdF 14y agoYou can find quite a few of these, and every time I see them linked I shake my head in confusion. I don't understand what I'm supposed to take away from this. That there exists in the world badly named Java classes? And? Is the implication here that because you found an example of a clumsily named Java class the entire language is an usuable write-off? Or that it's somehow indicative of all Java applications? I know Java isn't cool, but I don't see what is achieved by staring, pointing and giggling because you found an example of its use that is ungainly.
- 1010011010 14y agoIt is data that fits the "Java is a disease" theory pretty well.
- javajosh 14y agoThis is not a code smell, but something larger, and much worse. Java is fundamentally an imperative language, and these names are evidence of the disconnect between that nature and what people think Java is. One can argue that this is the result of ignorance, that "good" Java programmers will avoid this trap. And yet, for all it's restrictions, it doesn't give much refactoring guidance. The proliferation of patterns (both for creation and relation) in Java is a weakness, not a strength, and the result is monstrosities like this. Training, experience and convention avoids these traps, but why do we create new languages if not to reduce the amount of training, experience and convention that a programmer needs to learn in order to be productive with an environment?
- ww520 14y agoI don't see how this name is a problem beyond giving cannon fodder for language hipsters to rant about Java. How many programmers have been affected by this internal class? How many programmers have used it and complain about it? Java allows long identifier names and gives people the freedom to name however they like. Why is that a bad thing? You want syntax rules in the language to force short identifier names? We had those long while back and it's a really bad idea. And BTW what is so wrong about imperative? It's simple to learn and simple to follow. It has solved many problems, given whatever the real world constraints. Just because functional is the in-thing now doesn't mean imperative is totally bad.
- javajosh 14y ago>And BTW what is so wrong about imperative? Nothing! The problems occur when people think that it's not. And I really disagree with your hipster comment. You can indeed accomplish any task with Java, but that is damning with faint praise. The question is whether or not the environment gives the programmer adequate refactoring pressure to guide his decisions. Java provides almost no such pressure, resulting in a mess. Many problems have been solved in Java despite of this, not because of it.
- ww520 14y ago> Nothing! The problems occur when people think that it's not. I don't really understand what you are trying to get at. Is it wrong or it isn't? The hipster comment is spotted on. This post is evident of that attitude. The OP has to dig up an internal class whose name is probably generated to bash Java. And your original comment basically went further and claimed this long class name is the evident of what is so wrong with Java in general. If there's no pressing pressure to refactor, then it has work well for its purpose. You want to limit class name to 8 characters to force programmers to pick shorter name? It's an internal class, for god sake. What's the impact on 99.99% of the programmer out there? Development is a process of compromise and trade-off. Developers don't have infinite time and infinite budget to code. They have to pick their battle and do the more important things.
- 1010011010 14y agoWhen I saw the title I thought, _that has to be java_. If it had included a "Factory" or "Manager" in there somewhere I would not have needed to look at the link to verify.
- jrockway 14y agoI write classes that are named like "WhateverManager" in Python. Now if you said "Module" or "Builder", then you might be right.
- beambot 14y agoAlmost as good as Microsoft Office's tristate enum with 5 states (three of them not supported), where 0 is False and -1 is True: http://msdn.microsoft.com/en-us/library/aa432714(office.12).aspx http://msdn.microsoft.com/en-us/library/aa432714(office.12)....
- matwood 14y agoObviously tri-state refers to False, True and Not Supported. :)
- gcv 14y agoSir, you owe me a new keyboard.
- mahmud 14y agoSome idiot is probably using booleans in some magic "arithmetic". A collegue once told me returning 1 for truth was handy because he could sum the results after a map, and compare the sum to the count of input elements to see if all succeeded. This only slightly more "handy" than returning TRUE and ANDing the result because you can say "X/N succeeded" (leaving the user to wonder which N-X failed is fine, I guess.)
- pcwalton 14y agoThis is how Visual Basic 6 and below worked; True was -1 and False was 0, so that bitwise and logical operators could be unified.
- astrodust 14y agoPresumably this is because -1 is all bits on in two's complement (http://en.wikipedia.org/wiki/Twos_complement http://en.wikipedia.org/wiki/Twos_complement).
- mudumh 14y agoreally long name!
- drawkbox 14y agoThey should have run it through the class namer: http://www.classnamer.com/ http://www.classnamer.com/
- deleted 14y ago[deleted]
- orangethirty 14y agoI think Javascript also suffers from something like this: functions inside functions inside functions inside functions. If Java is the king (queen?) of horrible naming conventions, Javascript is the prince(ss) of horrible code structure. It might be why both are named Java... var foo = function(foo, bar){ var bar = function ( function (x) { this.something = function (z) { return function (y){}}}}}; //or something like that. Only a fool would think the code above is real or even correct.
- swang 14y agoThere is a name for this: callback hell.
- throwaway64 14y agoMy personal favourite comes from apple AVPlayer *player = <#A configured AVPlayer object#>; CALayer *superlayer = <#Get a CALayer#>; AVPlayerLayer *playerLayer = [AVPlayerLayer playerLayerWithPlayer:player]; [superlayer addSublayer:playerLayer]; https://developer.apple.com/library/ios/#documentation/AVFoundation/Reference/AVPlayerLayer_Class/Reference/Reference.html https://developer.apple.com/library/ios/#documentation/AVFou...
- Evbn 14y agoYes, let's all make fun of Java because it can be used to build (and then name) things we don't know how to make.
- jongalloway2 14y agoI'm pretty sure this was generated by a Hidden Markov Model gone haywire.
- krob 14y agoWow, think they could make that any longer? I mean, I don't think it was long enough. 78 characters isn't long enough, I think it should be at least 96.
- Deestan 14y agoI would go all the way past 140, to prevent people from making fun of it on Twitter.
- dschiptsov 14y agohttp://karma-engineering.com/lab/wiki/Programming http://karma-engineering.com/lab/wiki/Programming
- huskyr 14y agoThis was obviously generated using the Enterprisify your Java Class Names tool: http://projects.haykranen.nl/java/ http://projects.haykranen.nl/java/
- endymi0n 14y agoI think this Class looks okay, but it's definitely still lacking an AbstractProxyInstanceFactoryDecorator.
- bjhoops1 14y agoNot sure whether to laugh or cry about this.
- bjculk 14y agoNever mind the fact that this is in the com.sun package, and as such should never really have to be dealt with. However, I do agree that anyone who makes a class name longer than three or four words is somewhat demented.
- abrkn 14y agocom. sun. java. swing. plaf nimbus, Internal Frame? Internal Frame! Title. Pane... Internal Frame. Title Pane Maximize Button Painter.