structures: to use or not to use ?

  • Thread starter Thread starter tinman
  • Start date Start date
T

tinman

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 !
 
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
 
Option C would be an encapsulating class like this :

Public Class ProjectInfo
....

public sub Save()
saving ...
end sub

end Class
 
Back
Top