Purpose: discuss techniques developers use to make code reuse easier. 1. What is code reuse? Code reuse is one dream of some developers. It is the concept of writing code once, then using it in various other applications. In other industries (such as architecture, construction, automobile construction, food preparation) reuse of pre-constructed components is not only taken for granted, but critical for successful, safe construction. 1. What makes code reuse hard? Noticing that the code needed is code already written. Remembering, or locating, the already written code. Finding code that was written in a manner so that it can be reused. 1. Is code reuse really possible? Yes - Tcl is a prime example of code reuse. 1. Is code reuse really practical? Yes, but it does take time, effort, and a desire to actually make the code reusable. 1. What are techniques Tcl developers use to make code reuse easier? * The most important technique needed is the '''desire''' to actually use, and write, reusable code. Without that, nothing else will make significant impact. * Next, one must become aware of what code already has been written. There are large numbers of extensions that have already been written. However, there really isn't one single way to browse all of the code to determine what is available. Certainly many pages have been written on http://wiki.tcl.tk/ and at one time pages were available at http://www.tcl.tk/ and other sites attempting to catalog the extensions. And one can use any of the search engines covering large segments of development web sites, looking for discussions. * Once the preceeding techniques have been implemented, one needs to become aware, when designing code, of potential reusable components of the design. One then looks around to see if such components already exist. If so, then one makes use of them. * If a potentially reusable component is needed, but does not exist, then one is faced with the possibility of designing, implementing, and deploying a new component. [[Add details of things to consider when designing, implementing, and deploying new reusable components. Include design considerations, documentation, techniques to use and avoid when writing the code, and methods of distribution and advertising the new component.]] ---- ''[escargo] 8 Apr 2006'' - Two ways to facilitate code reuse are to ensure that the code in question is either incorporated as part of the core language (for us, something added with a [TIP]) or into a library that is likely distributed with the core ([tcllib] or [tklib]). ---- ''[RJ]'' 9 Apr 2006 - This page gave me an idea - I have two personal wikis going (one for work info, one for personal info). I have just set up a third one. I just went through all the 'utils' directory files and copy/pasted common pieces of code into categories. I was surprised how simple the categorization was. I think this will do it for me - next step is to go through all my tcl/tk apps and copy in all the great stuff I stole from Richard. Which by the way is a category of it's own. ;) ---- [Category Discussion] | [Category Repository]