The use of existing code for creating new software.

learn more… | top users | synonyms

84
votes
12answers
5k views

Best practices for sharing tiny snippets of code across projects

I always try to follow the DRY principle strictly at work; every time I've repeated code out of laziness it bites back later when I need to maintain that code in two places. But often I write small ...
43
votes
8answers
5k views

Why shouldn't classes be designed to be “open”?

When reading various Stack Overflow questions and others' code the general consensus of how to design classes is closed. This means that by default in Java and C# everything is private, fields are ...
42
votes
7answers
3k views

How do you keep track of what classes and functions your team has written?

When working on code, I face many of the same challenges that my teammates do, and I have written some helpful functions and classes, and so have they. If there is good communication, I'll hear about ...
32
votes
18answers
7k views

Does OOP fulfill the promise of code reuse? What alternatives are there to achieve code reuse?

Perhaps the greatest promise of using object-oriented paradigm is the code reuse. Some dispute that this was achieved. Why was it (not) achieved? Does code reuse as OOP defines it, make projects more ...
32
votes
9answers
1k views

How do I overcome paralysis by analysis when coding?

When I start a new project, I often times immediately start thinking about the details of implementation. "Where am I gonna put the DataBaseHandler? How should I use it? Should classes that want to ...
32
votes
5answers
2k views

Are there any actual case studies on rewrites of software success/failure rates?

I've seen multiple posts about rewrites of applications being bad, people's experiences about it here on Programmers, and an article I've ready by Joel Spolsky on the subject, but no hard evidence or ...
30
votes
15answers
2k views

Does heavy library and code snippet usage make you a bad programmer?

Overall I'm in programming for about 8 years now and it seems to me that I'm relying more and more on open source libraries and snippets (damn you GitHub!) to "get the job done". I know that in time I ...
29
votes
16answers
2k views

Do you have your own 'misc utils' library? What part are you most proud of? [closed]

I know that many of us maintain our own little personal library with tools and utilities that we use often. I've had mine since I was 16 years old so it has grown to quite a considerable size. Some ...
28
votes
4answers
3k views

What did Rich Hickey mean when he said, “All that specificity [of interfaces/classes/types] kills your reuse!”

In Rich Hickey's thought-provoking goto conference keynote "The Value of Values" at 29 minutes he's talking about the overhead of a language like Java and makes a statement like, "All those interfaces ...
26
votes
11answers
2k views

Is it wrong to take code you have produced at work and re-use it for personal projects?

Throughout my various workplaces and through my university life I always wrote code which I thought "this would be really useful in generic situations". Indeed, I intentionally write code, even if it ...
26
votes
9answers
1k views

What's your view on using other people's code? [duplicate]

As per this question: I decided to implement the BitTorrent spec to make my own client/tracker. Now, I was going through the spec, I was about 70% done implementing the BEncoding when I found a link ...
21
votes
7answers
1k views

Does software reuse preclude process repeatability

The Problem - Code Reuse I was thinking about this question on software delivery, and I kept coming back to the issue of repeatability and / or reproducibility. They matter, because if you don’t ...
20
votes
6answers
2k views

Is it legal to reuse code in other customers' projects?

I'm working as a independent software developer for mobile applications. A customer asks me to develop a mobile app. So at the moment I'm calculating the time and effort to write an offer for this ...
19
votes
8answers
1k views

Adding complexity to remove duplicate code

I have several classes that all inherit from a generic base class. The base class contains a collection of several objects of type T. Each child class needs to be able to calculate interpolated ...
15
votes
11answers
723 views

Have objects delivered in terms of code reuse?

I have often heard it said that objects have not delivered in terms of code reuse. Do you agree? If you believe that they haven't, why not?
15
votes
7answers
523 views

How do you structure your shared code so that it is “re-findable” for new developers? [duplicate]

I started working at my current job about 8 months ago, and its been one of the best experiences I've had as a young programmer. It's a small company, and both my co-developers are brilliant guys. ...
15
votes
4answers
441 views

