SlapOS Home SlapOS

    Vifib guidelines

    Guidelines for Vifib/SlapOS development
    • Last Update:2020-05-25
    • Version:001
    • Language:en

     System requirements shall be checked explicitly

    Each time there is dynamic system requirement it shall be checked explicitly for its existence. It is disallowed to do checks based on "global" parameters, like software version.

    Good coding

    try:
      import elmementtree
    except ImportError:
      requirement_list.append('elementtree')
    

    Bad coding

    if sys.version < '2.5':
      requirement_list.append('elementtree')
    

    Rationale

    In above example developer assumes that python in version 2.5 and above has elementree included. Even if it is standard way of packaging python because of historical reasons or because of minimal package there are python versions greater or equal to 2.5 without elementtree. So such check is incorrect and leads to non functional program.