473,387 Members | 1,561 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Q re Bridge Design Pattern - Abstract Classes vs Interfaces

Hi

I'm just working through (and learning) the standard GoF Design Pattern and
the example of the Bridge pattern on
http://www.dofactory.com/Patterns/Pa...ge.aspx#_self2

I notice at the heart of the real world example is an abstract class

MustInherit Class DataObject
Public MustOverride Sub NextRecord()
Public MustOverride Sub PriorRecord()
Public MustOverride Sub NewRecord(ByVal name As String)
Public MustOverride Sub DeleteRecord(ByVal name As String)
Public MustOverride Sub ShowRecord()
Public MustOverride Sub ShowAllRecords()
End Class

which gets inherited by another class CustomerData which populates itself
with various customers.

I'm wondering why an abstract class is used here rather than an interface.

Could someone help me out pls?

Thanks

Simon
Jul 19 '07 #1
2 1527
"Simon Woods" <si****************@virgin.netschrieb
Hi

I'm just working through (and learning) the standard GoF Design
Pattern and the example of the Bridge pattern on
http://www.dofactory.com/Patterns/Pa...ge.aspx#_self2

I notice at the heart of the real world example is an abstract class

MustInherit Class DataObject
Public MustOverride Sub NextRecord()
Public MustOverride Sub PriorRecord()
Public MustOverride Sub NewRecord(ByVal name As String)
Public MustOverride Sub DeleteRecord(ByVal name As String)
Public MustOverride Sub ShowRecord()
Public MustOverride Sub ShowAllRecords()
End Class

which gets inherited by another class CustomerData which populates
itself with various customers.

I'm wondering why an abstract class is used here rather than an
interface.
I wonder, too (not knowing the book). Maybe the base class will be extended
by "content" in the following chapters? Otherwise, I'd probably choose an
Interface.
Armin

Jul 19 '07 #2
"Simon Woods" <si****************@virgin.netwrote in
news:##**************@TK2MSFTNGP06.phx.gbl:
I'm wondering why an abstract class is used here rather than an
interface.
I guess it gives more flexiblity in the future - you can always extend the
base class with additional features easily (i.e. base implementations).
With an interface, you would need to update the entire project.
Jul 19 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Omer van Kloeten | last post by:
The Top Level Design: The class Base is a factory class with a twist. It uses the Assembly/Type classes to extract all types that inherit from it and add them to the list of types that inherit...
0
by: Tony Johansson | last post by:
Hello Experts! Some information. In a more general form is the handle body principles called the bridge design pattern. In the handle class you have a delegate that points to an pure abstract...
3
by: Merlin | last post by:
Design Problem =============== Would appreciate any help or suggestion on this design issue. I have spent a great deal of time and effort for an elegant solution but it seems I am not getting...
4
by: Rachel Devons | last post by:
All, I'm struggling with an OOP concept. Let me try to define what I'm wanting by using some classic examples. Let's say that I have classes called Square & Circle that derive from class...
6
by: Daniel Santa Cruz | last post by:
Hello all, I've been trying to go over my OO Patterns book, and I decided to try to implement them in Python this time around. I figured this would help me learn the language better. Well,...
2
by: Chris | last post by:
Hi, I have been stuck trying to come up with a design for days. I am working on a small project regarding barcode and I want to implement a factory design. I am now confused. I decided factory...
6
by: Orgun | last post by:
Hi, I sent this message to the moderated c++ group too but it is waiting for moderator approval and I wanted to send here too. I am new to Design Patterns. I want to write a simple...
12
by: Adrian | last post by:
The code below was taken from an example. All the "noise" in the example was thrown out. This is supposedly according to the bridge pattern. What in the code (which lines) represent the bridge...
8
by: =?Utf-8?B?QmVu?= | last post by:
Hi, I have a couple of questions about the proper design of classes. I'll use a simple Customer class for my question. 1) Lets say that I have this Customer class like I said, and I want to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.