logo
logo
Sign in

Is Copy-and-Modify Reuse a Good Option?

avatar
Nishit Agarwal
Is Copy-and-Modify Reuse a Good Option?

Copying and pasting programming (creating and reusing a copy of existing code in a project) violates coding best practices such as Don't Repeat Yourself (DRY). This is one of the most cited examples of technical debt, a lazy way of working, a sloppy, short-sighted one. An anti-pattern that increases the long-term cost of maintaining a codebase. But it's also a natural way to get things done-find what's already working, the one that corresponds to what you want to do,  copy it and use it as a starting point. Almost everyone has participated so far in a full stack developer course. Not only is it convenient, but it may be correct to program with copy and paste.

 

First of all, let`s be clear about what I mean by copy and paste. This is not copying code examples off of the Internet, a practice that comes with its own advantages and problems. By copy and paste I mean when programmers take a shortcut in reuse – when they need to solve a problem that is similar to another problem in the system, they`ll start by making a copy of existing code and changing what they need to. Early in design and development, copy and paste programming has no real advantage. The code and design are still plastic, this is your chance to come up with the right set of abstractions, routines and libraries to do what the systems needs to do. And I don't often copy it anyway. The copy-and-paste discussion is much more complicated, especially if you're managing a large, long-lived system late in development with lots of code already.

 

Why Copy and Paste?

Copy and paste the programmer architecture to save hours. First, there is a starting point. I know the code works. All you have to do is understand what needs to be changed or added. You can focus on the problem you want to solve, what's different, and all you have to do is understand what you're actually trying to use. Feel free to make repeated changes to reflect the problem first. You can clean up your code as needed and remove unwanted code. All of this is important because you may not know what to keep, what to change, or what you don't need to work hard to solve the problem in the online software development course.

 

Copy and paste programming also reduces risk. If you need to go back and modify and extend your existing code to run your current code and solve new problems, you run the risk of breaking what's already working in course front end developer. It is usually safer and cheaper (at least in the short term) to make a copy and work from it.


What Happens if I Create a New B2B Customer Interface for Use by a New Customer Group?

Perhaps it makes sense to start with an existing interface, reuse scaffolding, plumbing, wiring, and at least reuse as much business code as possible to see what needs to be changed. After all, there is some common code that is shared by both interfaces (after all, that's why it makes a copy), but it can take some time to figure out what that code is.

 

Finding a common design, appropriate abstraction, and variation to support different implementations and handle exceptions can be difficult and time-consuming in software development. The original design did not anticipate various exceptions and extensions, which can make the code difficult to understand and difficult to maintain or modify in the future. New designs and implementations may be required. Modifying existing code, redesigning some parts, or rewriting it into something that is common, shared, and extensible increases the cost and risk of working in advance. You can't afford to cause problems for existing customers or partners just because you want new customers to go online. You need to be very careful and understand the details of what you are currently trying to do (new user interface), as well as all the details of an existing user interface, its behaviour, and the assumption that you can maintain everything.

 

With the right set of automated tests, it's easy to assume that all of this behaviour will be incorporated into the automated tests. You need to go back and repeat the integration testing of the existing interface. Retrieving a customer or partner who may have spent weeks or months trying out the software can be difficult and costly. What you have is already working well, so you won't (correctly) see the need to invest that time and money. The correct approach here is to copy and paste now, then go back and refactor it later, or plan to redesign a common solution if needed.

 

If Copy and Paste Makes

Creating Software in "Copy Paste as a Principle Engineering Tool", Michael Godfrey and Cory Kasper talked about the cost of copy and paste programming and copy and paste makes sense. Find out if you have. Creating variants for hardware or platform variations, or for exploratory reasons. Templates-Some languages ​​don't properly support libraries and sharing features, so you may need to copy, paste, and share your code. At some point, in the beginning, the first COBOL programmer created a complete COBOL program. All the other programmers copied and pasted each other. Customization-Create a temporary workaround-as long as it is temporary. Microsoft's "cloning and ownership" practices for solving problems in large development organizations. The team gets the code from another group and adapts it or adapts it to their own purpose.

collect
0
avatar
Nishit Agarwal
guide
Zupyak is the world’s largest content marketing community, with over 400 000 members and 3 million articles. Explore and get your content discovered.
Read more