Jump to content

Re-Using Code


Ninjakreborn

Recommended Posts

This is an open questions. I have always reused my code. I go into a past project and strip out some code and re-use it all the time.  In what ways do you guys re-use your code?

Do you just take it out of projects you had built.  I know sometimes I form them into functions if I re-use them a lot.  However, after getting up there in projects and have a graveyard of projects you have done, what do you do to keep track of all the code you have written to use as reference?

Link to comment
Share on other sites

I use OOP, so I have written lots of classes. If I need to use one, just add it to the application. If it isn't large enough to yield a worthwhile class, but is still useful, I have a snippet library, nice and sorted.

 

I try to avoid having to go back and rip out a few lines of code, as that isn't really re-useability.

 

Sometimes it's unavoidable though.

 

- Josh

Link to comment
Share on other sites

I go into a past project and strip out some code and re-use it all the time.

 

That isn't re-using, not as I see it. I don't have to strip out some code in the Zend framework to use it in a new project do I? Re-think your design quite possibly your missing something to truly make your class re-usable.

 

In what ways do you guys re-use your code? Do you just take it out of projects you had built. ... what do you do to keep track of all the code you have written to use as reference?

 

All projects are under version-control and have a svn:externals defined for both Zend framework and our own framework that has grown over the years. When we get a new project we create a domain design often this design leads to new components (eg Services) that are not domain-related and thus suitable for the Infrastructure layer (frameworks, libraries, and the like). It sometimes happens that we adopt domain classes (eg Models) to new projects but these - like the project - evolve over time. We never re-use classes from the Application layer (eg Controllers) as the number of lines in those classes are negligible or too application-specific to be re-usable.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.