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

Extending Business Object

All,
I have an existing business object (VB.Net) which returns user IDs for our
locations in our regions.
One of the properties objReg.Manager returns the manager's user id (integer)
for a given location.

What I'd like to do is implement something similar to .ToString, so I might
call -
objReg.Manager.GetUser()
This would return a User object (which we already have written) representing
the Manager for that ID.
(There's also VP, Director, etc properties.. so this code would be used for
those properties as well)

We already have a objReg.GetManager property which does this, but I think it
would just be snazzier to implement it in the method above.

Does anyone know how I might pull this off -- or even what I would search
for to get me started?
TIA
Brandon.
Jan 11 '06 #1
4 1182
Brandon Miller wrote:
All,
I have an existing business object (VB.Net) which returns user IDs for our
locations in our regions.
One of the properties objReg.Manager returns the manager's user id (integer)
for a given location.

What I'd like to do is implement something similar to .ToString, so I might
call -
objReg.Manager.GetUser()
This would return a User object (which we already have written) representing
the Manager for that ID.
(There's also VP, Director, etc properties.. so this code would be used for
those properties as well)

We already have a objReg.GetManager property which does this, but I think it
would just be snazzier to implement it in the method above.

Does anyone know how I might pull this off -- or even what I would search
for to get me started?
TIA
Brandon.


I may have missed something on what you are looking to do. If you have
the GetManager method that returns the object, what are you looking for
help on?

Chris
Jan 11 '06 #2
Sorry.. I figured I wasn't explaining myself well.
Rather than have a separate method for each of the positions, (VP, Manager,
Director, AsstManager, etc)
I'd like to have a method at the end of each of those properties which
returns the User object for that account ID.
.VP.GetUser()
.Manager.GetUser()
.Director.GetUser()
.AsstManager.GetUser()

The guts of GetUser will be the same for any of those properties.
I just don't know how to make GetUser hook into the existing properties.
I think it would be easier to maintain, more intuitive and of course,
intellisense would kick in, making coding faster. :)

Thanks,
"Chris" <no@spam.com> wrote in message
news:uB**************@tk2msftngp13.phx.gbl...
Brandon Miller wrote:
All,
I have an existing business object (VB.Net) which returns user IDs for
our locations in our regions.
One of the properties objReg.Manager returns the manager's user id
(integer) for a given location.

What I'd like to do is implement something similar to .ToString, so I
might call -
objReg.Manager.GetUser()
This would return a User object (which we already have written)
representing the Manager for that ID.
(There's also VP, Director, etc properties.. so this code would be used
for those properties as well)

We already have a objReg.GetManager property which does this, but I think
it would just be snazzier to implement it in the method above.

Does anyone know how I might pull this off -- or even what I would search
for to get me started?
TIA
Brandon.


I may have missed something on what you are looking to do. If you have
the GetManager method that returns the object, what are you looking for
help on?

Chris

Jan 11 '06 #3


I'm a bit confused about the ToString() reference but the problem as I
understand it is
You have a business object which includes the 4 methods

Function VP() as Integer
Function Manager() as Integer
Function Director() as Integer
Function AsstManager() as Integer

where the integer is a userID.

You wish to be able to obtain more details about the user (basically a
User object)
You cannot just use a x.VP.GetUser() with extending the Integer type
(inherit something from Integer and include a GetUser() function). This
starts off as a dodgy idea and gets worse very quickly (how does this
new type (IntegerX ?) know how to look up a user?

Conceptually cleanest but it depends on the implementation of your
existing business object and how much you can change it, is to change
the existing functions to

Function VP() as User
Function Manager() as User
Function Director() as User
Function AsstManager() as User

where one of the properties on the User is ID() as integer

You then replace all references to .VP or .Manager with .VP.ID or
..Manager.ID, and so on.
If you cannot change the existing business object then you are back to
a more procedural shape of creating a function that takes a UserID and
returns a user object.

If the code for getting the user given the user ID is different for
each user type, well then it depends on how different.
Very different, then you are probably stuck with different functions
for each.
Mostly the same but with some small changes - you can create a class
to encapulate the general functionality which has overridable methods
for the specific sections.

Without more details it is hard to be more specific.
Best bet - if you can change the business object that is returning the
user ids to return users instead then I would go with that one.

hth,
Alan.

Jan 11 '06 #4
Thanks for the info Alan.
I'll be leaving well enough alone. :)
Regards,

<al*******@users.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...


I'm a bit confused about the ToString() reference but the problem as I
understand it is
You have a business object which includes the 4 methods

Function VP() as Integer
Function Manager() as Integer
Function Director() as Integer
Function AsstManager() as Integer

where the integer is a userID.

You wish to be able to obtain more details about the user (basically a
User object)
You cannot just use a x.VP.GetUser() with extending the Integer type
(inherit something from Integer and include a GetUser() function). This
starts off as a dodgy idea and gets worse very quickly (how does this
new type (IntegerX ?) know how to look up a user?

Conceptually cleanest but it depends on the implementation of your
existing business object and how much you can change it, is to change
the existing functions to

Function VP() as User
Function Manager() as User
Function Director() as User
Function AsstManager() as User

where one of the properties on the User is ID() as integer

You then replace all references to .VP or .Manager with .VP.ID or
.Manager.ID, and so on.
If you cannot change the existing business object then you are back to
a more procedural shape of creating a function that takes a UserID and
returns a user object.

If the code for getting the user given the user ID is different for
each user type, well then it depends on how different.
Very different, then you are probably stuck with different functions
for each.
Mostly the same but with some small changes - you can create a class
to encapulate the general functionality which has overridable methods
for the specific sections.

Without more details it is hard to be more specific.
Best bet - if you can change the business object that is returning the
user ids to return users instead then I would go with that one.

hth,
Alan.

Jan 12 '06 #5

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

Similar topics

5
by: Casper B | last post by:
Since I am only able to pass simple beans around using my Web Service framework, I wonder how to incorporate business logic around these beans. My idea was to let my Beans be the base class and...
75
by: David MacQuigg | last post by:
Seems like we need a simple way to extend Python syntax that doesn't break existing syntax or clash with any other syntax in Python, is easy to type, easy to read, and is clearly distinct from the...
17
by: cwdjrxyz | last post by:
Javascript has a very small math function list. However there is no reason that this list can not be extended greatly. Speed is not an issue, unless you nest complicated calculations several levels...
15
by: Tim Jarvis | last post by:
Hi, I have an object that I am binding to a text box, this object exposes a boolean field, and I have implemented a format event handler and a parse event handler for the binding object, where I...
3
by: Flip | last post by:
I'm looking at the O'Reilly Programming C# book and I have a question about extending and combining interfaces syntax. It just looks a bit odd to me, the two syntaxes look identical, but how does...
7
by: A Traveler | last post by:
Hello all, i was just curious if anyone whos been playing with VS2005 could tell me... In javascript (and java??) you can alter the prototypes for an object in your project. I dont remember...
4
by: Ian Richardson | last post by:
Hi, The function I've put together below is a rough idea to extend a SELECT list, starting from: <body> <form name="bambam"> <select id="fred"> <option value="1">1</option> <option...
1
by: Tom C | last post by:
Hi all, In an N-tier app, what is the DOT NET approach for extending an application at all levels (i.e. DAL, Business Object, Client) for a customer or module specific deviation without changing...
0
by: Tim Spens | last post by:
--- On Fri, 6/27/08, Tim Spens <t_spens@yahoo.comwrote: I think I know where the problem is but I'm unsure how to fix it. When I call Register_Handler(...) from python via...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.