Code Smell 138 - Packages Dependency

Photo by olieman.eth on Unsplash

Code Smell 138 - Packages Dependency

There's an industry trend to avoid writing code as much as possible. But this is not for free

Maxi Contieri
·Jun 3, 2022·

2 min read

Subscribe to my newsletter and never miss my upcoming articles

Play this article

Table of contents

  • Problems
  • Solutions
  • Context
  • Sample Code
  • Detection
  • Tags
  • Conclusion
  • Relations
  • More Info
  • Credits

TL;DR: Write your code unless you need an existing complex solution



  1. Import and implement trivial solutions

  2. Rely on external and mature dependencies


Recently, There's a trend to rely on a hard to trace dependencies.

This introduces coupling into our designs and architectural solutions.

Sample Code


$ npm install --save is-odd

// This package has about 500k weekly downloads

module.exports = function isOdd(value) {
  const n = Math.abs(value); 
  return (n % 2) === 1;


function isOdd(value) {
  const n = Math.abs(value); 
  return (n % 2) === 1;

// Just solve it inline


[X] Automatic

We can check our external dependencies and stick to the minimum.

We can also depend on a certain concrete version to avoid hijacking.


  • Security


Lazy programmers push reuse to absurd limits.

We need a good balance between code duplication and crazy reuse.

As always, there are rules of thumb but no rigid rules.


More Info


Photo by olieman.eth on Unsplash

Thanks to Ramiro Rela for this smell

Complexity kills. It sucks the life out of developers, it makes products difficult to plan, build and test, it introduces security challenges, and it causes end-user and administrator frustration.

Ray Ozzie

This article is part of the CodeSmell Series.

Share this


Technical Opinions are my own. I don't have the revealed truth.

Software Design is a creative activity. These are hints and not rigid rules.

I write on BackEnd Business Systems and OOP Design. My advice/experience might not suit other systems.

You can write me at info(at)