two words: write tests.
- test the current functionality of one script
- once all tests pass, refactor the code. DO NOT add or change functionality.
- make sure the code passes all tests
keep a copy of all this work. then...
- modify/add tests to represent functionality you expect
- modify your refactored code to pass the tests
show the team the old code, the tests, and the refactored code. presumably, the tests will show things that shouldn't be. then show them the new tests, and the new code that passes all tests.
buy a copy of The Pragmatic Programmer for the office, and encourage teammates to read it.
this is precisely what i've done at my current job, except i'm doing it in ksh. i wrote a test library, and have written test cases (in my spare time) for 1100 lines of ksh. i've successfully refactored the code and passed a full suite of regression tests. i've modified the tests to match expected functionality, and am in the process of modifying the code to pass all tests... all the while making the code more reliable and reusable. and i'm training the team on performing tests and using my test library, so when i leave, they'll continue what i've started.
if all that doesn't work... i'm out of suggestions.
~Particle *accelerates*
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|