Bicycle Repair Man usability

R

Rex Eastbourne

Are there any Bicycle Repair Man users here? I recently got PyDev for
Eclipse, which comes with BRM. I am disappointed with what I've seen,
although I'm not sure if I'm using its full functionality. According to
PyDev's documentation, this is what one can do:

-Rename a function/variable
-Block of code --> method and a method call
-Get rid of extra variables by shifting them inline (e.g.:
a=1;b=2;c=a+b --> c=1+2)

I'm not aware of anything else that can be done, as BRM's documentation
is extremely thin. Is anyone else aware of other uses?

It's a shame this project is not active; it seems like such a great
idea.

Rex
 
S

Sybren Stuvel

Rex Eastbourne enlightened us with:
Are there any Bicycle Repair Man users here?

I am.
I recently got PyDev for Eclipse, which comes with BRM.

I use it from VIM.
I am disappointed with what I've seen, although I'm not sure if I'm
using its full functionality.

Why would it need more functionality?
-Rename a function/variable
-Block of code --> method and a method call

That seems nice to me.
-Get rid of extra variables by shifting them inline (e.g.:
a=1;b=2;c=a+b --> c=1+2)

This is already excess functionality IMO. If you're programming like
this and you want it to be replaced by 'c=1+2', you need to learn how
to properly write software. No tool will help you in that. But hey,
that's just my opinion. And I think it should be 'c=3' anyway ;-)

Sometimes I use constructs as 'a, b = 1, 2' and 'c = a+b', but that's
intensional. In such a case, 'a' and 'b' are settings that easily need
to be edited, and 'c' is just a calculation on them. In such a case, I
don't want to see 'c = 3' in my code.

I use BRM if I need to rename a function or variable, and that's about
it. I do the rest by hand faster than I can figure out how to use
additional software.

Sybren
 
K

Kay Schluehr

Sybren said:
This is already excess functionality IMO.

I don't think that Rex talked about his programming style but about
three and only three refactoring methods survived in BRM from ~30
Fowler described in his book. By the way I can't remember the one you
picked up but I remember the reverse i.e. introducing intermediate
variable names for readability and debugging purposes.

Instead of writing f(g(h(...))) it is sometimes adaequate to write

x = h(...)
f(g(x))

I use this a lot in particular in C++. Optimzing compilers eliminate
runtime penalties. This is of course different in CPython.

In case of BRM I'm not sure why it is particular hard to implement
"Move Method" for instance? BRM is shipped with a lot of testcases
which is good but neither defines requirements nor leads a discussion
about refactoring methods in Python. Needless to say that the code is
not well documented.

Kay
 
F

Fredrik Lundh

Kay said:
Instead of writing f(g(h(...))) it is sometimes adaequate to write

x = h(...)
f(g(x))

I use this a lot in particular in C++. Optimzing compilers eliminate
runtime penalties. This is of course different in CPython.

if "x" is a local variable, the penality isn't that huge:

$ timeit "id(len(str(0)))"
1000000 loops, best of 3: 0.911 usec per loop

$ timeit "x = str(0); id(len(x))"
1000000 loops, best of 3: 0.968 usec per loop

globals are slower:

$ timeit -s "global x" "x = str(0); id(len(x))"
1000000 loops, best of 3: 1.26 usec per loop

</F>
 
P

Peter Maas

Sybren said:
I use BRM if I need to rename a function or variable, and that's about
it. I do the rest by hand faster than I can figure out how to use
additional software.

Sounds like "I can walk from Aachen to Cologne faster than figure
out how to drive a car" ;) I don't know BRM nor any other refactoring
tool but for a thorough decision one would have to know the ratio

time(learningTool)/time(doingByHand)

to calculate the break even point in terms of number(doingByHand).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top