• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Design Pattern Question

 
Ranch Hand
Posts: 333
Firefox Browser Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
I have a design pattern question from 804 exam.I searched on Google as well as explored referred head first design pattern book, but didn't found any help.I know pretty enough about interface inheritance and class inheritance, but i am looking explanation in context of design pattern,if anyone knows about it ?

Section 3: Object-Oriented Design Principles

The Java Tutorials do not cover Design Patterns topics. The following references cover design patterns using the Java programming language:

Head First Design Patterns by Elizabeth Freeman, et al
Java Design Pattern Essentials by Tony Bevis

Item 2: Choose between interface inheritance and class inheritance.

 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

ankita modi. wrote:I have a design pattern question from 804 exam.I searched on Google as well as explored referred head first design pattern book, but didn't found any help.I know pretty enough about interface inheritance and class inheritance, but i am looking explanation in context of design pattern,if anyone knows about it ?


Well, assuming that last sentence is your question, then my answer would be: in general, choose interface inheritance.

Why? Here are just a couple of reasons:
1. Class inheritance imposes a lot of restrictions on subclasses and must be designed and documented carefully.
2. In Java, class inheritance is one-to-many (ie, a class can only extend one parent); interface inheritance is many-to-many.

HIH

Winston
 
Enkita mody
Ranch Hand
Posts: 333
Firefox Browser Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you.
 
My, my, aren't you a big fella. Here, have a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic