|
Re: A question of design... to Refactor a webform or not.: msg#00149windows.devel.dotnet.web
> Does anyone here normally practice Refactoring on relatively non OOp > code? Have you found it makes a difference or has it lead to further > bugs and other issues? Always look to split code into component parts, whether procedural or not. This *reduces* bugs. The code is clearer and cleaner. This allows you spot errors and potential performance issues. Some basic guidelines in when to split code into subroutines: - Duplication. If there is any duplication (even for just a couple of lines), split it into a separate routine. - Clarity. If you are doing a single operation that takes 4 say lines of code, it is better to split that out into a separate routine. Moving things to subroutines also allows you to group code that logically belongs together. One good candidate to move to a subroutine is the contents of a for/while loop. Another excellent candidate is code the pulls data from some source. Incidentally, before I moved to .Net I wrote a lot of code in classic ASP, which is basically straight procedural. All the pages I wrote were separated out into their respective subroutines, and where applicable into include files. I found that after working with the language for a little while that this was the only way to manage it effectively, particularly as things got large. One single page was over 1000 lines of code had 17 include files and 12 subroutines. You should start to feel twitchy if you have a single block of code that is longer than about 75 lines. regards David Cameron Robert Dickson wrote: Hello All, =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | A question of design... to Refactor a webform or not.: 00149, Robert Dickson |
|---|---|
| Next by Date: | Re: Timeout debugging web service: 00149, Ayyappan Nair |
| Previous by Thread: | A question of design... to Refactor a webform or not.i: 00149, Robert Dickson |
| Next by Thread: | Timeout debugging web service: 00149, Ainsley, Robert, ISD |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |