Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: What are the core points of good procedural software design? (functions, code structuring)

by jimX11 (Friar)
on Jun 23, 2008 at 13:31 UTC ( [id://693520]=note: print w/replies, xml ) Need Help??


in reply to What are the core points of good procedural software design? (functions, code structuring)

Code maintenance and good design are different tasks.

New maintenance programmers often want elegant code, leading to the "let's just redo it all" idea. That's often much harder than just getting the new feature in place.

When I add a feature to existing code I often use the sprout object (or method or function) technique:

  1. read the legacy code and find where the changes will go
  2. add tests around that area of the legacy code, so that you'll more easily know if you broke something (with as little change to the legacy code as possible). This also allows you to know what variables are involved. This is the hardest part.
  3. develop the new code, using test driven methods. You feed your new code the values from the parameters found in the 2nd step. Your new code is of course elegant and you develop it independently of the legacy code.
  4. alter the legacy code so that it uses the new code. Cross your fingers and run the tests from the second step.

Then you have some tests for the legacy code and you have new elegant code with tests too.
  • Comment on Re: What are the core points of good procedural software design? (functions, code structuring)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://693520]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-19 03:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found