Hi,
I'm writing a data layer for an app my company is developing. I'm thinking
about wrapping up the basic data access object in two decorator objects: one
to provide error checking on parameters, and one to provide generic logging
of exceptions. Is that a good idea or not? It adds some indirection, but at
the same time the code becomes less cluttered. And the decor can even be
"peeled" off at a later time if considered superfluous.
Any thoughts?
--
"If it was so, it might be; and if it were so, it would be; but as it isn't,
it ain't. That's logic" -- Lewis Carroll 1 1710
Hi,
Good question, I believe the answer is "no, not really". It will provide
rudimentary checking only, for instance for null references. There is bound
to be some additional checking in the inner object as well, definitely.
Still, I think it will help a bit.
Regards,
Einar
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote
in message news:eC******** ******@TK2MSFTN GP09.phx.gbl... Hi,
Looks like a good idea overall. However, as for checking parameters for errors, will the decorator always know which values are valid and which
are not?
-- Sincerely, Dmitriy Lapshin [C# / .NET MVP] Bring the power of unit testing to the VS .NET IDE today! http://www.x-unity.net/teststudio.aspx
"Einar Høst" <_e*******@hotm ail.com> wrote in message news:%2******** *******@TK2MSFT NGP11.phx.gbl.. . Hi,
I'm writing a data layer for an app my company is developing. I'm
thinking about wrapping up the basic data access object in two decorator objects: one to provide error checking on parameters, and one to provide generic logging of exceptions. Is that a good idea or not? It adds some indirection, but at the same time the code becomes less cluttered. And the decor can even be "peeled" off at a later time if considered superfluous.
Any thoughts?
-- "If it was so, it might be; and if it were so, it would be; but as it isn't, it ain't. That's logic" -- Lewis Carroll
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tony Marston |
last post by:
For those who you thought my method of implementing OO principles in PHP was
totally wrong - see http://www.tonymarston.co.uk/php-mysql/good-bad-oop.html
for details, you can now read
http://www.tonymarston.co.uk/php-mysql/model-view-controller.html and tell
me why my implementation of the MVC design pattern is totally wrong.
Go on, I dare you. Make my day.
--
Tony (a legend in his own lunchtime) Marston
|
by: bigoxygen |
last post by:
Hi.
I'm using a 3 tier FrontController Design for my web application right
now.
The problem is that I'm finding to have to duplicate a lot of code for
similar functions; for example, listing users, and listing assignments
use similar type commands. Is there a "better" way I can organize my
code?
|
by: Doug |
last post by:
I am looking at using the decorator pattern to create a rudimentary
stored proc generator but am unsure about something. For each class
that identifies a part of the stored proc, what if I want to add a
value dynamically. I'm including some code to show what I mean. This
is real basic on what I want to do:
using System;
namespace ClassLibrary1
{
|
by: Doug |
last post by:
I am looking at using the decorator pattern to create a rudimentary
stored proc generator but am unsure about something. For each class
that identifies a part of the stored proc, what if I want to add a
value dynamically. I'm including some code to show what I mean. This
is real basic on what I want to do:
using System;
namespace ClassLibrary1
{
|
by: Bill44077 |
last post by:
Hi,
I am new to the MVP pattern and one of the main reasons that we are going
this route is because we are doing Scrum with 30 day sprints - so we have a
continually morphing design. We are using TDD as well to improve our ability
to refactor... you probably all know this approach.
Although the user iterface is supposedly one of the last things that you
need to do, this is a web app and we have multiple nested Repeaters on the
page....
| |
by: Gregory |
last post by:
I recently reviewed the decorator pattern in the GOF book and noticed a
problem.
Let look at the example given in the book. For simplicity I removed
intermediate Decorator class.
// Interface class
class VisualComponent
{
public:
VisualComponent();
|
by: George Sakkis |
last post by:
I have a situation where one class can be customized with several
orthogonal options. Currently this is implemented with (multiple)
inheritance but this leads to combinatorial explosion of subclasses as
more orthogonal features are added. Naturally, the decorator pattern
comes to mind (not to be confused with the the Python meaning of
the term "decorator").
However, there is a twist. In the standard decorator pattern, the
decorator...
|
by: Chris Forone |
last post by:
hello group,
is there a possibility to implement the decorator-pattern without
new/delete (nor smartpt)?
if not, how to ensure correct deletion of the objects?
thanks & hand, chris
|
by: proxyuser |
last post by:
The context of this question is actually from the book "C# 3.0 Design
Patterns" (Bishop).
She makes the point that one of the reasons you'd use Decorator is if
you can't change the original component class. On p. 17, she explains
a code example: "...this code deviates from the pattern
laid out...there is no IComponent interface. This is perfectly
acceptable; the decorators can inherit directly from the component and
maintain an...
|
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...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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.
| |