Skip to content

Commit

Permalink
docs: [FC-0074] add diagram to better illustrate differences between …
Browse files Browse the repository at this point in the history
…hook types (#616)

* docs: add diagram to better illustrate differences between hook types

* docs: add reference to attrs and in-memory platform objects

* fix: remove unnecessary pipe for table

* docs: include more details in diagram

* refactor: address PR reviews
  • Loading branch information
mariajgrimaldi authored Nov 26, 2024
1 parent feaf14d commit 449d81f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion source/developers/concepts/hooks_extension_framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,18 @@ Here are some key differences between Open edX Events and Filters:
| **Implementation** | Implemented using `Django signals`_, which allow | Implemented using an accumulative pipeline mechanism which |
| | developers to send and receive notifications that an action happened | takes a set of arguments and returns a modified set |
| | within a Django application. | to the caller or raises exceptions during |
| | | processing. |
| | Events use `attrs`_ classes with simple data types. | processing. The input arguments are in-memory platform |
| | | objects that can be modified. |
+--------------------+------------------------------------------------------------------------+-------------------------------------------------------------+
| **Use cases** | Send an email notification when a user enrolls in a course. | Prevent the enrollment of non-authorized users. |
+--------------------+------------------------------------------------------------------------+-------------------------------------------------------------+

In this diagram you can see the main differences in functionality between Open edX Events and Filters:

.. image:: /_images/hooks_events_and_filters_side_by_side.png
:alt: Open edX Events and Filters Side by Side
:align: center

How to Know When to Use an Event or a Filter?
=============================================

Expand Down Expand Up @@ -161,3 +168,4 @@ We encourage you to review the list of use cases for events and filters to draw
.. _openedx-events: https://github.com/openedx/openedx-events
.. _Django signals: https://docs.djangoproject.com/en/4.2/topics/signals/
.. _Product Proposal: https://openedx.atlassian.net/wiki/spaces/COMM/pages/3875962884/How+to+submit+an+open+source+contribution+for+Product+Review
.. _attrs: https://www.attrs.org/en/stable/

0 comments on commit 449d81f

Please sign in to comment.