views:

186

answers:

4

Can anyone recommend a website, book, or simply a list of refactoring strategies for procedural languages as opposed to object oriented languages?

Everything I was able to find contained some strategies that could apply, most were useful only if working in an OO language.

A: 

Really? That's odd, as the most basic refactoring concept ("find common code and pull it out into a separate function") works at least as well in procedural code as OO code.

James Curran
No it doesn't. It's much harder to factor procedural code into a common location because it's more difficult to delegate "inner" calls to the correct handler. Only OO code written by a procedural programmer (like C++ generally is) is that difficult.
Bill K
+1  A: 

Refactoring isn't explicitly an OO concept. People have been refactoring C code for years. Barring anything that's related to OO (such as refactoring inheritance into composition), the standard stuff applies, e.g., move duplicate code into a single function (as James mentions).

Robert S.
Newish basic has as much (or more) OO structure as any other language.
Bill K
+3  A: 

Thinking Forth has lots of really good advice about refactoring. I am also very fond of David Parnas' paper On The Criteria to be Used in Decomposing Systems into Modules.

Glomek
A: 

Take a look at Working Effectively with Legacy Code by Michael Feathers.

Cynshard