Questions tagged [code-reuse]

The use of existing code for creating new software.

Filter by
Sorted by
Tagged with
1
vote
1answer
138 views

Should we put small, potentially often-used pieces of code into tool methods in a shared library? [duplicate]

I recently switched jobs to a new company which develops a .NET framework based product which has been on the market for like 15 years already. Some of the engineers are in this project almost from ...
1
vote
1answer
70 views

Using the objects retrieved at the time of request validation

I hope the question title already answers the subject here. Lets say I have a number of ids that needs to be validated in a request. Example: request uri: [POST] /album/{album_id}/song Request ...
7
votes
5answers
297 views

How to keep developers informed about a code library in large organizations?

Although our products often have the same requirements, the solutions are always developed anew. From different people, with different good results and different quality. A code library especially for ...
9
votes
5answers
1k views

Too much abstraction making code hard to extend

I'm facing problems with what I feel is too much abstraction in the code base (or at least dealing with it). Most methods in the code base have been abstracted to take in the highest parent A in the ...
0
votes
1answer
137 views

Application architecture using CQS and DDD Aggregates

I am working on a microservice architecture using CQS and with domain objects built using DDD aggregates. I am just beginning to learn about CQS, CQRS, Domain Driven Design, so excuse me if what I ...
6
votes
0answers
217 views

Implementing new project to communicate with old ones. The correct way

I'm not sure if this is the right place to post this (I'm fairly new, but Stackoverflow and Superuser suggested this site for my question), but here goes. I currently have the following: A frontend -...
0
votes
3answers
345 views

Code Design: Repeatedly doing the same Boolean check with Stream Writer

I have several areas in a program where I am doing the following check on the same two booleans, but each spot has different text being written to a file via Stream Writer based on the value of the ...
-2
votes
3answers
192 views

Code design: introduce new method vs add optional parameter to existing method

In JavaScript (ES6), I can have optional function parameter with default value. So to add a new behavior to the existing code base, I could either introduce new method(s) or extend the existing method ...
0
votes
2answers
98 views

Tool or strategy to remember code structure and where I left [duplicate]

I am working on multiple projects as a developer and second line support, It happens that I fix a bug on one project, test and deploy the change then leave the project for months and return back for ...
0
votes
1answer
104 views

Re-usability in C++ using Interfaces and External Configuration

I am practicing professional C++ by building a differential drive robot that applies a Go-To-Goal Behavior. What is I have written so far is an Agent that consumes the following interfaces: ...
1
vote
0answers
46 views

Manage several procedures

I have a software project which grows rapidly in an unexpected way, many customers request similar tasks but with slightly different needs and parameters. I start to dislike my current code structure ...
2
votes
1answer
424 views

Is 'Keep it looks similar to sample code' a valid reason to prefer WET over DRY principle?

