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

Make the object smart, or the collection manager?

I'm designing a C# app with Security and Portfolio objects. The goal is
to value all the Securities in the Portfolio. There are four security
types, and each is valued a different way, but all use the same
Portfolio level market data for valuation. For each security, data is
passed to a 3rd party assembly which returns a value.

Question: Do I put the Value method in the Security or the Portfolio
object? The app should be multithreaded.

I know this is more a generic OOP Q, but i know the gurus here could
offer some sage advice.

Thanks,

Burt

Nov 7 '06 #1
3 1516
VJ
Portfolio is a collection of securities. You would put the value method in
security that computes value of each security, then a aggregator method in
the collection class that basically loops the items and calculates/add them
to a single value. You also never mentioned whether these objects are UI or
non-UI. The reason I ask is because in multi-threaded applications, you have
to be careful about cross-communication between threads. So you could
consider this point to decide where to keep the value method

VJ

"Burt" <bu*******@yahoo.comwrote in message
news:11*********************@h54g2000cwb.googlegro ups.com...
I'm designing a C# app with Security and Portfolio objects. The goal is
to value all the Securities in the Portfolio. There are four security
types, and each is valued a different way, but all use the same
Portfolio level market data for valuation. For each security, data is
passed to a 3rd party assembly which returns a value.

Question: Do I put the Value method in the Security or the Portfolio
object? The app should be multithreaded.

I know this is more a generic OOP Q, but i know the gurus here could
offer some sage advice.

Thanks,

Burt

Nov 8 '06 #2
There is a client side Windows GUI, but the valuations will happen on
an non-UI dll on the server. The 3rd party assembly is not thread safe-
have to create a new instance with each deal. I'll keep analyzing this.
Thanks again.

Burt


VJ wrote:
Portfolio is a collection of securities. You would put the value method in
security that computes value of each security, then a aggregator method in
the collection class that basically loops the items and calculates/add them
to a single value. You also never mentioned whether these objects are UI or
non-UI. The reason I ask is because in multi-threaded applications, you have
to be careful about cross-communication between threads. So you could
consider this point to decide where to keep the value method

VJ

"Burt" <bu*******@yahoo.comwrote in message
news:11*********************@h54g2000cwb.googlegro ups.com...
I'm designing a C# app with Security and Portfolio objects. The goal is
to value all the Securities in the Portfolio. There are four security
types, and each is valued a different way, but all use the same
Portfolio level market data for valuation. For each security, data is
passed to a 3rd party assembly which returns a value.

Question: Do I put the Value method in the Security or the Portfolio
object? The app should be multithreaded.

I know this is more a generic OOP Q, but i know the gurus here could
offer some sage advice.

Thanks,

Burt
Nov 8 '06 #3
Slightly off topic, and bear in mind I'm not entirely sure of the scope
of your application, but it might be worth considering issues like
weighted values, i.e. what percent of the portfolio's value is
represented by a particular security. From a design perspective it
means either the security has to know about its portfolio (bad imo), or
the portfolio has to calculate that percentage.

On topic, you might want to consider a valuation class which can
coordinate the valuation of the assets in the portfolio, This would
also resolves the issue above. Just a thought.


Burt wrote:
There is a client side Windows GUI, but the valuations will happen on
an non-UI dll on the server. The 3rd party assembly is not thread safe-
have to create a new instance with each deal. I'll keep analyzing this.
Thanks again.

Burt


VJ wrote:
Portfolio is a collection of securities. You would put the value method in
security that computes value of each security, then a aggregator method in
the collection class that basically loops the items and calculates/add them
to a single value. You also never mentioned whether these objects are UI or
non-UI. The reason I ask is because in multi-threaded applications, you have
to be careful about cross-communication between threads. So you could
consider this point to decide where to keep the value method

VJ

"Burt" <bu*******@yahoo.comwrote in message
news:11*********************@h54g2000cwb.googlegro ups.com...
I'm designing a C# app with Security and Portfolio objects. The goal is
to value all the Securities in the Portfolio. There are four security
types, and each is valued a different way, but all use the same
Portfolio level market data for valuation. For each security, data is
passed to a 3rd party assembly which returns a value.
>
Question: Do I put the Value method in the Security or the Portfolio
object? The app should be multithreaded.
>
I know this is more a generic OOP Q, but i know the gurus here could
offer some sage advice.
>
Thanks,
>
Burt
>
Nov 8 '06 #4

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

Similar topics

1
by: Egghead | last post by:
Hi all, I'm just wondering that is any way to dispose all objects when my app is shut down? I mean I can use for.. next loop to unload all loaded form when I shut down my app. Thank you, ...
4
by: m. pollack. | last post by:
Hi all, Is there any information to be had about the "Object Collection Editor" that appears when you click on a collection property in the PropertyGrid control? I have a class that maintains a...
7
by: kon george | last post by:
Can somebody assist. I build this code on a dev laptop and copied across the entire code to a Windows 2003 server with 1.1 framework. It is basic ASP.NE T that uses web service for SQL Server...
5
by: Audrius | last post by:
Hello, what is the best solution to hold the collection of Objects. Lets say I have such class: class Task{ private: CString title; CString description; CString owner;
1
by: bw | last post by:
I have a basic custom collection that throws a new exception if the item(key) is not found in the collection. This is used as part of a calling function. It all works correctly, the problem...
6
by: npaulus | last post by:
Hi, DataSets are usually resource heavy. Instead of having to pass them from my middle tier to my presentation layer I was wondering if anyone has developed a custom collection object that is...
0
by: richsonn | last post by:
We are using an out-of-process COM object--created with HttpContext.Current.Server.CreateObject("Class.object")--in an VB/ASP.NET 1.x application. The COM object releases a-ok when we use...
4
by: KuhlmannSascha | last post by:
Hi, i tried now for several hours to read through a win32com API to access Itunes and read out myplaylists. First of all the Code: import os, sys, pythoncom, win32com.client, pywintypes,...
3
by: H. S. Lahman | last post by:
Responding to siddharthkhare... Ignore Topmind and frebe. They are anti-OO P/R guys. Let's not confuse things with specific 3GL syntax. At the OOA/D level the model looks like: | 1
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
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,...
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...

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.