Attempting to make a (sort of) final list of pros and cons for both approaches:
CreateObject() with Set Classlib + Set Procedure
Pro:
- you only need the name of the class and don't care where is it defined
- you don't need to specify any extra parameters when creating it
- if you move a class (from prg to vcx, vcx to prg, vcx to vcx, prg to prg), the createobject() commands don't need to be touched at all
Con:
- you need to maintain the Set Classlib + Set Procedure lists (can be automated, I did that)
- when something goes wrong, you have no clue where the class is defined, unless you got a good output from aStack(); if no error but still need to fix something, only Code References can help you
Newobject() with 2nd parameter
pro:
- no need to maintain Set Classlib + Set Procedure lists
- you can have a class with the same name in a different location and still instantiate it (not that anyone sane would do that)
- when you read code, the location of the classlib is obvious
con:
- you must know where your class is
- if you move a class, all the newobject() calls need to be edited (or you should use a factory)
- you must specify the extra parameters in newobject()
I have probably forgot some... so add.