Scripts that try to do too much

If you look at my scripts page, you will find a number of “unsorted” scripts near the bottom. Most of them are pretty old, and most of them aren’t particularly flexible.

The problem with many of them is the simple fact that “they do too much”. Someone makes a suggestion and wants the script to do something, and for whatever reason I decided to add it as a feature. Adding a single feature would require changes to the default script-base, and the changes may decrease compatibility with other scripts.

Eventually, a script may become bloated with too many “related” features and just becomes useless. So the lesson here is a common programming paradigm: a script should really only do one thing, and do that one thing well.

If you have two very similar ideas, write them as separate scripts.
If one script requires another one, make it an add-on, don’t combine them into one.

A good example would be the FP inventory system. It supports TOO many things, and doesn’t do them very well.

  • item limits
  • weight limits

These are two things that really should have been written as separate add-ons, rather than being built into the script. The base inventory system should only provide the logic for managing inventory: adding items, removing items. Nothing else.

While it doesn’t sound like too much work to JUST put in some logic for placing limits, if the logic is implemented poorly as it has been done in that script, then it becomes too much of a headache to try to make it compatible with anything else, or to extend it, or to try to even fix bugs.

Even worse, it comes with windows for the item limit and weight limit. This essentially forces your project to use a specific menu design, which is terrible. Although it would be nice to provide a window for it because most users aren’t able to do so themselves, that should be left as an add-on script and never integrated with the base system.

Users may not enjoy having to download 5 scripts when they could have everything in one, but we’re the ones writing the code, not them. If they would like something easier to use than they can continue to search for alternatives that will provide everything in one file.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *