Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Refactoring: Add Fields to Constructor

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
Curtis Posted - Dec 12 2007 : 2:48:50 PM
When a class is first created, there are several things you do right away:

1. create fields
2. create properties
3. add fields to the constructor for initialization

Add a refactoring to a constructor to "Add Fields to Constructor for Initialization". Then let the developer choose the fields from a dialog (list fields with a checkbox beside) and add the fields to the constructor and initialize them to the default value.
6   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Dec 15 2007 : 11:36:33 AM
I have put in a feature request for this to see what the developers make of it:

case=10622
PsiX Posted - Dec 14 2007 : 10:17:44 AM

As was already posted on the other thread and above, it would be nice if VAX could generate the initalizer list even if it can't fill it with meaningful values. Where it can't fill the list, it should leave a comment, but more like this:

X:X(): Base(/* write initializer */), int i(0), void* pPtr(NULL), Complex(/* write initializer */), float(.0f)
{
}



feline Posted - Dec 14 2007 : 10:03:23 AM
Is this not going to make things worse? For a class with 15 member variables you might get a random 7 of them initialized, and then need to add the remaining 8, at the correct points, into the list.
graham.reeds Posted - Dec 14 2007 : 09:35:38 AM
If it can't think of one, do what it does now - not add it.
feline Posted - Dec 13 2007 : 3:15:10 PM
As mwb1100 says, initializing custom types is very hard. What about structures? Variables where the type comes from a #define?
It is easy to produce real world cases that are very hard to have intelligent defaults for.
mwb1100 Posted - Dec 12 2007 : 3:27:23 PM
There was a recent request to have VAX create an initialization list: http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=6859

I like the checkbox idea, and I think that even if VAX cannot reasonably determine what the 'default' value for a field might be, just having the field in the initializer list so that I can fill in the actual initial value would be a nice feature.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000