tuttle-dev / tuttle

🪰 Tuttle - time and money management for freelancers
GNU General Public License v3.0
62 stars 12 forks source link

Pythonic singleton #147

Closed clstaudt closed 1 year ago

clstaudt commented 1 year ago

In Python any class can be easily turned into a singleton by adding a generic decorator.

This removes the need for special implementations of the singleton pattern like SingletonDataFrame.

The general idea here is to add new classes, layers and indirections only sparingly:

TimeTrackingView -> TimeTrackingIntent -> TimeTrackingDataFrameSource
is better than TimeTrackingView -> TimeTrackingIntent -> TimetrackingDataFrameSource -> SingletonDataFrame.

Complexity considered harmful.

vlad-ed-git commented 1 year ago

Neat 👍🏾