I'm giving a presentation on refactoring Python. I'd like to put in a couple of slides giving statistics to show that refactoring is a good thing. I've been searching the ACM digital library, but it's a bit like looking for a needle in a haystack. Does anyone know of any statistics on the subject of refactoring in regards to productiv...
My newbie solution to Project Euler #1
+/((0=3|1+i.1000-1) +. (0=5|1+i.1000-1)) * (1+i.1000-1)
I know that this can be refactored, and transformed into a function, i don't know how to do it, and I would have to read all the labs to learn it.
...
Here is a different approach for the Project Euler #1 solution:
+/~.(3*i.>.1000%3),5*i.>.1000%5
How to refactor it?
...
Are there any empirical studies that show the impact of refactoring (or lack of refactoring) on a development team's productivity?
(NOTE: I'm only looking for empirical data--From my own experience, I personally know that refactoring works, but I was wondering if there was some hard data to back that claim).
...
Hi,
Our development shop is conducting a seminar in a local college to encourage clean code (the standards are from the eponymous book) and best practices. Now we need references for the time and effort saved. Has anybody read studies about it?
Thanks,
Jon
...
I have a project that I am building that I have to change a method to behave slightly different. I have several unit tests already built against that method, but I will need to add more to cover the new behavior I am going to add to it. Is it good form to change/add those tests first before making the code change, or do you change your c...
I'm refactoring some code and found this (simplified of course, but general idea):
class Variable:
def __init__(self):
self.__constraints = []
def addConstraint(self, c):
self.__constraints.append(c)
class Constraint:
def __init__(self, variables):
for v in variables:
v.addConstraint(sel...
Thanks for checking. All helpful answers/comments are up voted.
I have the following code, which does the job, but imo is not efficient. The reason I think it's not efficient is because I'm using fetchAll + loop even though I know that the query will return either 1 or no records.
//assume the usual new PDO, binding, and execute are up ...
We are currently planning a quality improvement exercise and i would like to target the most commonly edited files in our clearcase vobs. Since we have just been through a bug fixing phase the most commonly edited files should give a good indication of where the most bug prone code is, and therefore the most in need of quality improvment...
I have an object called Parameters that gets tossed from method to method down and up the call tree, across package boundaries. It has about fifty state variables. Each method might use one or two variables to control its output.
I think this is a bad idea, beacuse I can't easily see what a method needs to function, or even what might h...
Contrary to a 'normal' svn directory structure I'm using the following structure:
trunk/
project1/
project2/
project3/
...
branches/
project1-branch/
project1/
project2/
...
project2-branch/
project1/
project2/
...
tags/
project1/
V1
V2
...
As you see I don't have separate triples (tr...
Implementing agile in projects requires the ability to do refactoring. It is not really a must, but code refactoring has proven to be a good engineering practice.
In an agile (Scrum) project on the iSeries platform, which requires development (new code and modifications to legacy code) in RPG, RPG LE, is it possible to implement refacto...
Hi all. A popular software development pattern seems to be:
Thrash out the logic and algorithms in Python.
Profile to find out where the slow bits are.
Replace those with C.
Ship code that is the best trade-off between high-level and speedy.
I say popular simply because I've seen people talk about it as being a great idea.
But are t...
This code lets me display/hide a custom message msg_one msg_two msg_three when the appropriate div is hovered/unhovered over. The appropriate message is injected into the #screen div and show/hide is then applied. The code is almost identical except for the first 2 lines #one vs #two vs #three and the message being displayed msg_one msg_...
What tools can I use to find duplicate code that is a good candiate for refactoring?
Update:
Any language, any IDE.
...
Is there a way to specify common elements for object literals in an array?
For example:
var array = [ {key: "hi", label: "Hi", formatter:deleteCheckboxFormatter},
{key: "hello", label: "Hello", formatter:deleteCheckboxFormatter},
{key: "wut", label: "What?", formatter:deleteCheckboxFormatter}];
All three r...
Is there a cleaner way to write the same css given that input name f1 to f7 are all type=text like the first line?
Thanks
#tform input[type="text"] { -moz-border-radius:6px; border: 1px solid green; }
#tform input[name="f1"],
#tform input[name="f2"],
#tform input[name="f3"],
#tform input[name="f4"],
#tform input[name="f5"] { width...
I'm trying to improve my jquery/javascript syntax. Is there a better way to write this?
if (ok)
var mymsg = '<p id="ok-box">'
+ "You're good to go"
+ '</p>';
}else {
var mymsg = '<p id="not-ok-box">'
+ "Error"
+ '</p>';
}
I was thinking if jquery/javascript had a similar syntax to the following PHP syntax, ...
I have some JSP code, which writes a tree representing hierachical data. This data is represented using nested layers.
In the JSP code there are many code snippets similar to the following code (which outputs as many closing div tags as is the numerical value of variable differenceAmount):
<jsp:scriptlet>
int differenceAmount = pr...
I need to rename a large number of CSS elements in both the CSS file in which they are defined as well as in multiple HTML files in which they are used.
What's the best way to do this on Windows?
...