We all have reusable code. It comes really handy after a period of time when you don't want to write that class library that draws the processor performance once again (or whatever piece of code you don't want to write over and over again). The question is, how do you keep track of all this code?
As of me, I recently changed my strategy. I still use my own application to store short code snippets, but I started compiling more DLLs, documenting them and then reference them in any project I need.
What's your way to manage reusable code?
30 Replies - 4583 Views - Last Post: 17 April 2011 - 05:45 PM
Replies To: How do you manage reusable code?
#2
Re: How do you manage reusable code?
Posted 06 September 2009 - 12:08 PM
I go dll as well.
I do have a code snippet app, but for that really special code that takes up much resources, or took me a long time to code, or can be very resuable I throw it in a library, and give it a specific name.
I do have a code snippet app, but for that really special code that takes up much resources, or took me a long time to code, or can be very resuable I throw it in a library, and give it a specific name.
#3
Re: How do you manage reusable code?
Posted 06 September 2009 - 12:11 PM
I use a lot of DLL's that I created. I keep the code as Visual Studio project (class library) that I can add into a project at any time I want.
#4
Re: How do you manage reusable code?
Posted 06 September 2009 - 12:49 PM
Eclipse makes it fairly easy to include another project in your build, so I guess its a mix between text and a library.
#5
Re: How do you manage reusable code?
Posted 06 September 2009 - 01:43 PM
Well, this depends completely on what language you most often code in.
Putting stuff in DLLs as has been suggested is only valid if you only write code using MS apps for MS operating systems. And even then it depends on what variant you're compiling for. Anyone who uses the remaining 99% of languages and platforms would pick something else.
Storing stuff in libraries is a perfectly sound idea, except you then have to maintain compatibility. If you add 100 new routines to it over time you have to make sure that the originaly functionality isn't broken otherwiserecompiling your app for Windows 8 will drive the failboat all the way up the beach.
Same goes with class "libraries" in scripting languages such as PHP.
I tend not to keep stuff togethe, _functionally_, though I will keep stuff together _organisationally_. Just store the code in text files I can copy-and-paste from when I need to.
Or course, bigger "snippets" might not be legally reusable depending on whatever horrible IP contract you got yourself roped into says...
Putting stuff in DLLs as has been suggested is only valid if you only write code using MS apps for MS operating systems. And even then it depends on what variant you're compiling for. Anyone who uses the remaining 99% of languages and platforms would pick something else.
Storing stuff in libraries is a perfectly sound idea, except you then have to maintain compatibility. If you add 100 new routines to it over time you have to make sure that the originaly functionality isn't broken otherwiserecompiling your app for Windows 8 will drive the failboat all the way up the beach.
Same goes with class "libraries" in scripting languages such as PHP.
I tend not to keep stuff togethe, _functionally_, though I will keep stuff together _organisationally_. Just store the code in text files I can copy-and-paste from when I need to.
Or course, bigger "snippets" might not be legally reusable depending on whatever horrible IP contract you got yourself roped into says...
#6
Re: How do you manage reusable code?
Posted 06 September 2009 - 01:57 PM
Quote
Putting stuff in DLLs as has been suggested is only valid if you only write code using MS apps for MS operating systems.
Well, it doesn't really depend on the system, but rather on the development platform. You can use DLLs in Linux with Mono.
Quote
Storing stuff in libraries is a perfectly sound idea, except you then have to maintain compatibility. If you add 100 new routines to it over time you have to make sure that the originaly functionality isn't broken otherwiserecompiling your app for Windows 8 will drive the failboat all the way up the beach.
Good point! Well, this is where it comes to functionality separation. Sometimes it is easier to compile several libraries with selective functionality sets, rather than having it all together in one DLL.
Quote
Just store the code in text files I can copy-and-paste from when I need to.
Just my opinion, but this makes it a bit hard to find the needed piece of code when the code base grows. In this case, I would definitely use a snippet manager to put all the code fragments together.
#7
Re: How do you manage reusable code?
Posted 06 September 2009 - 06:31 PM
I am also in the process of changing the way I do code reuse. For a time I was doing it with documentation and copy/paste/snippet manager idea. I'm trying to start using DLLs as well.
#8
Re: How do you manage reusable code?
Posted 06 September 2009 - 07:29 PM
I wasn't sure what JS functions go under so i voted "Other".
#9
Re: How do you manage reusable code?
Posted 06 September 2009 - 09:31 PM
DLLs, i created a ClassLibrary project and using it in my porjects and can easly add changes.
DLLs have 2 advantages:
1. easy to use
2. keep your codes in one place
DLLs have 2 advantages:
1. easy to use
2. keep your codes in one place
#10
Re: How do you manage reusable code?
Posted 07 September 2009 - 01:23 AM
im a php programmer mostly i have a folder phpsandbox where i test all my php scripts before hand and i just keep all the scripts in there after i fix all the errors that may arive and leave them in there very easy to grab my script for like a loginpage instead of rewritting everything i can just change where it links to and stuff
#11
Re: How do you manage reusable code?
Posted 07 September 2009 - 11:19 AM
I use a combination of DLLs and direct source code inclusion (from stored code on an external hard disk)
Since I tweak my snippets a lot depending on the situation that requires it, direct inclusion of stored source code is often a lot better than using a DLL.
Since I tweak my snippets a lot depending on the situation that requires it, direct inclusion of stored source code is often a lot better than using a DLL.
#12
Re: How do you manage reusable code?
Posted 07 September 2009 - 10:17 PM
Core, on 6 Sep, 2009 - 11:04 AM, said:
We all have reusable code. It comes really handy after a period of time when you don't want to write that class library that draws the processor performance once again (or whatever piece of code you don't want to write over and over again). The question is, how do you keep track of all this code?
As of me, I recently changed my strategy. I still use my own application to store short code snippets, but I started compiling more DLLs, documenting them and then reference them in any project I need.
What's your way to manage reusable code?
As of me, I recently changed my strategy. I still use my own application to store short code snippets, but I started compiling more DLLs, documenting them and then reference them in any project I need.
What's your way to manage reusable code?
just store it on a hard drive
#13
Re: How do you manage reusable code?
Posted 08 September 2009 - 12:16 AM
russian, on 8 Sep, 2009 - 04:17 AM, said:
Core, on 6 Sep, 2009 - 11:04 AM, said:
We all have reusable code. It comes really handy after a period of time when you don't want to write that class library that draws the processor performance once again (or whatever piece of code you don't want to write over and over again). The question is, how do you keep track of all this code?
As of me, I recently changed my strategy. I still use my own application to store short code snippets, but I started compiling more DLLs, documenting them and then reference them in any project I need.
What's your way to manage reusable code?
As of me, I recently changed my strategy. I still use my own application to store short code snippets, but I started compiling more DLLs, documenting them and then reference them in any project I need.
What's your way to manage reusable code?
just store it on a hard drive
Very funny.
#14
Re: How do you manage reusable code?
Posted 08 September 2009 - 12:11 PM
I don't usually store snippets of code but I have a folder with two or three. Right now, I'm still a student so I'm not working on large projects. Usually I just write test programs that incorporate some new idea I though of.
#15
Re: How do you manage reusable code?
Posted 08 September 2009 - 03:58 PM
Is there a good existing application for managing snippets out there? I just tend to go back to previous projects and grab whatever I need out of them, but its starting to get hard to remember where everything is.
|
|

New Topic/Question
Reply



MultiQuote










|