faif / python-patterns

A collection of design patterns/idioms in Python
40.47k stars 6.94k forks source link

Short descriptions #184

Closed archatas closed 6 years ago

archatas commented 7 years ago

It would be useful to have some more detailed descriptions for each pattern. I would put them in the comments above the code. The main questions would be:

Some of the patterns have comments or are obvious, but not all of them. Also, I think, that people with different computer science knowledge will check them, so it would be valuable to describe the patterns to them.

fkromer commented 7 years ago

I referenced some pattern examples like e.g. Singleton from different python-specific books in one of my projects. For some embedded software specific patterns I used the common structuring of pattern descriptions (context/when?, problem/why?, forces/what to consider?, solution/how?, example, resulting context/then?) shortly described here in another project. This works pretty well but the "descriptions" of single patterns tend to become very huge (especially if you consider programming language specific implementation variants/alternatives and/or context specific variants of the patterns) means very time consuming. Currently I try to stick to short listings of just keywords or one-liners which do just state but not explain the backgrounds right there but reference the reasoning from second sources (preferably "ever-green" books). However this requires that one already has some background or all the sources (right now only books) at hand...

BTW: I will not stick to the technologies used in my two projects (python sphinx, mkdocs) in the future. To ease writing, deployment, maintenance, etc. I am currently writing a jekyll theme which allows fast and ease setup and maintenance of projects hosted as Github Pages (or if non-public on Heroku). If you are interested in contributing feel free to check the jekyll-theme-p3 out.

faif commented 7 years ago

I find the reference of @fkromer a good start. @archatas do you think adding links to his examples suffices?

archatas commented 7 years ago

Yes, these seem quite helpful: https://fkromer.github.io/python-pattern-references/design/

faif commented 7 years ago

Good. Feel free to do it if you want and I'll merge it happily :)

archatas commented 7 years ago

Good idea :) I just have to finish some project I am working on at first.

faif commented 7 years ago

@mshcruz Started working on that and he is welcoming suggestions. Feel free to give them 👍