openflighthpc / flight-architect

Tool/library for managing standard config hierarchy and template rendering under-lying Alces clusters and other Alces tools
Eclipse Public License 2.0
0 stars 0 forks source link

We should define file paths in one, consistent place #42

Open bobwhitelock opened 5 years ago

bobwhitelock commented 5 years ago

Currently, some file paths are defined in FilePath, and others are defined in Constants, with some metaprogramming to allow direct access to the latter via the former:

https://github.com/alces-software/underware/blob/95e4fcdda0b5daf1135aae12fd12a622d069f864/lib/underware/file_path.rb#L84-L94

It would be better if we were more consistent with this, and the metaprogramming, in particular, makes it sometimes hard to work out where methods are coming from without knowing this detail of Underware. The natural place to do this would be to just move all file paths into FilePath, since Constants is intended only for constants (and file paths can be both static and generated using method arguments).

WilliamMcCumstie commented 5 years ago

The alternative to this is to have a class that "owns" a particular file. Multiple classes shouldn't be accessing the same file. This indicates that there hasn't been proper separation of concerns.

If a single class owns a file, then it can define the file path internally within itself. Then all the other classes use the files "owner" as the interface to it.