473,385 Members | 1,622 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.

structures: to use or not to use ?

Hi....

I have the following method in a class library that will be referenced by
the
presentation tier. Is option A or B the preferred way to do this?

Option A:
Public Function SaveProjectInfo(ByVal ProjectID as String, _
ByVal Project Name as String, _
ByVal Type as ProjectType, _
ByVal Priority as PriorityLevel) as Boolean

'Implementation here
End Function

Option B:

Public Structure ProjectInfo
Public ProjectID as String
Public PorjectName as String
Public Type as ProjectType
Public Priority as PriorityLevel
End Structure

Public Function SaveProjectInfo(ByVal Project as ProjectInfo) as Boolean
'Implementation here
End Function
What is the difference in terms of performance (if any) as well as memory
consumption ??

Cheers !
Nov 20 '05 #1
2 968
Tinman,

since you most probably will not save your project settings every
millisecond or so I think the performance factor is negligible in this case.
I'd personally would prefere the second version, since it makes more sense
in the concept of oop and encapsulating.

Just my two cents,

Klaus

"tinman" <dw****@yahoo.com> schrieb im Newsbeitrag
news:Ox*************@tk2msftngp13.phx.gbl...
Hi....

I have the following method in a class library that will be referenced by
the
presentation tier. Is option A or B the preferred way to do this?

Option A:
Public Function SaveProjectInfo(ByVal ProjectID as String, _
ByVal Project Name as String, _
ByVal Type as ProjectType, _
ByVal Priority as PriorityLevel) as Boolean

'Implementation here
End Function

Option B:

Public Structure ProjectInfo
Public ProjectID as String
Public PorjectName as String
Public Type as ProjectType
Public Priority as PriorityLevel
End Structure

Public Function SaveProjectInfo(ByVal Project as ProjectInfo) as Boolean
'Implementation here
End Function
What is the difference in terms of performance (if any) as well as memory
consumption ??

Cheers !

Nov 20 '05 #2
Option C would be an encapsulating class like this :

Public Class ProjectInfo
....

public sub Save()
saving ...
end sub

end Class
"Klaus Löffelmann" <fo***********@loeffelmann.de> a écrit dans le message de
news:u4**************@TK2MSFTNGP09.phx.gbl...
Tinman,

since you most probably will not save your project settings every
millisecond or so I think the performance factor is negligible in this case. I'd personally would prefere the second version, since it makes more sense
in the concept of oop and encapsulating.

Just my two cents,

Klaus

"tinman" <dw****@yahoo.com> schrieb im Newsbeitrag
news:Ox*************@tk2msftngp13.phx.gbl...
Hi....

I have the following method in a class library that will be referenced by the
presentation tier. Is option A or B the preferred way to do this?

Option A:
Public Function SaveProjectInfo(ByVal ProjectID as String, _
ByVal Project Name as String, _
ByVal Type as ProjectType, _
ByVal Priority as PriorityLevel) as Boolean

'Implementation here
End Function

Option B:

Public Structure ProjectInfo
Public ProjectID as String
Public PorjectName as String
Public Type as ProjectType
Public Priority as PriorityLevel
End Structure

Public Function SaveProjectInfo(ByVal Project as ProjectInfo) as Boolean
'Implementation here
End Function
What is the difference in terms of performance (if any) as well as memory consumption ??

Cheers !


Nov 20 '05 #3

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

Similar topics

1
by: kazack | last post by:
Hi all it's me again with another question as I got further in my book. The chapter I am in covers structres, abstract data and classes. I only read through to the end of the coverage on...
33
by: Peter Seaman | last post by:
I understand that structures are value types and arrays and classes are reference types. But what about arrays as members of structures i.e. as in C struct x { int n; int a; }
6
by: Ken Allen | last post by:
OK, I admit that I have been programming since before C++ was invented, and I have developed more than my share of assembly language systems, and even contributed to operating system and compiler...
7
by: John Dann | last post by:
I'm trying to read some binary data from a file created by another program. I know the binary file format but can't change or control the format. The binary data is organised such that it should...
14
by: pmclinn | last post by:
I've noticed that many programmers use classes to store data about such things like: Class Customers .....Phone ....ID ....Address End Class....
2
by: thomasfarrow | last post by:
At work, our development team has a development standards document that insists Structures should never be used. I'm looking to change this standard but need a suitable argument in order to make...
11
by: efrat | last post by:
Hello, I'm planning to use Python in order to teach a DSA (data structures and algorithms) course in an academic institute. If you could help out with the following questions, I'd sure...
44
by: svata | last post by:
Hello, I wonder how to resize such array of structures using realloc()? #include <stdio.h> #include <stdlib.h> #define FIRST 7 typedef struct { char *name;
4
by: cleanrabbit | last post by:
Hello! I hate having to do this, because im almost certain there is someone in the world that has come across this problem and i just havent found their solution yet, so i do appologise if this...
8
by: Bob Altman | last post by:
Hi all, I have a structure that includes a constructor. I want to add a bunch of these structures to an STL map (whose index is an int). If I define the map like this: map<int,...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
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...

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.