5 ms·
I'm honestly impressed. After more than 20 years programming and reading about programs, this is the first time that I find such a thing: a concise and well-wr
by enriquto 7y ago
I'm honestly impressed. After more than 20 years programming and reading about programs, this is the first time that I find such a thing: a concise and well-written description of the exact opposite of everything that I believe in. It's like the author was reading my mind and applied a NOT filter before writing it back.
- sansnomme 7y agoFound our functional programmer ;)
- islon 7y agoYou are not alone! I kept reading the post in disbelief: "OK, he must be joking... he's not joking..."
- andyg_blog 7y agoI'm interested in learning more about your thoughts. Please elaborate?
- Risord 7y agoCode smell #1/#2: If you have too long function/method break it apart. How does this relate code being in function VS method Code smell #3/#4: If you don't want to put helpers to global scope then just don't. I don't see why closures are so bad. Top level function can act pretty much same as class scope so what's the difference? I don't know about python but if you really don't want to use closure another languages have other encapsulation methods too. Code smell #5: If you use closure you can have shared state. Passing state can be noise but on the other hand if you only read/write "semi global" variables it's messy too. If you need to pass lot amount of state it's usually hint that you have some other problem in your code. 1. Like said you don't need objects 2. Function have single entry without ambiguity like @Someone shows. 3. You should test behavior, not specific implementation. You don't need mocking for pure functions. 4. Is X optional? What about Y? Does order matter when calling 'withs'? And that builder thing is directly stolen from all the Java jokes. 5. I don't know what is Pythonish way to do delayed callability but I claim that it should be independent thing rather than directly bounded to specific function/object. If it looks like a function, swims like a function, and quacks like a function, then it probably is a function.
- linkdd 7y ago5. I do not know if it's pythonish, but I use and abuse functools.partial
- svat 7y agoSimilar thoughts, and I found this post very valuable for that reason. Programmers belong to different cultures, and this gives a clear idea of how (some) people from a certain culture think / what their values are. Really helps with empathy if when arguing with someone you can form a genuine mental model of another person rather than deciding they're stupid or misguided or whatever.