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

One of the simplest things you can do with a situation where you have a ton of related file scope variables is assemble them into a hash, then rewrite the functions to accept a hash reference.

I'm maintaining a lot of code whose authors never figured hashes out, and there are a number of instances where "insolvable" problems go away when you group the data into a hash, and then use the hash as a way to abstract out the various bits and pieces of data and logic.

If you can get this far, then you can decide if it's worth it to take one more step, and turn the hash into an object, and the functions into object methods.

Update: fixed typos.
  • Comment on Re: What are the core points of good procedural software design? (functions, code structuring)