I had a problem in my OO Design, the idea
is that i have a DataRepository Class That i want to only inherit from
it speacial methods accourding to the child class, like i want the
Client Class to just inherit GetClientInfo() from the DataReposiotry
Class and the Order Class just inherits GetOrderInfo() and so on
any ideas how to do this, it has been suggest to use facade classes!
would you be able to show how it can be done in a couple of lines of
code for demonostration as i am totally new to Facade Classes or suggest
any other approach!??
Thanks,
Sharing makes us all Better
--
Sent via .NET Newsgroups http://www.dotnetnewsgroups.com 1 1553
Facade classes are interfaces that simplify the actual object by
limiting what you see. (that's just my interpretation. ..I could be
wrong.)
For example, a "StudentRec ord" could have grades, majors, advisors,
gpa, etc. But all that you may want to deal with is "Contact
Information." How would you determine what functions/properties deal
with the "Contact Info." Some people might put prefixes on their
function names, but that only goes so far. My preferred solution for
this a "IContact" interface.
I'm just going to give a quick step by step description... and there is
code snippet below. I used your "DataRepository " and "OrderInfo" as an
example.
1) I would create an "IOrder" interface that has a function called
"GetOrderInfo() ". I would also suggest a function called
"GetOrderFacade ()", which returns an instance of "IOrder".
2) Then have the DataRepository implement that interface.
3) To use the IOrder interface .... just say
orderObj = dataObj.GetOrde rFacade();
orderObj.GetOrd erInfo();
//************** Start Code *************** ******\\
public interface IOrder
{
object GetOrderInfo(); //Change the "object" to your liking.
IOrder GetOrderFacade( );
}
public class DataRepository
: IOrder
{
public object GetOrderInfo()
{
return "Some Order data";
}
public IOrder GetOrderFacade( )
{
return (IOrder)this;
}
}
//************** End Code *************** *******\\
So, whenever you want to deal with the "Order" infromation only, just
use the "GetOrderFacade ()" and it will only return to you functions
related to "Order".
The benefits of this is that it limits the users accessible functions.
A "sales person" can only deal with "orders"... so just return them an
"IOrder" interface :)
Good luck... I hope this helps :)
josh This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: bdinmstig |
last post by:
I am building various framework components for my team to use in
development, and one of those components is a Facade for
reading/writing user preferences.
The idea is that preference settings are stored in a free-format XML
document (in memory for the life of the session) and persisted to a
database (as free text) on exit.
I have taught my developers the basics of XPath, however I don't want
to have to review XMLDOM code all over the...
|
by: bdinmstig |
last post by:
I refined my attempt a little further, and the following code does
seem to work, however it has 2 major problems:
1. Very limited support for XPath features
Basic paths are supported for elements, attributes, ".", and "..",
plus also the "" predicate format is supported -
however, only one predicate per path step is supported, and expr must
be a relative path.
2. Poor performance
|
by: Daniel Kabs |
last post by:
Hello,
loading images or refreshing IFRAME content is done asynchronously in
Javascript. You just assign a value to the src attribute of the object
and you are done. Once loading is finished, the event handler will
inform you. This is wanted behaviour in most situations but sometimes
its just a pain.
Imagine, you have this kind of "call" in a deeply nested function. As it
will return immediately, how do you wait for the result? You...
|
by: FluffyCat |
last post by:
In Febraury - April of 2002 I put together in Java examples of all 23
of the classic "Gang Of Four" design patterns for my website. Partly
I wanted to get a better understanding of those patterns. They are
still online at
http://www.fluffycat.com/java/patterns.html
Since September 2003 I've mainly been using PHP, and now that PHP 5 is
becoming more available I am going to try the same thing I did in Java
with PHP.
|
by: Dave Johnson |
last post by:
I had a problem in my OO Design, the idea
is that i have a DataRepository Class That i want to only inherit from
it speacial methods accourding to the child class, like i want the
Client Class to just inherit GetClientInfo() from the DataReposiotry
Class and the Order Class just inherits GetOrderInfo() and so on
any ideas how to do this, it has been suggest to use facade classes!
would you be able to show how it can be done in a couple...
| |
by: Dave Johnson |
last post by:
I had a problem in my OO Design, the idea
is that i have a DataRepository Class That i want to only inherit from
it speacial methods accourding to the child class, like i want the
Client Class to just inherit GetClientInfo() from the DataReposiotry
Class and the Order Class just inherits GetOrderInfo() and so on
any ideas how to do this, it has been suggest to use facade classes!
would you be able to show how it can be done in a couple...
|
by: anonymous.user0 |
last post by:
I'm a little confused about the Facade pattern. As I understand
it, it's supposed to be a single, simplified interface into a larger
amount of subsystems. The question I have is basically how simple and
interface is it supposed to be? Lets say I've got an application with
multiple layers in differenct projects. I've got a Core project that
contains the core business objects and Managers for those objects.
Managers are responsible for...
|
by: =?Utf-8?B?TWFyaw==?= |
last post by:
Hi...
Tried posting this on Build Controls but then saw that's a pretty slow
group...
Kind of a typical request from product management - they want to be able to
swap in different 3rd party controls depending on their whim and the day. In
this case, they want to support FreeTextBox and Cute Editor interchangably.
I've been trying to put together a container control derived from
|
by: splendid9 |
last post by:
hello all,
i am wrinting unittest for my webservice facade, i could not directly pass the object that i am passing in my original webservice facade in my unit test, so i am trying to create a mock object(class which contains all the properties that are used by my original facade) and pass that into my unit test method, but i dont know how to do that, i mean how to create a mock object uin my unittest and pass that in my unittest method, could...
|
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,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |