> I don't like your answer, Wouter! Can I please get a second opinion? :-) Me too :) > What do you do when you want to reuse code that you've written? Copy/modify? > We've all done it, but it feels so wrong... There is of course a big difference between one person working on non-critical projects and big teams doing rocket stuff. I switch a lot between development environments, CPUs, and languages, so there is often not much that can be re-used except by cut-n-paste followed by a lot of rework. Staying within one environment I sometimes face your dilemma. I have finished a project, and start a new one that is somewhat similar. Should I copy the old code, or re-use it in situ (by reference)? I always copy. benefit is that I can always go back to a project and re-create the exact executable (that is, if I have not upgraded the compiler!). A disadvantage is in this scenario: I copy the libs from project A to project B, make improvements, finish the project. Now when I get an order to enhance project A I go back to that code and &%&^%& my improvements are not available! This would probably be a good moment to upgrade the libs used in A to the latest version, but i have never been that well organized. Olin, you use an extensive set of libraries & tools. How do you manage versioning, upgrades, back-propagation of library enhancements, etc? > Spending the time upfront to make the interfaces between the modules rock > solid, and keeping the number of "connecting points" to a minimum sounds > like the perfect solution, but it goes against the Agile programming > principles that I've come to know and love... in fact, I found that combing > through the same piece of code repeatedly is often the only way for me to > end up with what I would consider "good code". Defining interfaces in detail > upfront is yuky, because it forces me to make decisions early, and base them > on limited information... In my opinion the agile method is to be preferred while things are in flux (and smaller projects can tolerate much more flux than others), but interfaces must be fixed before your results can be 'thrown over the wall', even when it is the same you at the other side of that wall.. About re-visiting your own code: IMHO changing your own code (including interfaces) is unavoidable if you want to make quality code. I often make a few iterations before things settle down. For interface design these iterations must include some serious use of the interface, you simply can't design an interface right the first time. (If you have designed a similar interface before it does not count as a first time). -- Wouter van Ooijen -- ------------------------------------------- Van Ooijen Technische Informatica: www.voti.nl consultancy, development, PICmicro products docent Hogeschool van Utrecht: www.voti.nl/hvu -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist