New to MFC and have a few questions.
-
- I know how to use the Add Member Variable Wizard to create a variable and associate it with a control, but how do you remove it? Currently I am forced to manually track down every reference to the variable in the code and remove it. A principle of good desing is that when ever you include an operation you should also include its opposite. If I can add the variable automatically I should also be able to remove or rename it automatically. So I am assuming that editing the source code is not the best method of removing a variable. Is there an Remove Member Variable Wizzard or something similar? 2) UpdateDate(TRUE/FALSE) WTF????? Was someone on crack when they came up with this. I just got done reading Code Complete published by Microsoft Press and this function violates just about every principle of good design. Specifically. a) Each function should have a single well defined purpose. UpdateData() is cleary two separate operations, UpDateData() and UpdateControls() shoved into the same function. b) The Function Name Should acurately describe everything the function does. A correct name would be UpdateDataOrUdateControls(); This is an ugly name but its an ugly function. c) Well written code is self documenting. UpdateData() and UpdateControls() have straight forward meanings. What does UpdateData(FALSE) mean. What was their reasoning? Am I missing something?
-
- I know how to use the Add Member Variable Wizard to create a variable and associate it with a control, but how do you remove it? Currently I am forced to manually track down every reference to the variable in the code and remove it. A principle of good desing is that when ever you include an operation you should also include its opposite. If I can add the variable automatically I should also be able to remove or rename it automatically. So I am assuming that editing the source code is not the best method of removing a variable. Is there an Remove Member Variable Wizzard or something similar? 2) UpdateDate(TRUE/FALSE) WTF????? Was someone on crack when they came up with this. I just got done reading Code Complete published by Microsoft Press and this function violates just about every principle of good design. Specifically. a) Each function should have a single well defined purpose. UpdateData() is cleary two separate operations, UpDateData() and UpdateControls() shoved into the same function. b) The Function Name Should acurately describe everything the function does. A correct name would be UpdateDataOrUdateControls(); This is an ugly name but its an ugly function. c) Well written code is self documenting. UpdateData() and UpdateControls() have straight forward meanings. What does UpdateData(FALSE) mean. What was their reasoning? Am I missing something?
Raskolnikov wrote: Is there an Remove Member Variable Wizzard or something similar? What version of VC aare you using? 6 or 7? I know with with VC6 you can use the class wizzard and select the variables tab you can delete your variables there. If you added a member variable your self you can use the class window. Right click and select delete. Raskolnikov wrote: c) Well written code is self documenting. UpdateData() and UpdateControls() have straight forward meanings. What does UpdateData(FALSE) mean. What was their reasoning? Am I missing something? Um, did they have any reasoning with that? :laugh: From my experience, it's best to not even bother with UpdateData() and just use control variables. It's just to much of a hassle IMO . Here's a good link that will explain better than what I could do. http://www.codeproject.com/cpp/avoidupdatedata.asp[^] Cheers :)
-
- I know how to use the Add Member Variable Wizard to create a variable and associate it with a control, but how do you remove it? Currently I am forced to manually track down every reference to the variable in the code and remove it. A principle of good desing is that when ever you include an operation you should also include its opposite. If I can add the variable automatically I should also be able to remove or rename it automatically. So I am assuming that editing the source code is not the best method of removing a variable. Is there an Remove Member Variable Wizzard or something similar? 2) UpdateDate(TRUE/FALSE) WTF????? Was someone on crack when they came up with this. I just got done reading Code Complete published by Microsoft Press and this function violates just about every principle of good design. Specifically. a) Each function should have a single well defined purpose. UpdateData() is cleary two separate operations, UpDateData() and UpdateControls() shoved into the same function. b) The Function Name Should acurately describe everything the function does. A correct name would be UpdateDataOrUdateControls(); This is an ugly name but its an ugly function. c) Well written code is self documenting. UpdateData() and UpdateControls() have straight forward meanings. What does UpdateData(FALSE) mean. What was their reasoning? Am I missing something?
Raskolnikov wrote: 2) UpdateDate(TRUE/FALSE) WTF????? Raskolnikov wrote: What was their reasoning? Am I missing something? Nope, MFC sucks hairy donkey balls. But, it used to be worse... And it's still better than nothing. (although you may want to give this new WTL thing a look; i've heard it sucks less)
---
Shog9 If I could sleep forever, I could forget about everything...
-
- I know how to use the Add Member Variable Wizard to create a variable and associate it with a control, but how do you remove it? Currently I am forced to manually track down every reference to the variable in the code and remove it. A principle of good desing is that when ever you include an operation you should also include its opposite. If I can add the variable automatically I should also be able to remove or rename it automatically. So I am assuming that editing the source code is not the best method of removing a variable. Is there an Remove Member Variable Wizzard or something similar? 2) UpdateDate(TRUE/FALSE) WTF????? Was someone on crack when they came up with this. I just got done reading Code Complete published by Microsoft Press and this function violates just about every principle of good design. Specifically. a) Each function should have a single well defined purpose. UpdateData() is cleary two separate operations, UpDateData() and UpdateControls() shoved into the same function. b) The Function Name Should acurately describe everything the function does. A correct name would be UpdateDataOrUdateControls(); This is an ugly name but its an ugly function. c) Well written code is self documenting. UpdateData() and UpdateControls() have straight forward meanings. What does UpdateData(FALSE) mean. What was their reasoning? Am I missing something?
- You should in any case learn to add and remove your own member variables. The wizard blows up from time to time, and if that is when you start trying to learn how to do things by hand, you'll be stuffed. 2) UpdateData is a screwy mechanism, as has been said. Do not use it. Christian We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
-
Raskolnikov wrote: Is there an Remove Member Variable Wizzard or something similar? What version of VC aare you using? 6 or 7? I know with with VC6 you can use the class wizzard and select the variables tab you can delete your variables there. If you added a member variable your self you can use the class window. Right click and select delete. Raskolnikov wrote: c) Well written code is self documenting. UpdateData() and UpdateControls() have straight forward meanings. What does UpdateData(FALSE) mean. What was their reasoning? Am I missing something? Um, did they have any reasoning with that? :laugh: From my experience, it's best to not even bother with UpdateData() and just use control variables. It's just to much of a hassle IMO . Here's a good link that will explain better than what I could do. http://www.codeproject.com/cpp/avoidupdatedata.asp[^] Cheers :)
Thanks, I will definately read that article.
-
Raskolnikov wrote: 2) UpdateDate(TRUE/FALSE) WTF????? Raskolnikov wrote: What was their reasoning? Am I missing something? Nope, MFC sucks hairy donkey balls. But, it used to be worse... And it's still better than nothing. (although you may want to give this new WTL thing a look; i've heard it sucks less)
---
Shog9 If I could sleep forever, I could forget about everything...
What is WTL, I might have to add it to my list of things to learn.
-
What is WTL, I might have to add it to my list of things to learn.
http://www.codeproject.com/wtl/
---
Shog9 If I could sleep forever, I could forget about everything...
-
- You should in any case learn to add and remove your own member variables. The wizard blows up from time to time, and if that is when you start trying to learn how to do things by hand, you'll be stuffed. 2) UpdateData is a screwy mechanism, as has been said. Do not use it. Christian We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
I already fluent in C++ so manually adding and removing member variables is no problem, I was just looking for a more elegant solution. I will definately heed the warning about avoiding UpdataData. I think what happens with serialized API is all the bad design choices get propagated from one version to the next.
-
- I know how to use the Add Member Variable Wizard to create a variable and associate it with a control, but how do you remove it? Currently I am forced to manually track down every reference to the variable in the code and remove it. A principle of good desing is that when ever you include an operation you should also include its opposite. If I can add the variable automatically I should also be able to remove or rename it automatically. So I am assuming that editing the source code is not the best method of removing a variable. Is there an Remove Member Variable Wizzard or something similar? 2) UpdateDate(TRUE/FALSE) WTF????? Was someone on crack when they came up with this. I just got done reading Code Complete published by Microsoft Press and this function violates just about every principle of good design. Specifically. a) Each function should have a single well defined purpose. UpdateData() is cleary two separate operations, UpDateData() and UpdateControls() shoved into the same function. b) The Function Name Should acurately describe everything the function does. A correct name would be UpdateDataOrUdateControls(); This is an ugly name but its an ugly function. c) Well written code is self documenting. UpdateData() and UpdateControls() have straight forward meanings. What does UpdateData(FALSE) mean. What was their reasoning? Am I missing something?
Any one know how to get to the "variables tab" in VC 7. The class wizard has gone missing and I want to be able to quickly delete (or better yet rename) misspelled variable without mucking with the source code.