For example, for oauth, I may need to copy and paste oauth and oauth callback code like it (assume Client is the framework I use, I don't use real framework like google because I want to simplify the ...
81
votes
9answers
17k views

How do huge open source libraries get maintained while having code far from “clean code” practices?

I'm still inexperienced to write high quality code, so I read books addressing the issue such as Clean Code by Robert C. Martin, and keep checking code of well-known libraries to improve my skills. ...
2
votes
2answers
221 views

How to avoid code duplication in two similar projects?

We have a website with a lot of functionality, and we now start another one, which should have a lot of common code with the first one. What would be the best approach to avoid code duplication? ...
0
votes
2answers
93 views

Reuse domain entity logic

Usually the domain logic should be contained in the domain entity, rather than being put in specialised external classes called from the entity. This is good to prevent that somebody comes later, ...
1
vote
3answers
232 views

Does providing multiple APIs reduce code re-use

Within an organisation, suppose you have an internal tool used by different teams and for different use cases. This package offers APIs in different languages. One could say that having multiple APIs ...
1
vote
1answer
322 views

How to remove code duplication in Web API versioning

I'm working with ASP.NET core web API project, where I have 8 controllers, multiple DTOs being used for request and response and mappers to map models(also used in the web app) with DTOs. Recently, ...
-2
votes
2answers
246 views

How can a company know that I re-used some techniques? [closed]

I'm a software engineer in a company. However, I'm planning to start a self project very soon. I wonder if I am allowed to re-use the code I have written in my company product in my project. It is ...
0
votes
1answer
25 views

Share some small bits of functionalities across packages

Suppose that: you invent a new coordinates system and you create a class to represent it you have two products which need to deal with this coordinates system but which, apart from that, are ...
5
votes
5answers
1k views

Reusing open-source code that doesn’t specify a license

I am creating a module for a CMS. I found a PHP code in github that does some work for me. The author has not clearly stated the license for the code. Since it is in github and is publicly available, ...
-1
votes
1answer
95 views

Removing a framework support from a big project

I need to remove a framework(vertx, to be specific) from a project(lib) which is the base for other projects as well. What would be the best approach to remove all dependencies on the framework from ...
1
vote
2answers
178 views

Reusable component with web service

I am trying to create a reusable component / Cocoa Touch Framework in Swift that would display the current weather based on the user’s location. Right now I cannot decide which approach should I take....
5
votes
3answers
341 views

Best practices on sharing code between open source libraries

I have an Android library used by a decent amount of people, let's call it library A. I am building a second library, library B. The two libraries are conceptually related, they solve different ...
3
votes
2answers
414 views

In which programming paradigm can't code reuse be (easily) achieved?

In a video about software architecture that I'm watching, it's stated that the main program/subroutine architectural style promotes modularity and function reuse Code reuse is one of the main ...
0
votes
3answers
119 views

Separated implementations or one with all functionalities

I am currently creating Excel import modules for some complex data. I didn't plan it well and I have met code reuse issues. I have made first modules and I realized that next modules will need some ...
1
vote
1answer
44 views

External code - copy or use path?

I have a lot of code that is needed for several projects - units, include files, resources and more. These files are writen by myself, downloaded or cloned with git and have their own place in the ...
12
votes
2answers
429 views

How to avoid duplication of data structures when parts of an app are written in different languages?

As an example, say you are writing an app in Java. Your app communicates with an API server written in Python. The Python server communicates with an SQL database. You also have a website for your ...
16
votes
9answers
2k 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 ...
16
votes
6answers
3k 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 ...
56
votes
19answers
18k 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 ...
2
votes
1answer
263 views

How can the reusability of Python code be measured and quantified?

For example, let's assume we have a class that is imported three times from other classes. This would lead to a reusability of three. However, as there might be functions that are called only once, it ...
8
votes
8answers
2k 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 ...
23
votes
7answers
4k 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 ...
-1
votes
1answer
138 views

How to keep reusable plugin up-to-date while programming from inside a project with git

I've asked this question myself for a thousand times now but I can't seem to find the correct answer. I'd like to separate a part of reusable code from the actual project however both the project and ...
3
votes
3answers
283 views

Good approaches for sharing reusable components between teammates

Question: Talking about software development, how to provide good approaches to achieve a repository of reusable components inside a project? Context: Working on a team of 10 coworkers may be very ...
0
votes
1answer
86 views

Moving interfaces but not concrete classes

Recently I started working on creating a client library. One problem which I am facing now is that I have to move the below interface Attributes to client library but the concrete classes (business ...
-3
votes
2answers
126 views

Implementing functional/reusable code [closed]

Writing code, in my opinion, usually involves 2 kinds of code: logical and functional code. While the logical part of the code always differs between every app and its goals, often the functional ...
1
vote
2answers
419 views

How useful is line-by-line code re-use?

In my workplace, the client is obsessed with line-by-line code reuse. And they use a tool that uses LoC as measure of code re-usability. Often for two modules, if the logic is same as of now, those ...
17
votes
11answers
1k 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?
0
votes
1answer
135 views

How to provide Java libraries internally?

In my small team we write applications that run as a Jenkins job and using the SOAP API of our Bug Tracker, our ALM software. They are accessed with Java however I think developers using other ...
2
votes
1answer
115 views

Organizing code to minimize repetition and external references

I am struggling with how to organize external references in a C# program in order to minimize code repetition. I have application "A1" for which I want to use Microsoft's Unity IoC/Dependency ...
10
votes
5answers
1k 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 ...
1
vote
1answer
2k views

What is the correct reusable architecture using Entity Framework for common database tables and services?

Context I have a line of business application "MyApp" in C# using EF. Layers are separated as MyResusableLib.DataAccess // Class Lib: EF based utils, extension methods, MyApp.DataAccess // Class ...
31
votes
12answers
3k views

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

Throughout my various workplaces I always wrote code which made me think "this would be really useful in other situations". Indeed, I intentionally write code, even if it takes me longer write, which ...
2
votes
3answers
429 views

Refactoring Atrocious Java Code [duplicate]

So I recently started a new job for a small software company. They've got some old technology which I was aware of during the interview process. However, I've been digging into their code-base, and I'...
0
votes
2answers
223 views

What architecture/guidelines should be considered to write reusable module of project?

Introduction I am working on MyProject which is windows (desktop) application being developed in C#.NET and DotNet Framework 4 in WPF. Project is layered as DataAccessLayer (DAL) --> ...
42
votes
16answers
8k views

Are there concrete reasons not to use libraries and code snippets heavily? [closed]

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 ...
12
votes
8answers
619 views

Proper design for a class with one method that can vary between customers

I have a class used to process customer payments. All but one of the methods of this class are the same for every customer, except for one that calculates (for example) how much the customer's user ...
6
votes
4answers
545 views

Not Invented Here - what does it take to not succumb to it?

I will start with one, which however did not work the way I wanted. Vendor Evaluation: In the beginning of the project, we spent some time to do a survey of existing open-source libraries that can be ...
6
votes
3answers
3k 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, ...