Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Poor Naming Conventions

 
See Furst
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok.. So I got two classes...and they got the same (ok similar) name.

com.thing.mine.package.Item
com.otherthing.mine.package.Item

I need both. Do I really have to explicitly call both?




Is there like a typedef call like in C++ that can help with this?

like:

 
Rob Spoor
Sheriff
Pie
Posts: 20665
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can import one; that already decreases your problem by half.

You cannot typedef a class, but perhaps it's possible to subclass it. It's not really good design to create a class just to rename another though.
 
See Furst
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:You can import one; that already decreases your problem by half.



And how would I import the other? I guess subclass it.. or abstract it?

Of course the obvious answer is use better names but.. unfortunately .. I'm stuck..

I'm taking the subclass route, now that you mention it. It's.. sloppy.. I know.. but... Java could use a typedef kind of keyword. It screams for it. Especially with all these frameworks using common name like "Node", "Item", "Session" jcr is completely built like that.. and that's a Java spec...

Didn't look around too much did they..

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic