Hacker News new | past | comments | ask | show | jobs | submit login
Enterprisify your Java Class Names (haykranen.nl)
80 points by huskyr on Nov 9, 2011 | hide | past | favorite | 42 comments



If you want additional class naming inspiration, just browse the Spring codebase! Some of my favourites:

- SimpleBeanFactoryAwareAspectInstanceFactory

- AbstractInterceptorDrivenBeanDefinitionDecorator

- AbstractInterruptibleBatchPreparedStatementSetter

- SimpleRemoteStatelessSessionProxyFactoryBean

- TransactionAwarePersistenceManagerFactoryProxy

http://static.springsource.org/spring/docs/3.0.x/javadoc-api...


Wow, these names are pure gold! I've added about 30 new terms including classics such as 'Advisor', 'Filter and 'Generic'.


I cannot upvote you enough for that! As a Spring user for several years, I'm now beginning to have class-name-length-creep...impl ack!


My productivity today tanked. I am ROFL. These are amazing.


A related blast from the past: Steve Yegge's "Execution in the Kingdom of Nouns" blog post:

http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom...


Yes. The site on this post seems to be "the word made flesh", though. :-)


To be honest the "before" names look just as Enterprise-y as the "after" names.


I did something similar at http://methodnamer.com/ and also some useless graphs and rants about the long names in Java (http://www.fatvat.co.uk/2011/05/method-names-in-java-develop...)


Pretty cool, but they're not long enough ;)


Change the dropdown to "Spring Framework style"

Gems such as setAspectListenerJobsToNativeIfStatements shall be yours!


That's perfect, just combine it with http://www.classnamer.com/ and later you can even autmate the commit: http://whatthecommit.com/


Want to find the longest class names in a Java codebase? Try this one-liner: https://gist.github.com/338197


I'm on a Spring project, and the devs seem to do all the variables in this superLongVerboseHardToReadStyle.

Most of my work is Python/JavaScript/PHP, and in all three cases, the dev culture is mostly about short, succinct variable names.

So what is it about Java that makes developers tend toward these incredibly verbose variables? It makes it impossible to produce templates with reasonable line lengths sometimes, especially after adding on JSTL directives.


I guess it's twoo things: first, It's a common thing in java to somehow work the role a class plays in a design pattern into the class name, and the second is that variable names often reflect the type (class name), so there you go. Love it, hate it or go out and have some fun...


I think it's mostly a misreading of software best practices. Descriptive does not imply verbose (and vice versa), but many people don't see the distinction.


Java SE / EE, methinks. After a while, a variable that's only 30 characters long feels small and insignificant compared to its type (AbstractThreadsafeSimpleMailTransferProtocolProxyFactoryInterface).


Surely someone here has programmed in Cocoa, right? NSAccessibilityScreenPointForLayoutPointParameterizedAttribute, anyone?


Unfortunately, I work at a place where most of the programmers here use naming conventions like these. I'm pretty sure it's to cover up their lack of ability or maybe they are suffering from dunning-kruger.


>dunning-kruger

This does not mean exactly what you think it means.


your interpretation of my comment is not what you think it means


That's not my fault ;)


Same here, and many times they complain if you give a properly simple name. Oh my.


nice diagnosis, could be pretty likely


Sure, you're laughing now. But somebody you work with is going to find this site and use it in earnest, and before you know it you'll be setting your Eclipse window to automatically open across four monitors in horizontal series just to be able to edit one file at a time.

No parody is so foolish that no fool will ever take it seriously. Take care who you show this to.


My personal record:

    PropertyWithADifferentDefaultValueAlreadyExists
And I've missed to add `Exception` to its end, because that's what it is.


I've found that most of these complex class names are found in the very frameworks which exist to simplify Java development (Spring being the big one), therefore I find myself never having to create a class with a name like this.


But to be fair, unless you are really digging in and extending Spring you don't normally interact with these classes that often. That doesn't make the class names great but for most people Spring provides a lot of functionality and does simplify a lot of tasks.


All developers of these codebases need to do is place some ads on their documentation pages and they'll rake in a fortune from the amount of times people have to load it up to remember a class name.

Symfony2's namespacing is a good one for this too:

    \Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface
    \Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToLocalizedStringTransformer

http://api.symfony.com/2.0/classes.html



Child's play!


Not enterprise enough!


lol


Well, I guess you guys are in a bad mood today.


The culture around here dislikes noise. A post which just says "lol" adds nothing to the discussion, and will likely get downvoted.


I'm quite aware what the culture is like. Frankly, I don't care, I thought the original post was funny, and I said so. It's not that big of a deal if I get downvoted, but honestly, don't you think this type of downvoting is a sign people just might be taking things a bit too seriously?

After all: the original post was a site that made progressively more ridiculous names for Java classes. I could argue that post adds nothing to the discussion in the first place (other than being amusing).


don't you think this type of downvoting is a sign people just might be taking things a bit too seriously?

Put simply no, there are a plethora of other sites that allow humor, many here find them to be too noisy or they keep their humor and one liners to the other sites. I personally like humor but have seen how it can destroy an otherwise great informational site. If it where allowed on HN the quality of HN would be destroyed in less than a years time. I have been around the net a long time, and have seen many come and many go, the common thread among all of the ones that went was the posts became utter garbage. One you loose the post, the high value contributors move on, then the quality of information suffers and provides further fuel for poor comments.

So it may seem that HN is a bunch of sticks in the mud, but remember we have a lot of high value people in this community many of us, helped create the net in the very early days, while others are Vally insiders, yet others are successful product people. HN is one of the most valuable resources in the tech world, to loose that would be a grave loss.

That being said, I agree with you on the quality of this article, I think it speaks volumes about the point I am trying to make.


Fair enough. I can see your point.


We're trying to avoid having pages and pages of such comments, which can drown out real discussion. It's a signal-to-noise issue.


I don't necessarily disagree with you in the grand scheme of things. It's just somewhat hypocritical, in my opinion, to admonish someone for saying "lol" in response to, well, let's face it: a completely ridiculous post.

But fair enough. There are plenty of communities online that I am active in that have their own inconsistencies in how they police themselves (whether through moderation or downvoting). I'm not going to take it too personally.


It's not an admonishment. It doesn't mean people think you're a bad person. It just means that if that's all you have to say, they'd rather you said nothing.


Well, if that's the case - why can't one delete a comment after a certain period of time?


I don't know. I bet it's probably an artifact of the implementation - it may be tied to the fact that you can't edit a post after a certain period of time.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: