Re: Refactoring and Dynamic Analysis

John Carter <[email protected]> Mon, 25 Nov 2013 10:30:43 +1300
Newsgroups gmane.comp.programming.refactoring
Message-ID <CAFD1m3GSKxuD0_B8Gf3goA8eJ1-F94TYVz4WLBu9aHku3ttmAA@mail.gmail.com>
--047d7b5d2ea4e83e4f04ebf2f634
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I haven't seen any academic papers on the subject, but I can related a
couple of examples from industry....

* Leak analysis. In a Domain Specific Language Interpretor I wrote, I had a
memory leak. Tracing the leak (annotating the malloc and free calls)
resulted in me rethinking the ownership policies for the heap allocated
strings created by lexical analysis.

* Evaluation Order. In the evaluation of a very complex recursively defined
formula, it was suggested I used memoization to speed it up. This did
indeed work. However, having done the work to add memoization I also logged
the order in which things we evaluated (after memoization). Analysis of
this revealed a simple, direct order of evaluation that simplified the code
immensely, and gained massive performance boost _without_ the need for
memoization.

* JIT compilers. (For example java and valgrind) are effectively
refactorings after dynamic analysis.

* Profiling - Optimization is often presented as a trade off between clean
straight forward code and complexity. Yet my experience has often (but not
always) been the opposite. Often profiling hotspots are the consequences of
very bad design decisions. Often the act of profiling a code base that
hasn't been profiled for a long time reveals code stenches, which when
removed results in cleaner faster code. The rule "No code is faster than no
code" is very applicable.



On Sat, Nov 23, 2013 at 5:33 AM, swati kumar <[email protected]> wrote:

>
>
> Namaskar,
>
> I am Swati. A Master of Technology student from India. I am doing my
> dissertation on Code smells and Refactoring.
>
> I am not able to find work done in refactoring using dynamic analysis or
> dynamic metrics.
>
> Please suggest me some work done in this direction.
>
> Thanking You!!!
>
>=20=20
>



--=20
John Carter
Phone : (64)(3) 358 6639
Tait Electronics
PO Box 1645 Christchurch
New Zealand

--=20

------------------------------
This email, including any attachments, is only for the intended recipient.=
=20
It is subject to copyright, is confidential and may be the subject of legal=
=20
or other privilege, none of which is waived or lost by reason of this=20
transmission.
If you are not an intended recipient, you may not use, disseminate,=20
distribute or reproduce such email, any attachments, or any part thereof.=20
If you have received a message in error, please notify the sender=20
immediately and erase all copies of the message and any attachments.
Unfortunately, we cannot warrant that the email has not been altered or=20
corrupted during transmission nor can we guarantee that any email or any=20
attachments are free from computer viruses or other conditions which may=20
damage or interfere with recipient data, hardware or software. The=20
recipient relies upon its own procedures and assumes all risk of use and of=
=20
opening any attachments.
------------------------------

--047d7b5d2ea4e83e4f04ebf2f634
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable





<head>

<style type=3D"text/css">
<!--

/* start of attachment style */
       .ygrp-photo-title{
         clear: both;
         font-size: smaller;
         height: 15px;
         overflow: hidden;
         text-align: center;
         width: 75px;
       }
       div.ygrp-photo{
         background-position: center;
         background-repeat: no-repeat;
         background-color: white;
         border: 1px solid black;
         height: 62px;
         width: 62px;
       }

       div.photo-title=20
         a,
         div.photo-title a:active,
         div.photo-title a:hover,
         div.photo-title a:visited {
           text-decoration: none;=20
       }

       div.attach-table div.attach-row {
         clear: both;
       }

       div.attach-table div.attach-row div {
         float: left;
         /* margin: 2px;*/
       }

       p {
         clear: both;
         padding: 15px 0 3px 0;
	 overflow: hidden;
       }

       div.ygrp-file {
         width: 30px;
         valign: middle;
       }
       div.attach-table div.attach-row div div a {
         text-decoration: none;
       }

       div.attach-table div.attach-row div div span {
         font-weight: normal;
       }

       div.ygrp-file-title {
         font-weight: bold;
       }
 /* end of attachment style */
        -->
        </style>
        </head>
<html>
<head>
<style type=3D"text/css">
<!--
#ygrp-mkp {
  border: 1px solid #d8d8d8;
  font-family: Arial;
  margin: 10px 0;
  padding: 0 10px;
}

#ygrp-mkp hr {
  border: 1px solid #d8d8d8;
}

#ygrp-mkp #hd {
  color: #628c2a;
  font-size: 85%;
  font-weight: 700;
  line-height: 122%;
  margin: 10px 0;
}

#ygrp-mkp #ads {
  margin-bottom: 10px;
}

#ygrp-mkp .ad {
  padding: 0 0;
}

#ygrp-mkp .ad p {
  margin: 0;
}

#ygrp-mkp .ad a {
  color: #0000ff;
  text-decoration: none;
}
-->
</style>
</head>
<body>



<!-- |**|begin egp html banner|**| -->

<br><br>

<!-- |**|end egp html banner|**| -->


<div dir=3D"ltr"><div><div><div><div>I haven&#39;t seen any academic papers=
 on the subject, but I can related a couple of examples from industry....<b=
r><br></div>* Leak analysis. In a Domain Specific Language Interpretor I wr=
ote, I had a memory leak. Tracing the leak (annotating the malloc and free =
calls) resulted in me rethinking the ownership policies for the heap alloca=
ted strings created by lexical analysis.<br>

<br></div>* Evaluation Order. In the evaluation of a very complex recursive=
ly defined formula, it was suggested I used memoization to speed it up. Thi=
s did indeed work. However, having done the work to add memoization I also =
logged the order in which things we evaluated (after memoization). Analysis=
 of this revealed a simple, direct order of evaluation that simplified the =
