473,394 Members | 1,693 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,394 software developers and data experts.

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_PARTS". Assembly C simply knows
the data as myInfo.ItemCount. Now, if Assembly C logs an error, it
will only know to log something like "error processing
myInfo.ItemCount". What would be nice is if Assembly C knew where
ItemCount came from and therefore could log something like "error
processing myInfo.ItemCount which came from database XYZ, Table 123,
Field "NUM_OF_PARTS" 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 1031
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.com

"Cody" <co*****@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.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_PARTS". Assembly C simply knows
the data as myInfo.ItemCount. Now, if Assembly C logs an error, it
will only know to log something like "error processing
myInfo.ItemCount". What would be nice is if Assembly C knew where
ItemCount came from and therefore could log something like "error
processing myInfo.ItemCount which came from database XYZ, Table 123,
Field "NUM_OF_PARTS" 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.googlegr oups.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_PARTS". Assembly C simply knows
the data as myInfo.ItemCount. Now, if Assembly C logs an error, it
will only know to log something like "error processing
myInfo.ItemCount". What would be nice is if Assembly C knew where
ItemCount came from and therefore could log something like "error
processing myInfo.ItemCount which came from database XYZ, Table 123,
Field "NUM_OF_PARTS" 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
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,...
21
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...
30
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...
6
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...
25
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...
2
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...
3
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...
1
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...
2
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...
8
by: Ivan S | last post by:
What are your recommendations for lightweight database abstraction library (Oracle/MySQL)? I prefer OOP. :) Tnx, Ivan.
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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...
0
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...

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.