My top-level package is "com.gmail.email.aviersproject". In .aviersproject have a class that holds my main method and a package "summonerdata". In that package I want a class that gets summoner data by screen scraping.

My question is what a good name would be?
I was thinking SummonerDataScreenScraper or SummonerDataScraper but it feels kind of long
(the import statement would be: import com.gmail.email.aviersproject.summonerdata.SummonerDataScreenScraper"..) and someone said I'd be continueing the tradition of bad class names and linked http://projects.haykranen.nl/java/

Since the package is summonerdata should I shorten the class name to "Scraper"? "ScreenScraper"?

Recommended Answers

All 4 Replies

One of my pet peves with Java programmers is their prediliction to create descriptive, but overly-long, class names. You want to use a name that is easy to remember, difficult to mis-type, and as short as possible while meeting the previous two characteristics. What about SumDS? or SumDataScrp?

The more descriptive it is, the easier it is for someone else to understand. In a real-worldenvironment this the most important consideration.

So "SummonerDataScreenScraper" or "SummonerDataScraper" in the package "summonerdata" is ok?
Some people, including rubberman, think it's too long.
And if I were to go with something like "SDScraper" should the D be upper or lower-case? In cases like DVD I thought I'd go with "DvdPlayer.java" and not "DVDPlayer.java" so "SdScraper.java" shoud be no different?

I think they're OK.
The original Sun Code Conventions" are the ones used by the developers of Java itself, and are the basis for most in-house Java standards as well.
http://www.oracle.com/technetwork/java/codeconv-138413.html

They start with these comments that I wish every developer learned by heart...

80% of the lifetime cost of a piece of software goes to maintenance.
Hardly any software is maintained for its whole life by the original author.
Code conventions improve the readability of the software, allowing engineers to understand new code more quickly and thoroughly.

ps For excellent examples of Java code look no further than the Java API itself - massively peer-reviewed, fully tested, huge scope, written by real Java experts for the widest possible audience. You can download a zip of the whole source code from Oracle's site.

For capitalisation of class names including acronyms you see both forms. Mostly using all capitals for the acronyms, but with some exceptions eg HTMLFrameHyperlinkEvent, JPEGHuffmanTable or XMLReaderFactory, but also XmlInlineBinaryData.

Here's a way to look at it:
Imagine your program had been written by someone else a year ot two ago, and they've moved on. Now your boss comes to you and says " they're changing the Summoner screens next week and I want you to update the Java code to match." As you start to look at the com.gmail.email.aviersproject package for the very first time, what kind of package & class names would you most hope to see?

commented: Excellent advice +6
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.