-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type system is overcomplicated #146
Comments
If we do undertake such a refactor, it's worth discussing whether we want to clean up the nomenclature at the same time. There's significant confusion generated by widespread conflation of ideas and words: the function There seem to be many other instances of names generating confusion. Another one is the function Given these pop out just from a casual reading of the code, it would seem that a thorough review is needed to refactor this code, which is critical to our coupled modeling system, into high quality, maintainable, and understandable software... |
@akshaysridhar I'm happy to take this on. If we accept that refactoring is needed then perhaps a place to start is an SDI that proposes a new structure and naming scheme for |
@glwagner Thanks for raising this issue - Agreed - we can start a refactor SDI + propose updated/consistent nomenclature to make integration into other systems more intuitive. |
I'm wondering if the code is more complicated than it needs to be. There are three types for each universal function, eg
BusingerParams
,BusingerType
, and thenBusinger
.The "*Type" is superfluous with the
*Params
types, since eachType
is simply related to eachParams
adding no additional information:SurfaceFluxes.jl/src/UniversalFunctions.jl
Lines 1113 to 1118 in f83dc86
I propose refactoring the code to simplify the type structure by combining the concepts of "params" and "type".
I also cannot see the purpose of the types which are currently called
Businger
,Gryanik
, etc. These types are distinct from the "params" and "type" objects by providing a place to store the Monin-Obukhov length. But these objects to not compute this length; it's computed externally. And the length stored there is never actually used outside of the scope where it is computed. In other words, the only time we access the lengthL
is a few lines after it is computed (here,L_MO
is an input argument to the function):SurfaceFluxes.jl/src/SurfaceFluxes.jl
Lines 806 to 817 in f83dc86
If there is no specific purpose for
Businger
,Gryanik
then they should be eliminated. Note also that these types are all identical, so even if we want to keep them, there only needs to be one type that holds on toL
.In summary, I propose the following changes:
uf
:Businger
,Gryanik
, etc*Type
" constructs:BusingerType
, etc*Params
types for dispatch, whereBusinger
andBusingerType
are now usedParams
suffix from the existing types to make the lexicon more concise and clear, reflecting the fact that these types both control dispatch and also hold parameter values. EgBusingerParams
should simply be calledBusinger
(orBusingerUniversalFunction
to be more verbose).The first 3 changes are purely internal refactoring, while the last changes the user API.
The text was updated successfully, but these errors were encountered: