Generic and specific knowledge

How do you decide which framework, library or programming language you will learn next? And how do you make a decision between two similar things, for example: React or Vue.js? One criteria which can help making these decisions is figuring out how much of the knowledge required to learn a tool is generic and how much of it is specific.

Specific knowledge

Specific knowledge is knowledge, which you need to learn to use a tool, but won’t be applicable outside of it.

The more you have of it, the more problems you can solve with that tool and the more it will increase your speed of development with that tool.

One example for specific knowledge is the syntax of a templating language. Here are some examples of how different it can be:

Template example: Handlebars

<ul>
  {{#each people}}
    <li>{{this}}</li>
  {{/each}}
</ul>

Template example: Svelte.js

<ul>
  {#each items as item}
    <li>{item}</li>
  {/each}
</ul>

Template example: Vue.js

<ul>
  <li v-for="person in people">
    {{ person }}
  </li>
</ul>

These examples show that the syntax for a common problem like iterating over an array is different for each of them. Learning one won’t help doing the same in any other one.

Additionally the more requirements you have regarding this problem, the more differences you will find. Each of them has a different syntax for accessing the index of the current element, render based on conditions or filtering the array. The concept is the same, but the way to do it is different.

Now you might ask: Which one is the best?

My answer is: none of them. In this specific case the decision is subjective, so it doesn’t really matter.

I do think that there is a different and better solution to this problem though, and it has something to do with generic knowledge.

Generic knowledge

Generic knowledge is knowledge, which you need to learn to use a tool, that can be applied in other situations as well, e.g. different frameworks, libraries and even programming languages.

Let’s go back to the template syntax example. There is another quite popular tool called React, which has the following way to iterate over an array:

Template syntax: React

<ul>
  {people.map(person =>
    <li>{person}</li>
  )}
</ul>

There is still some specific syntax knowledge here: how JSX works and when to add the curly brackets. Apart from this though, iterating over a list in React means using Array.map.

Learning how to use this function will be helpful whenever you need to write code which works with arrays. It will be useful in other frameworks, in other programming languages and can even be a first step towards learning more about functional programming, which is again generic knowledge.

This is the great thing about generic knowledge and it’s what people mean when saying: “learning React, means learning JavaScript”.

The more generic knowledge you have, the quicker you will understand other previously unknown areas of programming.

Choosing tools which mostly require generic knowledge will allow you onboard your colleagues faster, because they might know most things already. It will also reduce the amount of maintenance, since generic knowledge most often is based on standards/specifications and therefore less likely to change.

There is a much higher chance that a single framework/library author who came up with a new way of doing something, releases a breaking change, than that a specification changes. Additionally when a new version of a specification is created, a lot of effort is spent to maintain backwards compatibility with the previous one.

Software which relies on specifications is software which relies on agreement. People spent a lot of time to come up with solutions for generic problems. Then they have agreed upon them and formulated a specification, which ended up in programming languages or other tools.

Note: I chose React as an example, because it is very popular and a lot of people know it. This doesn’t mean it generally is the best tool for this example. A tool like hyperapp-html uses even more generic knowledge to iterate over a list:

Example: hyperapp

ul(
  people.map(person =>
    li(person)
  )
)

Except for the order of function parameters, there is no specific knowledge here. The rest is JavaScript’s native syntax (or any other C style language) for function calls.

Build upon generic knowledge

What if you want to create a new library, framework or programming language? Think about how much specific knowledge you introduce with your tool.

Is it possible to build on top of agreements and use concepts that people already know? The more you reduce the amount of specific knowledge, the faster people will be able to learn and use that thing you are building.

This is not always possible, especially when tackling very new problems, but maybe there are parts of it, which don’t need to reinvent the wheel. Or maybe reinventing them accidentally resulted in only giving a half-baked solution to the given problems when you compare it to existing standardised solutions.

Conclusion

The ratio of generic and specific knowledge required by tools differs. Some require more specific knowledge, some require less.

Specific knowledge is neither bad nor good. It can be valuable when the tool allows you to solve a completely new problem for example or when it also teaches some generic knowledge in other areas.

This shouldn’t be the only criteria when evaluating which tool to learn or use next, but it should be one of them.

If every criteria is quite equal and the choice is between generic vs specific knowledge, I recommend to learn the tool which builds upon generic knowledge. Because it’s based on specifications, it’s not only easier to learn for you and your colleagues, it’s also more reliable, requires less maintenance in the future and generic knowledge will help you for the rest of your career.

Share on twitter