-
Mick Timony authored48ce7669
edx-platform Development Best Practices
There are many general best practices documented for Open edX Development in Confluence. The following best-practices are specific to edx-platform.
Course Access in LMS
the following technologies can be used to access course-related data:
- Course Overviews: Provide performant access to course metadata.
- Course Blocks: Provide performant access to the blocks in a course, including filtering and access control capabilities.
- Modulestore - Contains all course related data, including course metadata course blocks, and student module data. Course Overviews and Course Blocks are cached performant versions of a subset of this source data.
When coding in the LMS, it is generally preferred to use Course Overviews and Course Blocks, due to the following benefits:
- Cached versions of course data that are better optimized for Learners.
- A start of the separation of LMS and Studio data to move us closer to the ultimate ability to separate the two.
- Note: At this time, these preferred methods are for coding in the LMS, but
- outside of the courseware. Inside the courseware, there is more work to be done to take advantage of these techniques.
Prefer using Course Overviews where possible when you just need course
metadata, rather than loading the full course. For example, this could be done
by calling get_course_overview_with_access()
in place of
get_course_with_access
. If the course overview doesn't contain the data you
need, you should consider whether it makes sense to expand what is available via
the course overview. See an example use of course overviews in the course
outline feature.
Prefer using Course Blocks over loading a full course directly from the modulestore. The following is an example of using course blocks in the course outline feature.
If you need to load student user data to combine with the data you retrieve from the Course Blocks, you can load the student module data from the modulestore without loading the full course. Here is an example loading the student module data in the course outline feature.