code immensely, and gained massive performance boost _without_ the need for=
 memoization.<br>

<br></div>* JIT compilers. (For example java and valgrind) are effectively =
refactorings after dynamic analysis.<br><br></div>* Profiling - Optimizatio=
n is often presented as a trade off between clean straight forward code and=
 complexity. Yet my experience has often (but not always) been the opposite=
. Often profiling hotspots are the consequences of very bad design decision=
s. Often the act of profiling a code base that hasn&#39;t been profiled for=
 a long time reveals code stenches, which when removed results in cleaner f=
aster code. The rule &quot;No code is faster than no code&quot; is very app=
licable.<br>

<div><div><div><br></div></div></div></div><div class=3D"gmail_extra"><br><=
br><div class=3D"gmail_quote">On Sat, Nov 23, 2013 at 5:33 AM, swati kumar =
<span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]" target=3D"_bl=
ank">[email protected]</a>&gt;</span> wrote:<br>

<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">


<u></u>










<div style>
<span>=C2=A0</span>


<div>
  <div>


    <div>
=20=20=20=20=20=20
=20=20=20=20=20=20
      <p></p><div dir=3D"ltr">Namaskar,<div><br></div><div>I am Swati. A Ma=
ster of Technology student from India. I am doing my dissertation on Code s=
mells and Refactoring.</div><div><br></div><div>I am not able to find work =
done in refactoring using dynamic analysis or dynamic metrics.</div>


<div><br></div><div>Please suggest me some work done in this direction.</di=
v><div><br></div><div>Thanking You!!!=C2=A0<br></div></div>
<p></p>

    </div>
=20=20=20=20=20

=20=20=20=20
    <div style=3D"color:#fff;min-height:0"></div>


</div>



=20=20






</blockquote></div><br><br clear=3D"all"><br>-- <br><div dir=3D"ltr">John C=
arter<br>Phone : (64)(3) 358 6639<br>Tait Electronics=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0=C2=A0=C2=A0 <=
br>PO Box 1645 Christchurch<br>New Zealand<br><br></div>
</div>

<br>
<hr><font color=3D"#808080">This email, including any attachments, is only
 for the intended recipient. It is subject to copyright, is confidential
 and may be the subject of legal or other privilege, none of which is=20
waived or lost by reason of this transmission.</font><div><font color=3D"#8=
08080">If
 you are not an intended recipient, you may not use, disseminate,=20
distribute or reproduce such email, any attachments, or any part=20
thereof. If you have received a message in error, please notify the=20
sender immediately and erase all copies of the message and any=20
attachments.</font></div><div><font color=3D"#808080">Unfortunately, we=20
cannot warrant that the email has not been altered or corrupted during=20
transmission nor can we guarantee that any email or any attachments are=20
free from computer viruses or other conditions which may damage or=20
interfere with recipient data, hardware or software. The recipient=20
relies upon its own procedures and assumes all risk of use and of=20
opening any attachments.</font></div><div><hr></div>



<!-- |**|begin egp html banner|**| -->

<br>


<br>

<!-- |**|end egp html banner|**| -->


<div width=3D"1" style=3D"color: white; clear: both;"/>__._,_.___</div>

=20=20=20=20=20=20
=20=20=20=20=20=20
<!-- Start Recommendations -->
<!-- End Recommendations -->



<!-- |**|begin egp html banner|**| -->

  <img src=3D"http://geo.yahoo.com/serv?s=3D97476590/grpId=3D3975602/grpspI=
d=3D1707276718/msgId=3D10703/stime=3D1385328665" width=3D"1" height=3D"1"> =
<br>

<!-- |**|end egp html banner|**| -->

=20=20
<!-- |**|begin egp html banner|**| -->

<br>
      <div style=3D"font-family: verdana; font-size: 77%; border-top: 1px s=
olid #666; padding: 5px 0;" >
      Your email settings: Individual Email|Traditional <br>
      <a href=3D"http://groups.yahoo.com/group/refactoring/join;_ylc=3DX3oD=
MTJmazI5NjdvBF9TAzk3NDc2NTkwBGdycElkAzM5NzU2MDIEZ3Jwc3BJZAMxNzA3Mjc2NzE4BHN=
lYwNmdHIEc2xrA3N0bmdzBHN0aW1lAzEzODUzMjg2NjU-">Change settings via the Web<=
/a> (Yahoo! ID required) <br>
      Change settings via email: <a href=3D"mailto:refactoring-digest@yahoo=
groups.com?subject=3DEmail Delivery: Digest">Switch delivery to Daily Diges=
t</a> | <a href =3D "mailto:[email protected]?subjec=
t=3DChange Delivery Format: Fully Featured">Switch to Fully Featured</a> <b=
r>
           <a href=3D"http://groups.yahoo.com/group/refactoring;_ylc=3DX3oD=
MTJkMzV1NGJ0BF9TAzk3NDc2NTkwBGdycElkAzM5NzU2MDIEZ3Jwc3BJZAMxNzA3Mjc2NzE4BHN=
lYwNmdHIEc2xrA2hwZgRzdGltZQMxMzg1MzI4NjY1">
        Visit Your Group=20
      </a> |
      <a href=3D"http://info.yahoo.com/legal/us/yahoo/utos/terms/">
        Yahoo! Groups Terms of Use
      </a> |
      <a href=3D"mailto:[email protected]?subject=3DU=
nsubscribe">
       Unsubscribe=20
      </a>=20
 <br>
    </div>
  <br>

<!-- |**|end egp html banner|**| -->


<div style=3D"color: white; clear: both;"/>__,_._,___</div>
</body>

</html>

--047d7b5d2ea4e83e4f04ebf2f634--