DUNE-DAQ / minidaqapp

0 stars 1 forks source link

Misuse of inheritance in newconf modules #132

Open alessandrothea opened 2 years ago

alessandrothea commented 2 years ago

Based on a quick survey it seems that newconf modules are misusing/abusing inheritance to effectively populate appfwk.App objects. This antipattern takes the following form

class MyApp(App):
  def __init__(self, ...)
     # countless of lines of code
     super().__init__(mgraph, host=HOST)

This is misleading because MyApp doesn't extend App in any way, it just populates its data members. If populating App objects is the purpose of these modules, a function must be used instead, e.g.

def my_app(self,...):
     # countless lines of code
     return App(mgraph, host=HOST)