I don't actually think reusable software is bad, but I do think excessive reliance on it is bad. Reusable software, in the form of libraries, frameworks, or even clips of code off Stack Overflow, is very useful but also very dangerous, and dependence on reusable code is downright harmful.
I've written about frameworks before. I don't like them. They encourage laziness, and they often fool developers into thinking they are saving time when in reality they are not. They also impact design in ways that a well designed set of tools should never do. A perfect tool is one that never gets a thought during design but can then be used to implement the design flawlessly, without any modifications to accommodate for the idiosyncrasies and limitations of the tool. A framework is supposed to be a full toolkit, but why then do most modern websites include at least three frameworks? And worse, why is it that most websites use exactly the same tools from each one, and neglect exactly the same tools from each one?
Reusable software is dangerous, because it breeds dependence and it enables incompetence. In 2016, this was really brought home, when the creator of a NodeJS library removed his 11 lines of trivial code from NPM, and it broke thousands of websites. All these lines of code did was to pad out the left side of a string with spaces or zeroes, a task so trivial it could be done in only 10 lines of code (the eleventh was merely bookkeeping code that would be unnecessary had users implemented it themselves). In fact, a slight style change would have taken it down to 9 lines of code. There was nothing novel about his implementation either. Any competent developer could have written that code in less than a minute. In fact, most applications could have used a sightly shorter version, with only 8 lines of code, provided they only needed space padding or '0' padding and not both. Why didn't they then? They had become so dependent on reusable code that they did not even consider that they could write it themselves. They did not consider that it could one day disappear, because they did not write it and thus had no special right to continue using it indefinitely. Some may even have lacked the competence to write it themselves, and the use of the library enabled them to remain incompetent.
The decision to use reusable software instead of writing it yourself should always be taken very seriously. Why do you want to use reusable software? Is it because you don't know how to do something yourself? If that is the case, then maybe it would be better to look into it. Not only might it be easier to do it yourself, you might find you can make it fit your needs better that way. If you want to use it, because you think it will take longer to do it yourself, keep in mind that we tend to underestimate how long things will take, and that includes learning how to use someone else's code! It is often faster to create your own implementation of a feature than it is to learn to use a framework or library containing that feature. Unless you are going to use a lot of features of a framework or library, it might actually be faster to just implement what you need yourself. And it is worth learning now: Popularity is never a reason to use a particular piece of reusable code. In this field, things come and go very rapidly. Things that get popular fast often disappear fast as well. If you need to use reusable software, because you know it is too difficult or time consuming to do yourself (OpenGL, for example) or because you need to use a lot of the features it offers and it is a good fit for your application, then it might be worth using. If you just want to learn something new, maybe it would be better to learn something with broader applications and better staying power.
No comments:
Post a Comment