Hi Fatjon,

I wonder how much you can try finding that out on your own by just
grepping for the names of the common Gang of Four [1] - design patterns
in the django source code. I just tried Observer, Factory and find
examples in the code, which sound like the developer really followed the
intention of that pattern, when they named the function / class, which
is good. Another example is Decorator:

> git grep decorator

gives many results, among those the file

django/utils/functional.py

There are the lines of code

def keep_lazy(*resultclasses):
    """
    A decorator that allows a function to be called with one or more lazy
    arguments. If none of the args are lazy, the function is evaluated
    immediately, otherwise a __proxy__ is returned that will evaluate the
    function when needed.
    """
    if not resultclasses:
        raise TypeError("You must pass at least one argument to
keep_lazy().")

    def decorator(func):
        ..
    return decorator

and that to me really looks exactly what the purpose of a decorator is.

Antje

[1] https://en.wikipedia.org/wiki/Gang_of_Four


On 11/17/19 3:40 AM, Fatjon Gërra wrote:
> Hi guys, can anyone suggest me some resources book/video/article where
> I can learn more about Design Patterns that the Django Team used in
> writing Django as a framework? For example, here
> <https://docs.djangoproject.com/en/2.2/misc/design-philosophies/> the
> Active Record pattern is mentioned. I am looking for the other ones. I
> want to dive into Django's source code and learn about Design Patterns
> at the same time. Thanks for the help!
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/039a922c-a882-4e82-be0b-0ea568850074%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/039a922c-a882-4e82-be0b-0ea568850074%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/91000c02-9596-0a9d-985d-f1a2c2df5562%40gmail.com.

Reply via email to