473,799 Members | 3,229 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(By Val 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 1543
"Simon Woods" <si************ ****@virgin.net schrieb
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(By Val 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.net wrote in
news:##******** ******@TK2MSFTN GP06.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
3152
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 from it. During run time, using a static method, the class creates an instance of the derived class using the Activator class and returns it. This design pattern is very similar to the design pattern applied by the Assembly class. The twist is...
0
1340
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 class(interface) If the delegate points to an interface called implementor you have some classes that implement the interface.
3
2008
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 anywhere... I have simplified my design problem to the following: Consider the following classes:
4
1513
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 Shape. Within class Shape, it has a method called Save to save the object to disk. It's defined in Shape because the logic to save the shapes is uniform across all shapes. Furthermore, let's say I've defined an interface called IDraw that includes
6
4707
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, I've gotten stuck with my first go at OO patterns with Python. I guess it goes without say that some of the stuff that are taken for granted in most of the books (ie. Interfaces, Abstract classes) don't really apply to Python per say, but the idea...
2
1396
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 pattern since I am dealing with EAN13, UPCA12 UPC8 etc. Can someone provide a small sample on how to start. I have looked at the factory implementation online but still can't figure it out. Can someone provide a sample jsut to start with.
6
2082
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 DeviceManager which is only interested in CD/DVD devices. I want to get the list of CD/DVD devices and "be informed when a disc inserted into a device". I am developing this on Linux. So, I used HAL API and read some system (actually /proc) files to gather...
12
1994
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 pattern (make this code to be according to the bridge pattern), and what is the advantage of employing the bridge pattern? It seems "l'art pour l'art" to me. Adrian
8
1635
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 distinguish between different types of customers, for example private, business, other etc. This will allow me to filter customers based on their type. Should I
0
9687
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10251
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10225
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10027
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.