473,554 Members | 3,167 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Abstraction Issue

We have a situation where our adapter (Assembly A) gets data from a
database and gives the data to an internal service (Assembly B) which
then gives it to the client (Assembly C). By the time it reaches
Assembly C, the source information of where the data came from is lost.
In other words, Assembly A knows the data came from the database and
that the data item was called "NUM_OF_PAR TS". Assembly C simply knows
the data as myInfo.ItemCoun t. Now, if Assembly C logs an error, it
will only know to log something like "error processing
myInfo.ItemCoun t". What would be nice is if Assembly C knew where
ItemCount came from and therefore could log something like "error
processing myInfo.ItemCoun t which came from database XYZ, Table 123,
Field "NUM_OF_PAR TS" with SQL of "select * from....".

Any ideas on how to do this? What would be really nice is to inherit
from "int" and then add a source property. But "int" is a value type
and, therefore, is not like an object.

Nov 30 '05 #1
5 1038
What is the class of myInfo (in your example)? Couldn't you put source
information at that level? After all, ItemCount probably wasn't the
only thing that was fetched from that table by that SQL query.

I see where you're going, but I think that the individual property
level is too low a level at which to store the kind of information you
want to keep. As you pointed out, ints can be passed all over the
place, and you certainly don't want to draw a fundamental distinction
between ints that came from the database and those that were calculated
on the fly... that would, I believe, cause you more grief in your code
than losing the information in the first place.

Nov 30 '05 #2
Cody,

Assuming that you have distinct wrappers for your data, why not place an
attribute on the property that is returning the value that you got from the
database? Then, you can use reflection to get the attribute, and then it
would have the information that you need about the database column/table.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Cody" <co*****@yahoo. com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
We have a situation where our adapter (Assembly A) gets data from a
database and gives the data to an internal service (Assembly B) which
then gives it to the client (Assembly C). By the time it reaches
Assembly C, the source information of where the data came from is lost.
In other words, Assembly A knows the data came from the database and
that the data item was called "NUM_OF_PAR TS". Assembly C simply knows
the data as myInfo.ItemCoun t. Now, if Assembly C logs an error, it
will only know to log something like "error processing
myInfo.ItemCoun t". What would be nice is if Assembly C knew where
ItemCount came from and therefore could log something like "error
processing myInfo.ItemCoun t which came from database XYZ, Table 123,
Field "NUM_OF_PAR TS" with SQL of "select * from....".

Any ideas on how to do this? What would be really nice is to inherit
from "int" and then add a source property. But "int" is a value type
and, therefore, is not like an object.

Nov 30 '05 #3
Perhaps Assembly A Could tell Assembly B, and Assembly B could tell Assembly
C.

Then Assembly C can tell two friends. And she can tell 2 friends. And so on.
And so on. And so on.

--
;-),

Kevin Spencer
Microsoft MVP
..Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition

"Cody" <co*****@yahoo. com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
We have a situation where our adapter (Assembly A) gets data from a
database and gives the data to an internal service (Assembly B) which
then gives it to the client (Assembly C). By the time it reaches
Assembly C, the source information of where the data came from is lost.
In other words, Assembly A knows the data came from the database and
that the data item was called "NUM_OF_PAR TS". Assembly C simply knows
the data as myInfo.ItemCoun t. Now, if Assembly C logs an error, it
will only know to log something like "error processing
myInfo.ItemCoun t". What would be nice is if Assembly C knew where
ItemCount came from and therefore could log something like "error
processing myInfo.ItemCoun t which came from database XYZ, Table 123,
Field "NUM_OF_PAR TS" with SQL of "select * from....".

Any ideas on how to do this? What would be really nice is to inherit
from "int" and then add a source property. But "int" is a value type
and, therefore, is not like an object.

Nov 30 '05 #4
This is a good idea. I'm trying to make it so that the developer is
abstracted from seeing or dealing with Source information as much as
possible. Therefore, how could I get something like this working:

logUtility.Log( @"NumOfDie value is not handled by the ToolSetup()
method.", Lot.NumOfDie);

Note how the developer using my framework simply creates the error
message and then passes the property that caused the issue via a
parameter array type arugument.

Dec 1 '05 #5
I like this idea. The only issue is that it's not dynamic therefore
Assembly C needs to have source infomation hard coded as a part of it's
attributes.

Dec 1 '05 #6

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

Similar topics

9
2173
by: Ruby Tuesday | last post by:
Which one is better to do dynamic websites using MySQL? Thanks a.. ADODB, http://php.weblogs.com/ADOdb/ b.. Metabase, http://www.phpclasses.org/browse.html/package/20.html c.. PEAR::DB, http://pear.php.net/manual/en/core.db.php d.. PHPLib database wrappers, http://sourceforge.net/projects/phplib
21
3376
by: ambika | last post by:
Hello, I have a very basic doubt. Why is C called a structured programming language??why structured? C++ is called a Object Oriented language 'cos it obeys the OOP's concepts..Why is C called a structured programming lang?? Thanks to all those who are gonna answer.. -ambika
30
2196
by: Luke Wu | last post by:
Hello, >From spending some time in clc, I've come to realize that C's model of the CPU can be totally different from the atual CPU. Is it safe to say that almost nothing can be gleaned about physical CPU behaviour from C level behaviour. For example:
6
1987
by: Mark Broadbent | last post by:
this might sound like an obvious question but I have found that usually these two evolve at the same time. One of the biggest reasons for creating the abstraction in the first place (in my opinion) is to create a reusable framework that can be applied to similar projects. However I have found that if an abstraction is created first during the...
25
2538
by: Colin McKinnon | last post by:
Hi all, There's lots of DB abstraction layers out there, but a quick look around them hasn't turned up anything which seems to met my requirements. Before I go off and write one I thought I'd ask here if anyone knows of such a beast... I want some code where I present an array of data, and the corresponding primary key and let the code...
2
1815
by: Eric Cathell | last post by:
I am using dOOdads as my persistence layer. I have a business object Person that sits in a Project called DOMAIN I have 2 dOOdads in a project called BLL. one is _Person and is declared MustInherit the other is Person and is my concrete class. My main goal of BLL.Person is to protect custom methods and properties against regeneration.
3
5079
by: S. Lorétan | last post by:
Hi guys, I'm coding an application connected to a database. I have some clients that use this program with 2 or 3 computers, and I use MsSQL Express for them. But if the client needs more computers to be connected to the database, I have to use a standard MsSQL. No problem with that, but I want to be able to switch from a database provider...
1
1665
by: rickycornell | last post by:
Greetings All, On past projects in PHP4 I had always just written my own libraries to deal with database interaction. Somehow I was operating in the dark that there were all these database abstraction things available that made my work on the libraries I made from scratch a waste of time. So now I've started researching all these things...
2
7614
by: subramanian100in | last post by:
Is my following understanding correct ? Data abstraction means providing the interface - that is, the set of functions that can be called by the user of a class. Information hiding means mentioning the class members(functions, typedefs, data) under the access control labels : public, protected, private. Encapsulation means providing...
8
1813
by: Ivan S | last post by:
What are your recommendations for lightweight database abstraction library (Oracle/MySQL)? I prefer OOP. :) Tnx, Ivan.
0
8023
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...
1
7547
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...
0
7879
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...
0
6129
agi2029
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...
1
5426
isladogs
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...
0
5144
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...
0
3548
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...
1
1117
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
828
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...

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.