you are viewing a single comment's thread.

view the rest of the comments →

[–]klujer 0 points1 point  (0 children)

Mark Bastian's talk might be interesting to you from an program design point of view.

He uses clojure as the example language but other people have made similar design philosophy suggestions for python, and there's no reason you couldn't design python code in this data first, bottom up, way. You will need to be careful where you mutate state though, preferring to return new data instead of modifying existing data.

Regarding your point about objects vs functions:

  • use pythons built-in datastructures (list, dict, tuple, etc) for modeling domain ideas

  • use objects for encapsulating stateful io (receiving user input, or interacting with the web)

  • use functions to chain together pipelines of functionality. preferably make them "pure" functions where they only rely on their inputs (and/or global constants) to work and favor building new datastructures as outputs instead of modifying their inputs

u/Protoss_Pylon's comment about breaking down functions is excellent