Code Collage: Reuse, repurpose, regret! 🎃👨‍💻

|

code collage

A collage is an “artistic composition made of various materials (such as paper, cloth, or wood) glued on a surface”. What do you call code composed from various sources and glued together?

Do you find yourself writing code in short spurts before needing to go on a code hunt in your favourite search engine? It’s a warning sign if it’s happening often. You end up playing Dr Frankenstein pulling different little pieces together and tinkering until it splutters into life.

We have all been there (probably), I know I have. It’s an indicator that you’re going too far, too soon. You need to back up and understand things better, as difficult as this is to do. The cliché is learning a framework before you know the language it’s based on very well!

The obvious antidote is to know the fundamentals of the technology you are working in well, don’t bypass something because you think you know it, confirm it by using it.

Using libraries and frameworks is different than grabbing code snippets here and there. Libraries are tested and designed for re-use. Taking smaller pieces out of context is unpredictable and risky. Re-using code is good, ultimately you want to put your energy into realising your ideas, not to be replicating what has been done already. But to do that you need to put in the groundwork first, and then you can judiciously re-use what others have done. Then, you can stand on the shoulders of others and be taller.

scream collage

The thing is that no-one is immune to this completely. If we are honest, to some extent, we just want the result, not the striving, nor the doing really. Dedicate a statue to me already. Your code collage might work. If you can copy-and-paste your way to glory, imagine if you learn something well and understand it thoroughly! Hail, Caesar!

But a more basic psychology plays a stronger role. We procrastinate and then cram, leaving little time to read documentation and become acquainted with something unfamiliar. We don’t say ‘No’ to an unrealistic demand. We wander too far outside of our zone of competence, and can’t do what is expected by yourself, or others quickly. We are pressurised by management. We are anxious about a deadline and lose rationality, the reptile quarter of our brain takes over.

The obvious antidote is to know the fundamentals of the technology you are working in well, don’t bypass something because you think you know it, confirm it by using it. Get advice from experienced peers to know what is important. Build knowledge, applications, and confidence. Strive for consistency.

Everyone can be affected by this some time. It can be the case that in some jobs, the demands are not that various, you get asked to do a variation of the same work often. So you can find a comfortable niche of knowledge and you don’t have to stray from that. It’s only when you have to, it becomes a shock, and you may jump into collage mode again, forgetting the mishaps of your past collages.

But also, for me at least, it’s about knowing yourself better, and learning how to deal with situations better. We have 2 systems of thought: System 1 is fast, intuitive, and emotional; and System 2 is slower, more deliberative, and more logical. Guess which gets you into trouble most often? System 1. The simplest advice is: don’t rush or be rushed, ask questions upfront, and understand what you’re getting into early. This will serve you well whatever you need to do.

Like all advice, turning thoughts and intentions into positive actions is not simple, but if you do it enough, it will become a positive habit for you.

Happy coding! 🙂

Related Posts