The smell of Copy&Paste
I often read phrases like these “adding a new module to our application is very simple, just copy&paste some code” or “to create a new class you have to copy&paste from an old class”. In my opinion this there is something wrong about this. Copy&Paste is a smell. If you need the Copy&Paste to add some functionality to your application means that you are duplicating your code and then you will be in trouble when you need to maintain it.
What could you do? When the second Copy&Paste happens, stop, read your code, extract a class and “encapsulate what varies“.
Posted in Emanuele DelBono | No commentsNo comments yet. Be the first.
Leave a reply
RSS


