How do you manage reusable code?

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

30 Replies - 5321 Views - Last Post: 17 April 2011 - 05:45 PM

Poll: How do you manage reusable code? (60 member(s) have cast votes)

Methods of managing/storing reusable code

  1. Client application (snippet manager) (5 votes [8.33%])

    Percentage of vote: 8.33%

  2. DLLs (16 votes [26.67%])

    Percentage of vote: 26.67%

  3. Text documentation (13 votes [21.67%])

    Percentage of vote: 21.67%

  4. Online services (1 votes [1.67%])

    Percentage of vote: 1.67%

  5. Keep code in memory (12 votes [20.00%])

    Percentage of vote: 20.00%

  6. Not keeping reusable code (2 votes [3.33%])

    Percentage of vote: 3.33%

  7. Other (11 votes [18.33%])

    Percentage of vote: 18.33%

Vote Guests cannot vote

#1 Core  Icon User is offline

  • using System.Linq;
  • member icon

Reputation: 773
  • View blog
  • Posts: 5,097
  • Joined: 08-December 08

How do you manage reusable code?

Post icon  Posted 06 September 2009 - 12:04 PM

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?

Is This A Good Question/Topic? 0
  • +

Replies To: How do you manage reusable code?

#2 coden4fun  Icon User is offline

  • if(coden4fun.NotTired){ ContinueToCode(); }
  • member icon

Reputation: 27
  • View blog
  • Posts: 696
  • Joined: 27-February 09

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.
Was This Post Helpful? 0
  • +
  • -

#3 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1632
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

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.
Was This Post Helpful? 0
  • +
  • -

#4 syfran  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 83
  • View blog
  • Posts: 1,103
  • Joined: 12-July 09

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.
Was This Post Helpful? 0
  • +
  • -

#5 moopet  Icon User is offline

  • binary decision maker
  • member icon

Reputation: 339
  • View blog
  • Posts: 1,185
  • Joined: 02-April 09

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...
Was This Post Helpful? 0
  • +
  • -

#6 Core  Icon User is offline

  • using System.Linq;
  • member icon

Reputation: 773
  • View blog
  • Posts: 5,097
  • Joined: 08-December 08

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.
Was This Post Helpful? 0
  • +
  • -

#7 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 942
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

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.
Was This Post Helpful? 0
  • +
  • -

#8 kewlkreator  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 37
  • View blog
  • Posts: 1,065
  • Joined: 25-March 09

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".
Was This Post Helpful? 0
  • +
  • -

#9 noorahmad  Icon User is offline

  • Untitled
  • member icon

Reputation: 209
  • View blog
  • Posts: 2,290
  • Joined: 12-March 09

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

:)
Was This Post Helpful? 0
  • +
  • -

#10 Code_Eater92  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 38
  • Joined: 14-March 09

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
Was This Post Helpful? 0
  • +
  • -

#11 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 180
  • View blog
  • Posts: 4,667
  • Joined: 26-November 04

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.
Was This Post Helpful? 0
  • +
  • -

#12 russian  Icon User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 6
  • Joined: 15-June 09

Re: How do you manage reusable code?

Posted 07 September 2009 - 10:17 PM

View PostCore, 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?



just store it on a hard drive
Was This Post Helpful? 0
  • +
  • -

#13 moopet  Icon User is offline

  • binary decision maker
  • member icon

Reputation: 339
  • View blog
  • Posts: 1,185
  • Joined: 02-April 09

Re: How do you manage reusable code?

Posted 08 September 2009 - 12:16 AM

View Postrussian, on 8 Sep, 2009 - 04:17 AM, said:

View PostCore, 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?



just store it on a hard drive


Very funny.
Was This Post Helpful? 0
  • +
  • -

#14 eker676  Icon User is offline

  • Software Engineer
  • member icon

Reputation: 378
  • View blog
  • Posts: 1,833
  • Joined: 18-April 09

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.
Was This Post Helpful? 0
  • +
  • -

#15 scalt  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 63
  • View blog
  • Posts: 342
  • Joined: 22-November 07

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.
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3