 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Valence Guest
|
Posted: Tue Feb 21, 2006 2:03 am Post subject: Refactor in C++ |
|
|
How do I refactor in C++? |
|
| Back to top |
|
 |
David Dean Guest
|
Posted: Tue Feb 21, 2006 2:03 am Post subject: Re: Refactor in C++ |
|
|
In article <43fa6aa1$1 (AT) newsgroups (DOT) borland.com>,
"Valence" <notrust (AT) nobody (DOT) com> wrote:
| Quote: | How do I refactor in C++?
|
The rename refactoring is available in the contextual menu when
editing code. Or were you having trouble getting it to work.
--
-David
Nihil curo de ista tua stulta superstitione. |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Feb 21, 2006 9:03 am Post subject: Re: Refactor in C++ |
|
|
"David Dean" <ozchzhq02 (AT) sneakemail (DOT) com> wrote in message
news:ozchzhq02-D4F765.20552320022006 (AT) frylock (DOT) local...
| Quote: | The rename refactoring is available in the contextual menu
when editing code.
|
To expand on that, refactorings are only available in BDS 2006.
Gambit |
|
| Back to top |
|
 |
Valence Guest
|
Posted: Tue Feb 21, 2006 12:03 pm Post subject: Re: Refactor in C++ |
|
|
| Quote: | How do I refactor in C++?
The rename refactoring is available in the contextual menu when
editing code. Or were you having trouble getting it to work.
|
Suppose, in VC2005, code that contains:
int a = 1;
int b = 2;
int c = 3;
int d;
d = a+b+c;
I want to make a new method of the d=a+b+c line. I right click the
selection and it shows me a refactor menu from which I select Extract method
and then I give it a name addem.
It produces a function:
int addem(int a, int b, int c) {
int d;
d = a+b+c;
return d;
}
and it replaces the highlighted code with
d = addem(a,b,c);
Now change the code to:
int a = 1;
int b = 2;
int c = 3;
int d;
int e;
d = addem(a,b,c);
e = d*c -b;
I highlight from "d=" to "b;" and right click and choose Refactor->Extract
method and name the function calcem.
It produces code like:
void calcem(int a, int b, int c, int& d, int& e) {
d = addem(a,b,c);
e = d*c-b;
}
....
int a = 1;
int b = 2;
int c = 3;
int d;
int e;
calcem(a,b,c,d,e);
....
Now I try to do that in C++ Builder 2006(BDS).
But when I highlight code, "Refactor" only contains rename, and that is
grayed out.
So I repeat,
How do I refactor in BDS 2006...
Can I not? >:-{ |
|
| Back to top |
|
 |
Pete Fraser Guest
|
Posted: Tue Feb 21, 2006 1:03 pm Post subject: Re: Refactor in C++ |
|
|
C++ refactoring has a reduced set of refactorings from Delphi
and unfortunately, extract method is one that is missing.
The only refactorings present in BDS2006 are those you can
see unfortunately
HTH Pete
"Valence" <notrust (AT) nobody (DOT) com> wrote in message
news:43faff83$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Now I try to do that in C++ Builder 2006(BDS).
But when I highlight code, "Refactor" only contains rename, and that is
grayed out.
So I repeat,
How do I refactor in BDS 2006...
Can I not? >:-{ |
|
|
| Back to top |
|
 |
Valence Guest
|
Posted: Tue Feb 21, 2006 2:03 pm Post subject: Re: Refactor in C++ |
|
|
Should this be reported as a bug?
"Pete Fraser" <pete.nospam.fraser.nospam (AT) frasersoft (DOT) nospam.net> wrote in
message news:43fb033e$1 (AT) newsgroups (DOT) borland.com...
| Quote: | C++ refactoring has a reduced set of refactorings from Delphi
and unfortunately, extract method is one that is missing.
The only refactorings present in BDS2006 are those you can
see unfortunately
HTH Pete
"Valence" <notrust (AT) nobody (DOT) com> wrote in message
news:43faff83$1 (AT) newsgroups (DOT) borland.com...
Now I try to do that in C++ Builder 2006(BDS).
But when I highlight code, "Refactor" only contains rename, and that is
grayed out.
So I repeat,
How do I refactor in BDS 2006...
Can I not? >:-{
|
|
|
| Back to top |
|
 |
Pete Fraser Guest
|
Posted: Tue Feb 21, 2006 3:03 pm Post subject: Re: Refactor in C++ |
|
|
Not really as it's just a "lack of features".
You could put it in as a request but I think that they already know that.
Rgds Pete
"Valence" <notrust (AT) nobody (DOT) com> wrote in message
news:43fb15b5$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Should this be reported as a bug?
"Pete Fraser" <pete.nospam.fraser.nospam (AT) frasersoft (DOT) nospam.net> wrote in
message news:43fb033e$1 (AT) newsgroups (DOT) borland.com...
C++ refactoring has a reduced set of refactorings from Delphi
and unfortunately, extract method is one that is missing.
The only refactorings present in BDS2006 are those you can
see unfortunately
HTH Pete
"Valence" <notrust (AT) nobody (DOT) com> wrote in message
news:43faff83$1 (AT) newsgroups (DOT) borland.com...
Now I try to do that in C++ Builder 2006(BDS).
But when I highlight code, "Refactor" only contains rename, and that is
grayed out.
So I repeat,
How do I refactor in BDS 2006...
Can I not? >:-{
|
|
|
| Back to top |
|
 |
Valence Guest
|
Posted: Tue Feb 21, 2006 3:03 pm Post subject: Re: Refactor in C++ |
|
|
| Quote: | How do I refactor in C++?
Hmmm, what MS development environment are you using? VS 2005 does not
provide refactoring for C++, only C#. From the doc:
|
Well, now that you make me think about which environment I was using, it was
C#... I was not being picky. So I guess the code for calcem would look more
like
void calcem(int a, int b, int c, out int d, out int e)
I appreciate the definition, but lets not make the mistake of claiming that
C++ Builder supports refactoring when it doesn't completely support it.
Maybe it supports limited Refactoring then.  |
|
| Back to top |
|
 |
Arnie Guest
|
Posted: Tue Feb 21, 2006 3:03 pm Post subject: Re: Refactor in C++ |
|
|
"Valence" <notrust (AT) nobody (DOT) com> wrote in message
news:43faff83$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
How do I refactor in C++?
Suppose, in VC2005, code that contains:
int a = 1;
int b = 2;
int c = 3;
int d;
d = a+b+c;
I want to make a new method of the d=a+b+c line. I right click
the selection and it shows me a refactor menu from which I
select Extract method and then I give it a name addem.
It produces a function:
int addem(int a, int b, int c) {
int d;
d = a+b+c;
return d;
}
and it replaces the highlighted code with
d = addem(a,b,c);
|
Hmmm, what MS development environment are you using? VS 2005
does not provide refactoring for C++, only C#. From the doc:
Refactoring is the process of improving your code after it has
been written by changing the internal structure of the code
without changing the external behavior of the code.
Visual C# provides the following refactoring commands on the
Refactoring menu:
a.. Extract Method
b.. Rename
c.. Encapsulate Field
d.. Extract Interface
e.. Promote Local Variable to Parameter
f.. Remove Parameters
g.. Reorder Parameters
- Arnie |
|
| Back to top |
|
 |
David Dean Guest
|
Posted: Tue Feb 21, 2006 4:03 pm Post subject: Re: Refactor in C++ |
|
|
In article <43faff83$1 (AT) newsgroups (DOT) borland.com>,
"Valence" <notrust (AT) nobody (DOT) com> wrote:
| Quote: | Now I try to do that in C++ Builder 2006(BDS).
But when I highlight code, "Refactor" only contains rename, and that is
grayed out.
|
Rename shouldn't be grayed out when you have a single variable
selected.
--
-David
Nihil curo de ista tua stulta superstitione. |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Feb 21, 2006 7:03 pm Post subject: Re: Refactor in C++ |
|
|
"Valence" <notrust (AT) nobody (DOT) com> wrote in message
news:43faff83$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Now I try to do that in C++ Builder 2006(BDS).
But when I highlight code, "Refactor" only contains
rename, and that is grayed out.
|
"Rename" is the only refactoring that Borland has implemented for C++ at
this point in time.
| Quote: | How do I refactor in BDS 2006...
|
You don't.
Gambit |
|
| Back to top |
|
 |
Alisdair Meredith[TeamB] Guest
|
Posted: Wed Feb 22, 2006 12:03 am Post subject: Re: Refactor in C++ |
|
|
Valence wrote:
| Quote: | I appreciate the definition, but lets not make the mistake of
claiming that C++ Builder supports refactoring when it doesn't
completely support it.
Maybe it supports limited Refactoring then.
|
"limitted" refactoring?
What would "unlimitted" refactoring be then?
Or complete support?
Martin Fowler's refactoring catalog started with around 50 standard
refactorings, and the number has been steadily growing since.
http://www.refactoring.com/catalog/index.html
BCB2006 has started supprt for refactoring, and we can only hope the
number of supported refactorings grows. However, manipulating C++
source is notoriously subtle - tricky and error prone compared to other
languages, and that is before you allow for the preprocessor! While I
expect the number to grow over time, I doubt it will ever rival Delphi,
C#, Java or even Smalltalk in this regard.
--
AlisdairM(TeamB) |
|
| Back to top |
|
 |
Pete Fraser Guest
|
Posted: Wed Feb 22, 2006 10:03 am Post subject: Re: Refactor in C++ |
|
|
Alisdair, did you get my email or did it go to the great spam locker in the
sky?
Rgds Pete
"Alisdair Meredith[TeamB]"
<alisdair.meredith@no-spam-splease (AT) uk (DOT) renaultf1.com> wrote in message
news:43fb9fb8 (AT) newsgroups (DOT) borland.com... |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|