Most of today’s general purpose progamming languagues come with plethora of features. Often there are different levels of abstractions and intended use cases. Some features are primarily for library designers, others ease implementation of domain specific languages and application developers use mostly another feature set.
Some language communities are discussing “language profiles / levels” to ban certain potentionally harmful constructs. The typical audience like application programmers does not need them but removing them from the language would limit its usefulness in other cases. Examples are Scala levels (a bit dated), the Google C++ Style Guide or Profiles in the C++ Core Guidelines.
In the wild
When reading other peoples code I often see novice code dealing with low-level threading. Or they go over board with templates, reflection or meta programming.
I have even seen custom
ClassLoaders in Java written by normal application programmers. People are using threads when workers, tasks, actors or other more high-level abstractions would fit much better.
Especially novices seem to be unable to recognize their limits and to stay off of inappropriate and potentially dangerous features.
How do you decide what is appropriate in your situation?
Well, that is a difficult question. If you find the task at hand seems hard you should probably take a step back because:
There are two hard things in computer science: cache invalidation, naming things, and off-by-one errors.
Then ask yourself some simple questions:
- Someone must have done it before. Have I searched thoroughly for hints or solutions?
- Is there a (better) library, data structure or abstraction?
- Do I really have to do this? There must be a better/easier way!
- What do I gain using feature/library/tool X and what are its costs? What about the alternatives?
You need some experience to recognize that you are on the wrong path, solving problems you would not even have if doing the right thing in the first place.
Experience is what you got by not having it when you needed it.
Try to know and admit your limits – there is nothing wrong with struggling to get things working but it helps to frequently check your direction by taking a step back and reflecting.