Does “don't reinvent the wheel” ignore the limits of human memory?

One thing working in Haskell and F# has taught me is that someone in a university smarter than me has probably already found an abstraction for what I'm doing. Likewise in C# and object-oriented ...
14
votes
9answers
816 views

How to promote code reuse and documentation? [closed]

As a team lead of about 10+ developers, I would want to promote code reuse. We have written a lot of code-- a lot of them are repetitive over the past few years. The problem now is that a lot of these ...
12
votes
5answers
767 views

I released open source code that is useable to other programmers. How do I let them know about it? [duplicate]

I have a tiny project (<1k but let's say its <5k of lines). I made it open source and put it on github. I did this once before and I didn't get a single download nor fork but that was very ...
12
votes
3answers
436 views

Is there a software engineering principle that relates reuse and regression test cost on a production system?

I've worked on a large financial transaction system for a bank that looked after Pensions and Investments. After 15 years of feature changes, the manual regression test cost had climbed to $200K per ...
11
votes
5answers
483 views

Code repetition vs multi responsible method

I try to follow the Single Responsibility Principle (SRP) and also to omit Code Repetitions. However there are often places where there are code repetitions that are nothing more than code blocks of ...
11
votes
2answers
397 views

What ever happened to the Defense Software Reuse System (DSRS)?

I've been reading some papers from the early 90s about a US Department of Defense software reuse initiative called the Defense Software Reuse System (DSRS). The most recent mention of it I could find ...
10
votes
7answers
878 views

Rule of thumb for cost vs. savings for code re-use [duplicate]

Is it a good rule of thumb to always write code for the intent of re-using it somewhere down the road? Or, depending on the size of the component you are writing, is it better practice to design it ...
9
votes
2answers
413 views

What is 'code skew'?

In the O'Reilly book on Scala, I read that copy-pasting of code creates: ... creates issues of code-bloat, maintainability and skew, I can't see any obvious definitions of the word skew in ...
8
votes
4answers
717 views

How to deal with code reuse philosophy?

I constantly find myself thinking about code reuse when starting a new project. To what extent should I make my code reusable? Should I limit it to the application scope or should I make it reusable ...
8
votes
8answers
580 views

What counts as reinventing the wheel?

Do the following scenarios count as "reinventing the wheel" in your book? A solution exists, but not in the language you want to use, and existing solutions can't be interfaced with the language you ...
8
votes
3answers
556 views

Reinventing the wheel because it doesn't exist

One of the languages I have to use at work is a very small, niche language called psl. One of the largest complaints I have about it as a language is that the libraries are very limited. While that's ...
8
votes
4answers
181 views

Advice/Approach for distilling homogenous code and building common code for a team

I work for the State of California. Our programming team in my opinion is not really a 'team' in that we usually work solo on projects throughout the application/systems complete life-cycle. The end ...
8
votes
1answer
282 views

Using my own code in freelance projects

I have been into freelance business for more than 2 years. While doing projects for other people, I've build a compilation of common tasks that I implement in projects and put them into code. It's ...
7
votes
5answers
977 views

Is code duplication a necessary evil in C?

I'm rather new to C, and I'm wondering if code duplication is a necessary evil when it comes to writing common data structures and C in general? I could try to write a generic implementation for a ...
7
votes
8answers
596 views

Quality vs Time

I have heard of developers who work with code which is a complete mess because originally the code was quickly developed and the quality was not there in the first place. Its always good to get ...
7
votes
6answers
3k views

When you use inheritance to reuse code, do you find it too tricky that it swallows the benifits of reuse?

I've been coding for about 8 years, however I still find inheritance is too flexible and sometimes it makes you totally confused with the code you have written. One simplest example would be: ...
7
votes
4answers
2k views

Abstract methods vs instance variables for reusable objects

I have quite a bit of Java code that I'm re-working to be re-used. The problem is that there are many pieces that are project specific so there are ends up being a higher level of coupling between ...
7
votes
7answers
430 views

How to refactor while keeping accuracy and redundancy?

Before I ask this question I will preface it with our environment. My team consists of 3 programmers working on multiple different projects. Due to this, our use of testing is mostly limited to very ...
6
votes
7answers
1k views

What exactly is OO reuse?

And why is it often talked about? Like I know what OO programming is obviously... but people always say "Oh OO reuse is the biggest programming myth ever". What exactly does this mean?
6
votes
8answers
338 views

What should be done with code that has reached end of life?

When a project has reached end of life and is being retired, either because the technology is obsolete, a newer version of the program has been rewritten, or it no longer solves a problem that is ...
6
votes
4answers
601 views

In what situations is it a bad idea to use open source code for a corporate project?

Are there any situations where it may not be a good idea to use the code of an open source project, even if your company might allow you to do so? Some cases that I think might be valid include: ...
6
votes
7answers
705 views

How can I promote software reuse in a large company? [duplicate]

Take a large company, formed through many iterations of mergers and reorganizations. This company produces lots of different products that are all targeted to a specific industry. Most products share ...
6
votes
5answers
389 views

Logistics of code reuse (OOP)

One of the driving points behind OOP is code reuse. I am curious about the actual logistics of this and how others both in team or solo handle it. For example lets say you have 5 projects you have ...
6
votes
6answers
289 views

Should I keep writing my own code, or get in the habit of RE-USING [closed]

this is a general question about programming, I hate using other people's code and I find myself coding things in my own way, even the simplest things like a web template, a PHP calendar, or a news ...
6
votes
3answers
295 views

Should public code libraries I have written stay free and open after using them in a contract / commercial product?

I have written a small library of classes in my preferred language (PHP, but it doesn't really matter), and typically use them in most of my projects. Until now, the projects have been personal, or ...
6
votes
5answers
487 views

Successful Common Code Libraries

Are there any processes, guidelines or best practices that can be followed for the successful implementation of a common code libraries. Currently we are discussing the implementation of common code ...
5
votes
4answers
442 views

How to apply one of the OOP concepts (Closed for Modification and Open for extension)?

Days before, I created Question, Quiz, and Main classes. One Quiz has one or more Questions. From the main class I first create Question objects (the constructor accepts an array of numbers). The Quiz ...
5
votes
4answers
512 views

Architecture suggestions on a multi-project multi-database 'intranet'

Here is the situation I have inherited: We have approximately 10 websites (Asp.net web forms) that each have their own database. Each of these databases houses some site specific data, and each has ...
5
votes
1answer
330 views

Source of this quote about code reusage? [closed]

does someone know where this quote comes from? I don't know it literally, but I know what is is about. Something like: Writing code more than once is a waste of energy and creativity. I think ...
4
votes
3answers
189 views

Where should I place my interface?

I have an interface to communicate with a DB (actually it is not a database, but this is to give a concrete example): interface DbInterface{ Result sendQuery(Query q); } And I am trying to ...
4
votes
3answers
491 views

Is there a term for reusing code by retyping it?

I built a prototype ("one to throw away") a while ago, and I'm rebuilding it now as an alpha. My goodness, it's been worth it. I reused some of the prototype code by copy-pasting then modifying it, ...
4
votes
6answers
400 views

Code reuse: Reusing complex method vs. cherry-picking parts

I am currently facing a situation where I am not quite sure how to best proceed. Background I am planning a new data import process, which will import personnel and salary information from a text ...
4
votes
6answers
655 views

When is a 'core' library a bad idea?

When developing software, I often have a centralised 'core' library containing handy code that can be shared and referenced by different projects. Examples: a set of functions to manipulate strings ...
4
votes
3answers
210 views

How to avoid programmers duplicating code [duplicate]

While I know in a perfect world where a greenfield application was scoped out from day one with great BRD's and a competent development lead constantly reviewed code by their underlings to avoid this, ...