Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [code-reuse]

The use of existing code for creating new software.

0
votes
1answer
65 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 ...
0
votes
1answer
24 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 ...
4
votes
0answers
124 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 -...
1
vote
1answer
35 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 ...
-1
votes
1answer
90 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 ...
78
votes
9answers
16k 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
1answer
238 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 ...
1
vote
2answers
55 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
284 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 ...
1
vote
0answers
36 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 ...
3
votes
2answers
350 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 ...
1
vote
1answer
41 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 ...
0
votes
3answers
114 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 ...
12
votes
2answers
365 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 ...
2
votes
1answer
190 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 ...
-1
votes
1answer
117 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 ...
0
votes
1answer
83 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
118 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
407 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 ...
0
votes
1answer
120 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 ...
3
votes
1answer
94 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 ...
2
votes
3answers
413 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'...
12
votes
8answers
583 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 ...
0
votes
2answers
209 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) --> ...
7
votes
1answer
551 views

Reusing a top-level DTO as a child in another DTO

What is the recommendation regarding re-using DTO's as a child in another DTO? I'm using ASP.NET Web API (C#) and consuming the results with Angular 1.x (not sure if that really matters). I have the ...
2
votes
3answers
188 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 ...
79
votes
11answers
10k views

Shouldn't unit tests use my own methods?

Today I was watching a "JUnit basics" video and the author said that when testing a given method in your program, you shouldn't use other of your own methods in the process. To be more specific, he ...
0
votes
2answers
446 views

Using GNU GPL V3 on a project. Reuse and modify foreign code

I'm programming on a c project and use code from another author. I change the main functionality to a new, complete other one. The most of the new code is my own but some files are untouched and ...
3
votes
2answers
110 views

Defining reusable components while having a specific application in mind

Over the past several months I have learned a lot in software design and practices across several languages and frameworks. To me, the most attractive and useful designs patterns are those that follow ...
2
votes
2answers
146 views

How to avoid code duplication or cascaded changes and major refactoring in business logic layer?

Let's say, I have created a business logic layer service (or a handler in Command/Query pattern) with a method DoSomething which processes a bunch of entities and stores them in database. Later on, ...
5
votes
2answers
602 views

How does one structure an assembly-language project?

So, I'm taking a MIPS course after returning to school; and we're approaching the point where we begin on our final project. I've always been one for large, well-structured projects: lots of ...
6
votes
3answers
259 views

Is it better to try and implement incomplete code, or write your own?

Our application is a 6-year old legacy application made by out-of-house contractors. Occasionally we stumble upon the skeleton of something they put together but never implemented, and it causes us ...
1
vote
1answer
1k 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 ...
3
votes
1answer
433 views

What are best practices when it comes to extensions in Swift with reusability in mind?

I like the Swift way of trying to eliminate unintended consequences wherever possible. Whenever there is a change to the language that deprecates something I have been doing for years, it forces me to ...
1
vote
1answer
75 views

Package Interfaces - Coupling & Re-Usability

Intent Packages should be designed to perform a single function well. Ideally this means that they should be highly modular and different packages should be able to be 'plugged-in' simply by ...
0
votes
2answers
373 views

Writing extensible versus deletable code [closed]

I know this might just be semantics, but reading the article titled Write code that is easy to delete, not easy to extend made me think that perhaps it is more or less along the same lines of creating ...
2
votes
1answer
256 views

Best approach to avoid duplication of code meant to run on windows/iOS/Android devices?

I am working on a new version of the following system: A 'main control' service that runs on Windows Server (C#). Clients on the following systems, that communicate with the above service via Web ...
3
votes
4answers
1k views

Reusing the logic in another repository in ASP.NET MVC repository pattern

I have an ASP.NET MVC4 web application, with EntityFramework for data access. In the application I have two repositories as follow (this is only an example not my real code): public class ...
2
votes
2answers
3k views

Merging two applications into one

Background: My bosses want to merge two application that have two separate purposes. One being for monitoring of equipment and bandwidth for our internal network operations. The other is an ...
4
votes
2answers
129 views

How to help programmers use existing shared classes, instead of reinventing them? [duplicate]

My company has a fairly large software project (a couple million lines of code spread across many assemblies.) One sticking point we've consistently run into during code reviews has been with the use ...
2
votes
3answers
173 views

Single responsibility policy problem

I'm a bit stuck using the single responsibility policy. I have a class named Parser, which can be configured to parse input a certain way. For the sake of convenience I will limit the configuration ...
1
vote
1answer
59 views

Developing an application where a chunk of the code is used by both the app the tests

I'm developing a web app in PHP where part of the code I'm developing for it will also be used in the tests. I'm not sure how to handle this. That code in question is an abstraction to communicate ...
0
votes
2answers
349 views

Built-in the separate thread execution inside of the method or wrap the method by the thread

Let assume, I have some resource and time-consuming code, which I want to arrange as a separate method. In order to optimize the performance, this code should be executed in the separate thread. Now ...
3
votes
2answers
204 views

Sharing functionality between platforms and languages

I'm in a situation where I already have a working, high-performance C++ program with GTK and OpenGL that renders data as a real-time graph. The data is saved as a report in a database which can be ...
0
votes
2answers
198 views

How to change the same code stored in several places after I improve one of them?

I have some code written in Matlab. I use the code in different folders which contains different data. Because I want to change some parameters for each different data, I keep the code in the folder ...
7
votes
6answers
1k views

What are the most used pattern to manage a lot of interconnected parameters?

I recently start to work on an application that drive different measurement device. Before the user start a measure, she sets the parameters of it. Actually, considering all measurements type there ...
4
votes
3answers
162 views

Unit of Design Versus Unit of Re-use. What is the difference?

Contemporary object-oriented programming languages employ the class as the unit of reuse. At the same time, the class is also the unit of design. This implies that to reuse a class, the design of ...
8
votes
6answers
1k views

performance versus reusability

How can I write functions that are reusable without sacrificing performance? I am repeatedly coming up against the situation where I want to write a function in a way that makes it reusable (e.g. it ...
3
votes
1answer
228 views

Should I modify an algorithm I coded for my employer if I remember the code perfectly and want to reuse?

My employer asked me to code a simple algorithm from a general description published by someone on the Internet (no code/pseudocode, just plain words and pictures). So to clarify, it's not my employer'...
1
vote
5answers
308 views

Making an automotive system more 'modular' in terms of software?

I am working on an automotive project that we are supposed to make more modular. I am a software specialist and I have very little knowledge of automotive hardware. I don't have any requirements or ...