From 25ed12c96a8008d74d319fd774fb699c9f3542e7 Mon Sep 17 00:00:00 2001 From: Anthony Bilinski Date: Sun, 16 Sep 2018 19:40:22 -0700 Subject: [PATCH] chore(docs): update coding_standards to avoid singletons Fix #5339 --- doc/coding_standards.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/coding_standards.md b/doc/coding_standards.md index c2d1e070d..ce60a96ba 100644 --- a/doc/coding_standards.md +++ b/doc/coding_standards.md @@ -390,6 +390,16 @@ extern "C" { #include ``` +### Singletons + +Do not introduce new singleton classes. Prefer to move code in the direction +of fewer singleton classes over time. + +Singletons complicate destruction, complicate making multiple instances of +something in the future, i.e. having two Tox profiles loaded at once is +difficult to implement in qTox because both Settings and Profile are singleton. +Singleton's also make unit testing and reasoning more difficult by more +tightly coupling classes. ## Documentation