Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

UML question: aren't dotted lines only used for for "implements"?

 
T Vergilio
Ranch Hand
Posts: 230
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I'm studying for my SCJA using McKenzie's book, and I just came across something strange. On page 163, the Full Shapes Class Diagram shows the relationship between Line and Shape using a dotted line (and it uses a dotted line again to represent the relationship between Point and Shape).

However, the "UML for the Java Associate" document that I downloaded from this forum (by the same authors who did Head First Java), says that dotted lines are used when a class implements an interface. It means "implements" rather than "extends".

If you look at the code for Line and Point in McKenzie's book, a few pages before, they clearly "extend" Shape, they don't "implement" it.

Is this a mistake in the book? Or is there another explanation for it?

Thank you for your help!
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmmm...Let me check that.

Indeed, Shape is an interface, and classes always implement interfaces, whereas only interfaces can extend interfaces.
 
T Vergilio
Ranch Hand
Posts: 230
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Cameron. At that point in the book, though, Shape is still a class, right? So shall I just replace the dotted line with a solid line?

Thank you very much for your help, I've only just started learning Java and everything is still pretty new to me. Just wanted to make sure I got it right.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic