Re: [U2] Refactoring Tools
Hello Tony Thanks for the heads-up. I'll take a look. Brian -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Tony Gravagno Sent: 22 April 2013 21:29 To: u2-users@listserver.u2ug.org Subject: Re: [U2] Refactoring Tools Brian, on my freeware page I have a Merge/Split routine. I use it to merge Included code modules so that I can run, debug, and edit them as a unit, then split the modules off back into their components. From there, re-compiling all code allows the entire app to benefit from an individual effort. http://Nebula-RnD.com/freeware/ The utility gets a uniquely stamped backup of every item before every operation to ensure nothing gets lost. WRT your query, it sounds like you want to factor out common code. I'd approach this by writing a utility that scans items for common blocks of text, wrapping those blocks with start/end markers which I use in the Merge/Split. So let's say you have 100 lines that start with label FOO: * do foo. Wrap that as follows: *! START.INCLUDE INC.FOO FOO: * do foo *! END.INCLUDE With all program items marked like that, run the Merge/Split on them and do a split (without a prior merge since you're creating new Includes). You'll get a single INC.FOO item and all other items will then INCLUDE INC.FOO at the right location. This will take some manual effort. You don't really know what blocks to refactor out until you've looked around for common patterns, and you will find a lot of blocks that are close but not quite the same. You could factor out all FOO subroutines into individual items, then delete items that are the same, and modify code which includes that code to use a single Include item. The most benefit comes when you find lots of large common blocks of code. This usually comes in the form of long EQUate lists, Common definitions, blocks of Open statements, and logging and other housekeeping. You may even find value in Includes of Includes. If you do use the Merge/Split freeware, I'd appreciate if you'd pass back any updates you make for this specific purpose. Aside from that more manual approach, check out mvToolbox. It has a ton of features that do all sorts of magical things - for all I know it might have some hidden function to help to refactor out an entire application. Some developers load it to every new site they work on, to organize app code before doing any other work on it. (Yes, that needs to be done properly.) http://www.mvtoolbox.com/index.html Use that link to avoid getting passed off to the awful awful web ring. While marketed via a poor website, mvToolbox is great software which only suffers from having too many features and too much documentation. Get over the too/too issue and you will find a number of gems in there at too low of a price for such a useful tool. HTH T From: Brian Leach I'm doing some intensive work with a large UniVerse site to assist them in migrating their 20 year old code base and working practices to full Agile, XP and TDD. They are really enthusiastic in embracing the modern world and making good progress, but there is a huge amount of legacy code to be cleaned up and test harnessed. So before I spend time possibly reinventing the wheel, does anyone know of any good refactoring tools for UniVerse Basic? ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Refactoring Tools
I remember Cliff Oliver talking about this once. Not sure, if he had any tools available... Wish I had more info available. On Sun, Apr 21, 2013 at 8:26 AM, Brian Leach br...@brianleach.co.uk wrote: Hi All I'm doing some intensive work with a large UniVerse site to assist them in migrating their 20 year old code base and working practices to full Agile, XP and TDD. They are really enthusiastic in embracing the modern world and making good progress, but there is a huge amount of legacy code to be cleaned up and test harnessed. So before I spend time possibly reinventing the wheel, does anyone know of any good refactoring tools for UniVerse Basic? Brian ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users -- John Thompson ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Refactoring Tools
If by refactoring you mean A tool which will read the BASIC code and translate it into Python Than no, no such animal exists. -Original Message- From: John Thompson jthompson...@gmail.com To: U2 Users List u2-users@listserver.u2ug.org Sent: Mon, Apr 22, 2013 10:20 am Subject: Re: [U2] Refactoring Tools I remember Cliff Oliver talking about this once. Not sure, if he had any tools available... Wish I had more info available. On Sun, Apr 21, 2013 at 8:26 AM, Brian Leach br...@brianleach.co.uk wrote: Hi All I'm doing some intensive work with a large UniVerse site to assist them in migrating their 20 year old code base and working practices to full Agile, XP and TDD. They are really enthusiastic in embracing the modern world and making good progress, but there is a huge amount of legacy code to be cleaned up and test harnessed. So before I spend time possibly reinventing the wheel, does anyone know of any good refactoring tools for UniVerse Basic? Brian ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users -- John Thompson ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Refactoring Tools
Python ? ? -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson Sent: 22 April 2013 18:46 To: u2-users@listserver.u2ug.org Subject: Re: [U2] Refactoring Tools If by refactoring you mean A tool which will read the BASIC code and translate it into Python Than no, no such animal exists. -Original Message- From: John Thompson jthompson...@gmail.com To: U2 Users List u2-users@listserver.u2ug.org Sent: Mon, Apr 22, 2013 10:20 am Subject: Re: [U2] Refactoring Tools I remember Cliff Oliver talking about this once. Not sure, if he had any tools available... Wish I had more info available. On Sun, Apr 21, 2013 at 8:26 AM, Brian Leach br...@brianleach.co.uk wrote: Hi All I'm doing some intensive work with a large UniVerse site to assist them in migrating their 20 year old code base and working practices to full Agile, XP and TDD. They are really enthusiastic in embracing the modern world and making good progress, but there is a huge amount of legacy code to be cleaned up and test harnessed. So before I spend time possibly reinventing the wheel, does anyone know of any good refactoring tools for UniVerse Basic? Brian ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users -- John Thompson ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users - No virus found in this message. Checked by AVG - www.avg.com Version: 2012.0.2241 / Virus Database: 3162/5765 - Release Date: 04/22/13 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Refactoring Tools
Example. -Original Message- From: Symeon Breen syme...@gmail.com To: 'U2 Users List' u2-users@listserver.u2ug.org Sent: Mon, Apr 22, 2013 11:15 am Subject: Re: [U2] Refactoring Tools Python ? ? -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson Sent: 22 April 2013 18:46 To: u2-users@listserver.u2ug.org Subject: Re: [U2] Refactoring Tools If by refactoring you mean A tool which will read the BASIC code and translate it into Python Than no, no such animal exists. -Original Message- From: John Thompson jthompson...@gmail.com To: U2 Users List u2-users@listserver.u2ug.org Sent: Mon, Apr 22, 2013 10:20 am Subject: Re: [U2] Refactoring Tools I remember Cliff Oliver talking about this once. Not sure, if he had any tools available... Wish I had more info available. On Sun, Apr 21, 2013 at 8:26 AM, Brian Leach br...@brianleach.co.uk wrote: Hi All I'm doing some intensive work with a large UniVerse site to assist them in migrating their 20 year old code base and working practices to full Agile, XP and TDD. They are really enthusiastic in embracing the modern world and making good progress, but there is a huge amount of legacy code to be cleaned up and test harnessed. So before I spend time possibly reinventing the wheel, does anyone know of any good refactoring tools for UniVerse Basic? Brian ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users -- John Thompson ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users - No virus found in this message. Checked by AVG - www.avg.com Version: 2012.0.2241 / Virus Database: 3162/5765 - Release Date: 04/22/13 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Refactoring Tools
Perhaps by refactoring you mean just to make the code more consistent. Yes and no. Decompiling the object code, will enforce consistency, however at the expense of readability. -Original Message- From: Brian Leach br...@brianleach.co.uk To: 'U2 Users List' u2-users@listserver.u2ug.org Sent: Sun, Apr 21, 2013 5:26 am Subject: [U2] Refactoring Tools Hi All I'm doing some intensive work with a large UniVerse site to assist them in migrating their 20 year old code base and working practices to full Agile, XP and TDD. They are really enthusiastic in embracing the modern world and making good progress, but there is a huge amount of legacy code to be cleaned up and test harnessed. So before I spend time possibly reinventing the wheel, does anyone know of any good refactoring tools for UniVerse Basic? Brian ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Refactoring Tools
*https://en.wikipedia.org/wiki/Code_refactoring Code refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior,[1] undertaken in order to improve some of the nonfunctional attributes of the software. Advantages include improved code readability and reduced complexity to improve the maintainability of the source code, as well as a more expressive internal architecture or object model to improve extensibility. My translation: Remove the spaghetti without changing functionality. *Wjhonson wrote: Perhaps by refactoring you mean just to make the code more consistent. Yes and no. Decompiling the object code, will enforce consistency, however at the expense of readability. -Original Message- From: Brian Leach br...@brianleach.co.uk To: 'U2 Users List' u2-users@listserver.u2ug.org Sent: Sun, Apr 21, 2013 5:26 am Subject: [U2] Refactoring Tools Hi All I'm doing some intensive work with a large UniVerse site to assist them in migrating their 20 year old code base and working practices to full Agile, XP and TDD. They are really enthusiastic in embracing the modern world and making good progress, but there is a huge amount of legacy code to be cleaned up and test harnessed. So before I spend time possibly reinventing the wheel, does anyone know of any good refactoring tools for UniVerse Basic? Brian ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users -- Jeff Schasny - Denver, Co, USA jschasny at gmail dot com ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Refactoring Tools
Hi Brian: Built into BDT from Rocket Software is a re-factor option. I have used that option a few times in testing and found it to be of limited value, because there is no way to get all of the code locally. You must have the code locally to use re-factoring. I have re-factored code in Eclipse using the Java Editor. I found that does a fairly good job. In our XLr8Editor I have not put in re-factoring because the Eclipse global search and replace does an adequate job for changing the source. I generally like to see all of the code and make sure it it what needs to be changed. I can copy and paste source to you local work space fairly easily which solves the local problem for Eclipse. Regards, Doug www.u2logic.com/tools.html Eclipse based tools for the U2 Marketplace -Original Message- From: Brian Leach br...@brianleach.co.uk To: 'U2 Users List' u2-users@listserver.u2ug.org Sent: Sun, Apr 21, 2013 5:26 am Subject: [U2] Refactoring Tools Hi All I'm doing some intensive work with a large UniVerse site to assist them in migrating their 20 year old code base and working practices to full Agile, XP and TDD. They are really enthusiastic in embracing the modern world and making good progress, but there is a huge amount of legacy code to be cleaned up and test harnessed. So before I spend time possibly reinventing the wheel, does anyone know of any good refactoring tools for UniVerse Basic? Brian ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Refactoring Tools
Hi Brian: Built into BDT from Rocket Software is a re-factor option. I have used that option a few times in testing and found it to be of limited value, because there is no way to get all of the code locally. You must have the code locally to use re-factoring in Eclipse. I have re-factored code in Eclipse using the Java Editor. I found that it does a fairly good job. In our XLr8Editor I have not put in re-factoring because the Eclipse global search and replace does an adequate job for changing the source. I generally like to see all of the code and make sure it needs to be changed. I can copy and paste source to you local work space fairly easily which solves the local problem for Eclipse. Regards, Doug www.u2logic.com/tools.html Eclipse based tools for the U2 Marketplace -Original Message- From: Brian Leach br...@brianleach.co.uk To: 'U2 Users List' u2-users@listserver.u2ug.org Sent: Sun, Apr 21, 2013 5:26 am Subject: [U2] Refactoring Tools Hi All I'm doing some intensive work with a large UniVerse site to assist them in migrating their 20 year old code base and working practices to full Agile, XP and TDD. They are really enthusiastic in embracing the modern world and making good progress, but there is a huge amount of legacy code to be cleaned up and test harnessed. So before I spend time possibly reinventing the wheel, does anyone know of any good refactoring tools for UniVerse Basic? Brian ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Refactoring Tools
Jeff - Exactly :) I mean refactoring as in restructuring old code to make it more testable and consistent. You find these tools for .NET, java and other languages though there the model is different because of the OO nature. Universe code doesn't decompose down the same way but I was just wondering whether anyone had built some assisting tools before I have to start designing and building some. Example, an slice through a program that mixes UI and business logic to rip out the useful guts into external subroutines for unit testing whilst preserving the overall logic safely. Which means the tool needs at least a rudimentary understanding of code syntax and scope rather than just stripping lines out. (e.g. this block sets a local variable as a by-product, that also just happens to be used 5,000 lines later on in a GoSub so it needs to be surfaced if the block is externalized - that kind of stuff that could easily get lost). I've written plenty of code analysis software but not specifically for this. Regards Brian -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Jeff Schasny Sent: 22 April 2013 19:49 To: U2 Users List Subject: Re: [U2] Refactoring Tools *https://en.wikipedia.org/wiki/Code_refactoring Code refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior,[1] undertaken in order to improve some of the nonfunctional attributes of the software. Advantages include improved code readability and reduced complexity to improve the maintainability of the source code, as well as a more expressive internal architecture or object model to improve extensibility. My translation: Remove the spaghetti without changing functionality. *Wjhonson wrote: Perhaps by refactoring you mean just to make the code more consistent. Yes and no. Decompiling the object code, will enforce consistency, however at the expense of readability. -Original Message- From: Brian Leach br...@brianleach.co.uk To: 'U2 Users List' u2-users@listserver.u2ug.org Sent: Sun, Apr 21, 2013 5:26 am Subject: [U2] Refactoring Tools Hi All I'm doing some intensive work with a large UniVerse site to assist them in migrating their 20 year old code base and working practices to full Agile, XP and TDD. They are really enthusiastic in embracing the modern world and making good progress, but there is a huge amount of legacy code to be cleaned up and test harnessed. So before I spend time possibly reinventing the wheel, does anyone know of any good refactoring tools for UniVerse Basic? Brian ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users -- Jeff Schasny - Denver, Co, USA jschasny at gmail dot com ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Refactoring Tools
Brian: Prayer may come in handy. :-) Bill Untitled Page - Original Message - *From:* br...@brianleach.co.uk *To:* 'U2 Users List' u2-users@listserver.u2ug.org *Date:* 4/22/2013 12:12 PM *Subject:* Re: [U2] Refactoring Tools Jeff - Exactly :) I mean refactoring as in restructuring old code to make it more testable and consistent. You find these tools for .NET, java and other languages though there the model is different because of the OO nature. Universe code doesn't decompose down the same way but I was just wondering whether anyone had built some assisting tools before I have to start designing and building some. Example, an slice through a program that mixes UI and business logic to rip out the useful guts into external subroutines for unit testing whilst preserving the overall logic safely. Which means the tool needs at least a rudimentary understanding of code syntax and scope rather than just stripping lines out. (e.g. this block sets a local variable as a by-product, that also just happens to be used 5,000 lines later on in a GoSub so it needs to be surfaced if the block is externalized - that kind of stuff that could easily get lost). I've written plenty of code analysis software but not specifically for this. Regards Brian -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Jeff Schasny Sent: 22 April 2013 19:49 To: U2 Users List Subject: Re: [U2] Refactoring Tools *https://en.wikipedia.org/wiki/Code_refactoring Code refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior,[1] undertaken in order to improve some of the nonfunctional attributes of the software. Advantages include improved code readability and reduced complexity to improve the maintainability of the source code, as well as a more expressive internal architecture or object model to improve extensibility. My translation: Remove the spaghetti without changing functionality. *Wjhonson wrote: Perhaps by refactoring you mean just to make the code more consistent. Yes and no. Decompiling the object code, will enforce consistency, however at the expense of readability. -Original Message- From: Brian Leach br...@brianleach.co.uk To: 'U2 Users List' u2-users@listserver.u2ug.org Sent: Sun, Apr 21, 2013 5:26 am Subject: [U2] Refactoring Tools Hi All I'm doing some intensive work with a large UniVerse site to assist them in migrating their 20 year old code base and working practices to full Agile, XP and TDD. They are really enthusiastic in embracing the modern world and making good progress, but there is a huge amount of legacy code to be cleaned up and test harnessed. So before I spend time possibly reinventing the wheel, does anyone know of any good refactoring tools for UniVerse Basic? Brian ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users -- Jeff Schasny - Denver, Co, USA jschasny at gmail dot com ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Refactoring Tools
Brian, on my freeware page I have a Merge/Split routine. I use it to merge Included code modules so that I can run, debug, and edit them as a unit, then split the modules off back into their components. From there, re-compiling all code allows the entire app to benefit from an individual effort. http://Nebula-RnD.com/freeware/ The utility gets a uniquely stamped backup of every item before every operation to ensure nothing gets lost. WRT your query, it sounds like you want to factor out common code. I'd approach this by writing a utility that scans items for common blocks of text, wrapping those blocks with start/end markers which I use in the Merge/Split. So let's say you have 100 lines that start with label FOO: * do foo. Wrap that as follows: *! START.INCLUDE INC.FOO FOO: * do foo *! END.INCLUDE With all program items marked like that, run the Merge/Split on them and do a split (without a prior merge since you're creating new Includes). You'll get a single INC.FOO item and all other items will then INCLUDE INC.FOO at the right location. This will take some manual effort. You don't really know what blocks to refactor out until you've looked around for common patterns, and you will find a lot of blocks that are close but not quite the same. You could factor out all FOO subroutines into individual items, then delete items that are the same, and modify code which includes that code to use a single Include item. The most benefit comes when you find lots of large common blocks of code. This usually comes in the form of long EQUate lists, Common definitions, blocks of Open statements, and logging and other housekeeping. You may even find value in Includes of Includes. If you do use the Merge/Split freeware, I'd appreciate if you'd pass back any updates you make for this specific purpose. Aside from that more manual approach, check out mvToolbox. It has a ton of features that do all sorts of magical things - for all I know it might have some hidden function to help to refactor out an entire application. Some developers load it to every new site they work on, to organize app code before doing any other work on it. (Yes, that needs to be done properly.) http://www.mvtoolbox.com/index.html Use that link to avoid getting passed off to the awful awful web ring. While marketed via a poor website, mvToolbox is great software which only suffers from having too many features and too much documentation. Get over the too/too issue and you will find a number of gems in there at too low of a price for such a useful tool. HTH T From: Brian Leach I'm doing some intensive work with a large UniVerse site to assist them in migrating their 20 year old code base and working practices to full Agile, XP and TDD. They are really enthusiastic in embracing the modern world and making good progress, but there is a huge amount of legacy code to be cleaned up and test harnessed. So before I spend time possibly reinventing the wheel, does anyone know of any good refactoring tools for UniVerse Basic? ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users