Lacerte/clima

Use barrel files to reduce amount of imports

Closed this issue · 2 comments

A barrel file is something like this:

export 'foo/bar.dart';
export 'baz/bat.dart';

As for why we might want to do this, I'll let the data speak (this was run on up-to-date master, with no generated Dart files):

$ grep import -wr */{lib,test} | wc -l
     442
$ cloc */{lib,test}
      82 text files.
      82 unique files.
       0 files ignored.

github.com/AlDanial/cloc v 1.92  T=0.06 s (1382.2 files/s, 84230.6 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Dart                            82            717            467           3813
-------------------------------------------------------------------------------
SUM:                            82            717            467           3813
-------------------------------------------------------------------------------

442 over 3813 comes out to around 11.6% of all non-empty lines of code being imports. That's just ridiculous.

Damn!

I'm having second thoughts about this; I don't see an actual benefit of using barrel files, especially given that imports are handled automatically by the editor, and we shouldn't be mindlessly trying to decrease SLoC for no good reason. @prestosole opinion?