Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Program design question...

Hi all,

Just wondering what the recommended design approach is with VBA in
regards to classes versus modules. I come from an OO background and
am used to writing functionality within Classes or if I really bend
the rules, static methods. With VBA there seems to be two choices -
create a Class that contains the functionality I desire or create a
Module that performs the same functionality that can be called
"statically" without instantiating. What is the recommended approach
within VBA..?

For instance, I am writing an automated commentary tool that compares
derived values against various thresholds and then uses these pass/
fail conditions to select predefined pieces of text. These are
assembled in a hierarchy to produce a textual summary of the data. I
can see two ways of doing this in VBA, 1) Create a type that stores
these derived values as they are calculated and then pass the
populated type to a module that extracts the values one by one and
performs the necessary logic to create the commentary, 2) Create a
class, instantiate the class and set each property with the derived
values then call MyClass.Generate() which triggers the class to
perform the same logic to return the commentary. Both approaches seem
correct in the VBA world so I was wondering which is more correct.

Thanks in advance.

Lyndon.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 227
Default Program design question...

I don't believe either approach is "more correct." Go with what works
best for you.

Mark Lincoln

On Jun 25, 11:25 am, Lyndon wrote:
Hi all,

Just wondering what the recommended design approach is with VBA in
regards to classes versus modules. I come from an OO background and
am used to writing functionality within Classes or if I really bend
the rules, static methods. With VBA there seems to be two choices -
create a Class that contains the functionality I desire or create a
Module that performs the same functionality that can be called
"statically" without instantiating. What is the recommended approach
within VBA..?

For instance, I am writing an automated commentary tool that compares
derived values against various thresholds and then uses these pass/
fail conditions to select predefined pieces of text. These are
assembled in a hierarchy to produce a textual summary of the data. I
can see two ways of doing this in VBA, 1) Create a type that stores
these derived values as they are calculated and then pass the
populated type to a module that extracts the values one by one and
performs the necessary logic to create the commentary, 2) Create a
class, instantiate the class and set each property with the derived
values then call MyClass.Generate() which triggers the class to
perform the same logic to return the commentary. Both approaches seem
correct in the VBA world so I was wondering which is more correct.

Thanks in advance.

Lyndon.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Form design question. NDBC Excel Discussion (Misc queries) 0 June 29th 09 01:51 PM
spreadsheet design question jeanette.rimmer New Users to Excel 8 July 17th 05 11:39 AM
Question on design jhahes[_7_] Excel Programming 1 June 11th 05 11:55 PM
Design Question Matt Jensen Excel Programming 0 December 21st 04 05:43 PM
MsgBox execution sends program into design mode Jenn Excel Programming 2 April 14th 04 10:21 PM


All times are GMT +1. The time now is 12:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"