Skip to content

post idea: my path to functional programming #8

@jrheard

Description

@jrheard

mainly came out of experiences i had while i was at yelp
cmd class with tons of mixins
tons of code like self._maybe_perform_obscure_side_effect()
multidomainmixin, had to print it out and tape it to a whiteboard, took a solid week and a half to figure it out
self.display was the main pattern, led to lots of code like self.get_data() followed by self.get_photos(), and if you didn't remember to call self.get_data() your page would crash, and if you called self.get_photos() before self.get_data() the page would crash or have subtle bugs, and self.get_photos() and self.get_data() were undocumented huge methods and it was impossible to fit either (much less both!) into your head
bigo wrote a comment somewhere saying self.display was a bad idea, and i thought that sounded right but i couldn't articulate why, and didn't know what to do instead
bigo started using the env kwarg, and things just sort of went from there
derwiki had a tweet like "if functional programming was a stock, i'd buy it", and that sounded clever but i didn't know what it meant, couldn't figure out what functional programming was even by googling [MAYBE PUT THIS AT THE START OF THE ARTICLE ALONG WITH A SIMPLE EXPLANATION OF WHAT FUNCTIONAL PROGRAMMING IS]
also i read some short hacker news comment where a guy said that he actually avoids using classes in python, and tries to just spend as much of his time as possible using namedtuples, lists, dicts, and functions
and again it all just sort of went from there
tried common lisp, then haskell, then clojure, and now here we are

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions