Is it normal to re-use code?

16 replies
I am curious about developers in the field and if most of their code is written by them or is it normal for developers to re-use old code and enhance it to meet their needs?

I'm just wondering because what I've been doing for awhile now is just re-using past code from previous projects to complete current once but editing them to meet my needs.
#code #normal #reuse
  • Profile picture of the author CoderForLife22
    I do this often. The code i am re-using is my code but i usually reuse it if i need to to do the same task, no point in rewritting it.

    A lot of developers do this. It is called "Snippets". You have snippets of code that you can re-use at anytime. This is code that you typically will use in each and every project.
    {{ DiscussionBoard.errors[9522158].message }}
    • Profile picture of the author mhowe91
      Yeah it is totally normal.l Work smart not hard
      {{ DiscussionBoard.errors[9523092].message }}
      • Profile picture of the author itnet
        Reuse code implemented in other project let you save time for analysis, code and testing.

        It is not only smart but also more safe, because is code already tested, you' re simply developing your libraries, a code well-written is easy and safe to reuse.

        A my advice is also to keep always up-to-date about all the latest techniques and tools available for your language for increase the productivity, because are often requested by customers.

        ...my english is not well written, i dont like to reuse it.
        {{ DiscussionBoard.errors[9523249].message }}
        • {{ DiscussionBoard.errors[9536489].message }}
          • Profile picture of the author PhilHardaker
            Recycling is good!

            But watch out for incompatibilities in old code. If you have been coding for a long time, or download projects from the internet written for example in PHP 4, and your current project is PHP 5.4 based, you might get bugs due to PHP version updates. Or the old code may need to be ported from global function and variable design to your object-oriented project.
            {{ DiscussionBoard.errors[9539003].message }}
            • Profile picture of the author sjeichman
              I have been programming since before there was dirt!

              A good developer always reuses code snippets to make the tasks of a new project go faster. As a seasoned developer who has programmed in many major languages, I have two pieces of advice.

              First, if you find yourself reusing code without making any changes (or very few changes), you should consider making that code a class or function that can be called from all of your projects. That way, if there is a bug that crops up, you only have to fix it one time.

              My second piece of advice: if you download code from the Internet to use in a project, make sure you understand how and why it works before putting it into your project. Many times, the code you download is very poorly documented. What I do if I download code code is to go through it and document it in my own words. That way, if I have to look at in the future, I don't have to figure out what it does all over again.

              Scott
              Signature
              {{ DiscussionBoard.errors[9541153].message }}
      • Originally Posted by mhowe91 View Post

        Yeah it is totally normal.l Work smart not hard
        Work smart, and hard to get the best results. However, then working hard work with motive, purpose and passion
        Signature

        [CENTER][B]==> Do you want to make money online? [/B]
        Free video: How regular people are making 6-figures per month on the internet! [URL="http://www.clkmg.com/fc27/UDCL-IN2WF"][B]Watch this free video now![/B][/URL] <==[/CENTER]

        {{ DiscussionBoard.errors[9553426].message }}
  • Profile picture of the author bjadams
    writing clear and maintainable code so that it can be reused is the way to go

    you can complete projects faster that way
    {{ DiscussionBoard.errors[9547131].message }}
  • Profile picture of the author mralexanderca
    I use the same code across projects all the time, I mostly do it in a form of classes and make them as generic as possible without being tied to a particular project. When developing in wordpress I already have it as plugin to include all these classes. This way you re-use and the efficiency is better because your functions need to be generic and work across all the sites. Hope this helps.
    {{ DiscussionBoard.errors[9548098].message }}
  • Profile picture of the author newgadget123
    Hi, yes mostly people re-use their code and i am also use because it makes our work easy also save our time too
    {{ DiscussionBoard.errors[9554849].message }}
  • Profile picture of the author webdeveloperindia
    Yes Of-course that's the way to save time and improve productivity!
    Even in same program with the help of functions we reuse the same code as many time we want just by calling them.
    {{ DiscussionBoard.errors[9555755].message }}
  • Profile picture of the author GaryCarlyle
    It is very common. Not just normal. What is the point in inventing a block of code when you can re-use perfectly good example from your own work or another persons.
    Signature

    UK TV abroad for free: http://WatchBritishTV.com

    {{ DiscussionBoard.errors[9557279].message }}
  • Profile picture of the author hanisnl
    without examples and copy/paste code I would have never learned the little that I know ... without reusing code you would not be able to use answers from other people ..

    so yes, normal and sometimes it's even recommended because some problems require smart solutions, and smart solutions don't just grow in your head all the time .
    {{ DiscussionBoard.errors[9560620].message }}
  • Profile picture of the author Member8200
    There's absolutely nothing wrong about reusing codes, in fact it's not a bad thing at all. I'm using that method and mix it up with my own set of codes, it saves me a lot of time doing so. Ofcourse you should understand what you are reusing, learn from it, play with it and then apply it to some more of your projects that you are gonna be doing.

    Personally, it doesn't matter on how you write the codes, it's all on how your program works and thats all that matters.
    {{ DiscussionBoard.errors[9561187].message }}
  • Profile picture of the author davidnavarro85
    Yes it is working normal. The reuse code is not showing error in the program.You can easily reuse the all types of code .
    {{ DiscussionBoard.errors[9624410].message }}
  • Profile picture of the author sdfghjhrd
    i am also use this code because our work easy also save our time
    thanx....>
    translation services uk
    {{ DiscussionBoard.errors[9624414].message }}

Trending Topics