PDA

View Full Version : How to re-factor a method?


Sophie
05-30-2009, 05:49 PM
When a method M1 grows a bit too big, I would like to re-factor parts of it into a new method M2, and invoke M2 from M1. I could not find a way to copy/paste or drag/drop selected parts of M1 into M2. Is there a way to do this?

I understand some correct constructions in M1 may be incorrect in M2, and would expect to fix these after copying (otherwise re-factoring would need to be a lot more sophisticated).

Thanks

Meegakaby
05-31-2009, 05:44 PM
When I saw the "copy-paste" in your message, I wasnt sure, but I thought this might help. In the top right corner of the alice interface, there's a clipboard icon. Drag a part of M1 onto it, enter the M2 editing part, and drag the paper now on the clipboard icon onto the M2 place where you want it. Be careful, as you can only copy one item thing at a time. What I did was got a giant "loop" box, put my soon to be copied items in it, copied it, dragged into my M2, then right clicked the loop box and selected "dissolve", leaving me with the wanted lines of... well... not exactly code.......

Sophie
05-31-2009, 10:31 PM
Thanks, that works great!