Skip to content

modules are too long and have too many symbols #235

Closed
@mikofski

Description

@mikofski

Several modules have become quite long which IMO makes them difficult to use and maintain. Obviously modules can be any size and structure, but I think that long files are difficult to navigate, and modules with too many symbols are error prone due to shadowing and namespace collision.

module number of lines number of symbols
pvlib.pvsystem 2211 23
pvlib.clearsky 489 13
pvlib.atmosphere 472 6
pvlib.forecast 1113 7
pvlib.irradiance 1949 23
pvlib.location 287 1
pvlib.modelchain 722 3
pvlib.solarposition 840 12
pvlib.spa 1300 50
pvlib.tmy 497 8
pvlib.tools 259 14
pvlib.tracking 523 3

In particular pvsystem, forecast, irradiance and spa are very long and contain a lot of symbols.

I don't know what would be ideal, but IMO I think a maximum of 500 lines and 10 symbols is a good baseline.

The SPA algorithm presents a unique challenge, as this code was ported, so maybe for reference sake, it should stay as it is. However, I think that the very large arrays of coefficients in irradiance and spa take a lot of space. These could easily be moved to HDF5 files using h5py which would have some memory and speed enhancements, but I'll create a related issue for that.

References for large modules and many symbols.

  1. Programmers-SE: Are there any negative side effects of splitting up large modules? [closed]
  2. Wikipedia: God Object
  3. Wikipedia: Anti-Pattern

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions