SlideShare una empresa de Scribd logo
1 de 48
Descargar para leer sin conexión
Moodle Development Best Practices

           Presented by:
            Justin Filip
Presentation outline


●
    Intro / development environment
●
    Best practices
●
    Peer reviews
●
    Working with the Moodle tracker
●
    Maintaining a plugin with Github
●
    Submitting a core patch to Moodle HQ
Development environment

●
    Web server:
     –   Apache
     –   Lighttpd
     –   Nginx
●
    Database server:
     –   MySQL
     –   PostgreSQL
●
    PHP (5.3.2 or later for Moodle 2.2)
●
    Code editor:
     –   Console (vim, Emacs)
     –   IDE (Eclipse, Netbeans, Sublime Text)
Console editor - Emacs
IDE - Netbeans
General development settings


●
    Enable developer debugging from Debugging section of the
    Development section of the Site administration menu
●
    If working with real user data, prevent emails from being sent
    out by adding $CFG->noemailever = true; to your
    config.php file
●
    If working on theme / CSS changes, enable Theme designer
    mode from the Theme settings section of the Site
    administration menu
     –   Important! Do not leave this setting enabled on
         production sites as it has a large performance hit
Best practices


●
    Correct usage of plugins and APIs
●
    Security
●
    Performance
●
    Testing
●
    Coding style
Key concepts: Correct usage of
plugins and APIs
Correct usage of plugins and APIs


●
    Key concepts:
    –   Plugin types
    –   Core APIs
    –   Database system
Key concepts: Moodle plugins


●
    http://docs.moodle.org/dev/Plugins
     –   Activity modules
     –   Authentication plugins
     –   Blocks
     –   Course formats
     –   Enrolment plugins
     –   Filters
     –   Local plugins
     –   Reports
     –   Repository plugins
     –   Themes
Extra: Moodle 2.3 plugin changes


●
    Assignment module
     –   /mod/assign/submission/
     –   /mod/assign/feedback/
●
    Repository plugins
     –   Support for alias / shortcut to external content
     –   supported_returntypes() should add
         FILE_REFERENCE to the return values to indicate this
Key concepts: database system


●
    http://docs.moodle.org/dev/Data_definition_API
●
    Plugin specific documentation – http://tinyurl.com/a3gvpjj
●
    Always use a primary key column called id
●
    Add indexes and foreign keys to your database tables
●
    If writing full SQL queries make sure to put table names within
          braces without the prefix
     –   {assignment_submissions} instead of
            mdl_assignment_submissions
●
    Use the built-in XMLDB editor in Moodle for managing your
        XML install files
Key concepts: Moodle core APIs

●
    Access
●
    Data manipulation (DML)
●
    File
●
    Form
●
    Logging
●
    Navigation
●
    Page
●
    Strings
●
    Upgrade
●
    Extra: data definition (DDL)
Correct usage of plugins and APIs:
Summary


    ●
        Key concepts:
        –   Plugin types
        –   Core APIs
        –   Database system
Security
Security


●
    Key concepts:
    –   Authentication
    –   Roles and capabilities
    –   User input
Key concepts: authentication


●
    How users get into the system
●
    Can connect to external systems:
     –   Problems if that system is unavailable
     –   SSO & SSI
●
    Confirming users and deletion
Key concepts: roles and capabilities


●
    Context levels:
     –   CONTEXT_SYSTEM, CONTEXT_COURSE, CONTEXT_USER,
         etc.
●
    Roles:
     –   Definitions
     –   Applicable contexts
●
    Capabilities
     –   Use the most specific capability possible
     –   Check in the most specific context level
Extra: context hierarchy
Key concepts: user input

●
    Never ever trust user input!!!
     –   Common web application problem
     –   Always sanitise input data
     –   required_param() & optional_param()
     –   required_param_array() &
         optional_param_array()
●
    Input parameter types:
     –   PARAM_ALPHA, PARAM_ALPHANUM, PARAM_NOTAGS,
         PARAM_CLEANHTML
     –   PARAM_EMAIL, PARAM_URL, PARAM_SAFEDIR
●
    Moodle form API (formslib) and SESSKEY validation
Extra: protecting access to your code


●
    Command-line only scripts:
    –   define('CLI_SCRIPT', true);
●
    Preventing directly loading a PHP file:
    –   defined('MDL_INTERNAL') ||
        die();
Security: Summary


●
    Authentication
●
    Roles and capabilities
●
    User input
Performance
Performance


●
    Key concepts:
    –   Database IO
    –   Profiling
Key concepts: database IO


●
    Limit returned dataset using $fields parameter
●
    Use result set paging with $limitfrom and $limitnum
●
    Use record sets to not load all returned data into memory
●
    Writing custom SQL queries
     –   Database agnostic
     –   Caution when using JOINs and subqueries
Key concepts: profiling


●
    Use good testing data
     –   Try to use a large dataset
     –   If at all available, use a copy of data from a production
         site
          ●
              Set $CFG->noemailever = true; in your Moodle
              config.php file
     –   Enable performance output on each Moodle page
          ●
              Displays execution time, memory usage, DB read /
              write, etc.
          ●
              http://tinyurl.com/axkuqjz
Key concepts: profiling with XHProf


●
    Facebook-developed live profiling of PHP code
●
    Built into Moodle
●
    Quantitative analysis of results from a page execution
●
    Pin-pointing performance problems
●
    Critical execution path
●
    http://techportal.inviqa.com/2009/12/01/profiling-with-xhprof/
     –   Ignore everything before the How to use XHProf section
XHProf: summary data
XHProf: execution call graph
Performance: Summary


●
    Database IO
●
    Profiling
Testing
Testing


●
    Key concepts:
    –   Unit testing
    –   Functional testing
    –   Performance testing
Key concepts: unit testing


●
    PHPUnit
     –   https://github.com/sebastianbergmann/phpunit/
●
    Testing single functions and methods in isolation
●
    Added to Moodle core in 2.3.0
●
    PHPUnit tests menu in the Development section of the Site
    administration menu contains more information how to setup
    and use them
●
    See examples from other core code and plugins
Key concepts: functional testing


●
    Testing interaction with your code via web browser or a
    simulated web browser
●
    Can be used to find UI display problems across multiple
    browsers / OSs
●
    Selenium – http://seleniumhq.org/
●
    Moodle HQ Behat testing
     –   https://moodle.org/mod/forum/discuss.php?d=221638
     –   To be available for plugin authors as well as used in core
         Moodle
Key concepts: performance testing


●
    Jmeter
    –   http://jmeter.apache.org/
●
    Stress testing
●
    Simulates load from many concurrent users
Extra: Moodle Universal Cache (MUC)


●
    http://tinyurl.com/by7gs3p
●
    A generic caching system that any code can use
●
    Can plug into different back-end caching systems
●
    Introduced in Moodle 2.4.0
●
    Available to add-ons now, core components to use it in
    Moodle 2.0
Testing: Summary


●
    Unit testing
●
    Functional testing
●
    Performance testing
Coding style
Coding style


●
    More about how you write your code, not necessarily what you
    write
●
    Consistency allows for familiarity when looking at new areas
●
    Can prevent “bad” or sub-optimal code from being released
●
    CodeChecker plugin:
     –   http://tinyurl.com/a9z9d8o
Best practices: Summary


●
    Correct usage of plugins and APIs
●
    Security
●
    Performance
●
    Testing
●
    Coding style
Peer reviews


●
    Attempt to find problems before testing
●
    Ensure consistency in new code
●
    Make sure required information is present and correct
●
    Teaching tool for new developers
●
    Enforces style and correctness of solution
●
    Verify that new code is not using deprecated functionality
Peer review checklist

●
    Syntax
●
    Whitespace
●
    Output
●
    Language
●
    Databases
●
    Testing
●
    Security
●
    Documentation
●
    Git
●
    Sanity check
Working with the Moodle tracker


●
    Key concepts:
    –   Creating new issues
    –   Working on an existing issue
Key concepts: creating new issues


●
    Always make sure to see if the issue you want to create
    already exists
●
    Make sure to report as much information as possible
     –   Affects Version/s
     –   Database
     –   Testing instructions
     –   Workaround
●
    Important! Always include debugging messages and
    screenshots if reporting a bug
Key concepts: working on an existing issue


●
    Make sure nobody is working on it already
●
    Put in a comment to ask for the issue to be assigned to you
●
    Put your work in a publicly available Git repository and provide
    this information in the issue
●
    Make sure that you provide testing instructions for your work
●
    Request peer review when your work is finished
Maintaing a plugin with Github


●
    Use correct repository name (see Moodle Frankenstyle)
     –   http://docs.moodle.org/dev/Frankenstyle
●
    Create branches for supported Moodle versions (e.g.
    MOODLE_23_STABLE, MOODLE_24_STABLE)
●
    Provide documentation in the MoodleDocs wiki
●
    Submit the plugin to the Moodle.org plugins database
●
    Keep track of bugs and new features in the official tracker
     –   Request a component be created for your plugin in the
         Non-core contributed modules project
     –   http://tinyurl.com/b7xc7nv
Submitting core patches to HQ


●
    Fork the Moodle Github repository
    –   https://github.com/moodle/moodle
●
    Create branches for affected versions
●
    If this is for an existing issue, post the
    information for your repository into the issue
●
    If this is for something new, create a new
    issue and start a discussion in the Moodle.org
    forums
Thank you


●
    This presentation is available on SlideShare
    –   http://tinyurl.com/a3w7m2f


●
    Find me on Twitter
    –   @jfilip

Más contenido relacionado

La actualidad más candente

OpenCms Days 2015: Keynote - OpenCms 10 X marks the spot
OpenCms Days 2015: Keynote - OpenCms 10 X marks the spotOpenCms Days 2015: Keynote - OpenCms 10 X marks the spot
OpenCms Days 2015: Keynote - OpenCms 10 X marks the spotOpenCms
 
Drupal in 5mins + Previewing Drupal 8.x
Drupal in 5mins + Previewing Drupal 8.xDrupal in 5mins + Previewing Drupal 8.x
Drupal in 5mins + Previewing Drupal 8.xWong Hoi Sing Edison
 
Android App Development - 01 Introduction
Android App Development - 01 IntroductionAndroid App Development - 01 Introduction
Android App Development - 01 IntroductionDiego Grancini
 
OpenCms Days 2014 - OpenCms Module Development and Deployment with IntelliJ, ...
OpenCms Days 2014 - OpenCms Module Development and Deployment with IntelliJ, ...OpenCms Days 2014 - OpenCms Module Development and Deployment with IntelliJ, ...
OpenCms Days 2014 - OpenCms Module Development and Deployment with IntelliJ, ...Alkacon Software GmbH & Co. KG
 
BP210 XPages: Enter The Dojo
BP210 XPages: Enter The DojoBP210 XPages: Enter The Dojo
BP210 XPages: Enter The DojoPaul Withers
 
Applet blue j-intro_applets
Applet blue j-intro_appletsApplet blue j-intro_applets
Applet blue j-intro_appletsFajar Baskoro
 
Android App Development - 03 Resources
Android App Development - 03 ResourcesAndroid App Development - 03 Resources
Android App Development - 03 ResourcesDiego Grancini
 
OVERVIEW: Chromium Source Tree
OVERVIEW: Chromium Source TreeOVERVIEW: Chromium Source Tree
OVERVIEW: Chromium Source TreeChang W. Doh
 
DevHub 3 - Composer plus Magento
DevHub 3 - Composer plus MagentoDevHub 3 - Composer plus Magento
DevHub 3 - Composer plus MagentoMagento Dev
 
GUI toolkits comparison for python
GUI toolkits comparison for pythonGUI toolkits comparison for python
GUI toolkits comparison for pythonDarren Su
 
Joomla multilingual website without 3rd party extensions - Joomladay UK 2014
Joomla multilingual website without 3rd party extensions - Joomladay UK 2014Joomla multilingual website without 3rd party extensions - Joomladay UK 2014
Joomla multilingual website without 3rd party extensions - Joomladay UK 2014Peter Martin
 
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...Phase2
 

La actualidad más candente (18)

OpenCms Days 2015: Keynote - OpenCms 10 X marks the spot
OpenCms Days 2015: Keynote - OpenCms 10 X marks the spotOpenCms Days 2015: Keynote - OpenCms 10 X marks the spot
OpenCms Days 2015: Keynote - OpenCms 10 X marks the spot
 
OpenCms Days 2015 Hidden features of OpenCms
OpenCms Days 2015 Hidden features of OpenCmsOpenCms Days 2015 Hidden features of OpenCms
OpenCms Days 2015 Hidden features of OpenCms
 
Drupal in 5mins + Previewing Drupal 8.x
Drupal in 5mins + Previewing Drupal 8.xDrupal in 5mins + Previewing Drupal 8.x
Drupal in 5mins + Previewing Drupal 8.x
 
Training Google Drive and Hangouts.pptx
Training Google Drive and Hangouts.pptxTraining Google Drive and Hangouts.pptx
Training Google Drive and Hangouts.pptx
 
Android App Development - 01 Introduction
Android App Development - 01 IntroductionAndroid App Development - 01 Introduction
Android App Development - 01 Introduction
 
How Browser Works?
How Browser Works?How Browser Works?
How Browser Works?
 
Java
JavaJava
Java
 
OpenCms Days 2014 - OpenCms Module Development and Deployment with IntelliJ, ...
OpenCms Days 2014 - OpenCms Module Development and Deployment with IntelliJ, ...OpenCms Days 2014 - OpenCms Module Development and Deployment with IntelliJ, ...
OpenCms Days 2014 - OpenCms Module Development and Deployment with IntelliJ, ...
 
BP210 XPages: Enter The Dojo
BP210 XPages: Enter The DojoBP210 XPages: Enter The Dojo
BP210 XPages: Enter The Dojo
 
Applet blue j-intro_applets
Applet blue j-intro_appletsApplet blue j-intro_applets
Applet blue j-intro_applets
 
Android App Development - 03 Resources
Android App Development - 03 ResourcesAndroid App Development - 03 Resources
Android App Development - 03 Resources
 
OVERVIEW: Chromium Source Tree
OVERVIEW: Chromium Source TreeOVERVIEW: Chromium Source Tree
OVERVIEW: Chromium Source Tree
 
Flexbox
FlexboxFlexbox
Flexbox
 
DevHub 3 - Composer plus Magento
DevHub 3 - Composer plus MagentoDevHub 3 - Composer plus Magento
DevHub 3 - Composer plus Magento
 
java swing
java swingjava swing
java swing
 
GUI toolkits comparison for python
GUI toolkits comparison for pythonGUI toolkits comparison for python
GUI toolkits comparison for python
 
Joomla multilingual website without 3rd party extensions - Joomladay UK 2014
Joomla multilingual website without 3rd party extensions - Joomladay UK 2014Joomla multilingual website without 3rd party extensions - Joomladay UK 2014
Joomla multilingual website without 3rd party extensions - Joomladay UK 2014
 
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
 

Destacado

What is Moodle explained with Lego
What is Moodle explained with LegoWhat is Moodle explained with Lego
What is Moodle explained with LegoTomaz Lasic
 
Implementation of Moodle E-learning at a University
Implementation of Moodle E-learning at a UniversityImplementation of Moodle E-learning at a University
Implementation of Moodle E-learning at a UniversityRafiat Aliyu
 
Some Essential Moodle 2 plugins
Some Essential Moodle 2 pluginsSome Essential Moodle 2 plugins
Some Essential Moodle 2 pluginsGavin Henrick
 
A basic introduction to the Moodle architecture
A basic introduction to the Moodle architectureA basic introduction to the Moodle architecture
A basic introduction to the Moodle architectureTim Hunt
 
Best practices in Moodle Course Design
Best practices in Moodle Course DesignBest practices in Moodle Course Design
Best practices in Moodle Course DesignMichelle Moore
 
Moodle structural overview
Moodle structural overviewMoodle structural overview
Moodle structural overviewMark Drechsler
 
Best Moodle Plugins for Multi-Language Capabilities
Best Moodle Plugins for Multi-Language Capabilities Best Moodle Plugins for Multi-Language Capabilities
Best Moodle Plugins for Multi-Language Capabilities Lambda Solutions
 
Teaching with Moodle for Beginners Introductory Presentation
Teaching with Moodle for Beginners Introductory PresentationTeaching with Moodle for Beginners Introductory Presentation
Teaching with Moodle for Beginners Introductory PresentationAmmar A. ElMerhbi
 
Moodle slides3
Moodle slides3Moodle slides3
Moodle slides3yeamuna
 
Teaching with Moodle: Engaging Learners through Online Discussions
Teaching with Moodle: Engaging Learners through Online DiscussionsTeaching with Moodle: Engaging Learners through Online Discussions
Teaching with Moodle: Engaging Learners through Online DiscussionsAlexandre Enkerli
 
Diseño e Implementación de una Plataforma E-Learning para la Materia de Tecno...
Diseño e Implementación de una Plataforma E-Learning para la Materia de Tecno...Diseño e Implementación de una Plataforma E-Learning para la Materia de Tecno...
Diseño e Implementación de una Plataforma E-Learning para la Materia de Tecno...Alex Carrión
 
Moodle Presentation for Teachers
Moodle Presentation for TeachersMoodle Presentation for Teachers
Moodle Presentation for TeachersLaura Deadman
 
Moodle Course Creator Certificate 2016
Moodle Course Creator Certificate 2016Moodle Course Creator Certificate 2016
Moodle Course Creator Certificate 2016Elearning Experts LLC
 
Moodle Doodle 4
Moodle Doodle 4Moodle Doodle 4
Moodle Doodle 4tankprice
 
Best Practices In Moodle Administration
Best Practices In Moodle AdministrationBest Practices In Moodle Administration
Best Practices In Moodle Administrationmoorejon
 
Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Denish Patel
 
The Essential PostgreSQL.conf
The Essential PostgreSQL.confThe Essential PostgreSQL.conf
The Essential PostgreSQL.confRobert Treat
 

Destacado (20)

What is Moodle explained with Lego
What is Moodle explained with LegoWhat is Moodle explained with Lego
What is Moodle explained with Lego
 
Best Ways of Using Moodle
Best Ways of Using MoodleBest Ways of Using Moodle
Best Ways of Using Moodle
 
Implementation of Moodle E-learning at a University
Implementation of Moodle E-learning at a UniversityImplementation of Moodle E-learning at a University
Implementation of Moodle E-learning at a University
 
Some Essential Moodle 2 plugins
Some Essential Moodle 2 pluginsSome Essential Moodle 2 plugins
Some Essential Moodle 2 plugins
 
A basic introduction to the Moodle architecture
A basic introduction to the Moodle architectureA basic introduction to the Moodle architecture
A basic introduction to the Moodle architecture
 
Best practices in Moodle Course Design
Best practices in Moodle Course DesignBest practices in Moodle Course Design
Best practices in Moodle Course Design
 
Moodle structural overview
Moodle structural overviewMoodle structural overview
Moodle structural overview
 
Best Moodle Plugins for Multi-Language Capabilities
Best Moodle Plugins for Multi-Language Capabilities Best Moodle Plugins for Multi-Language Capabilities
Best Moodle Plugins for Multi-Language Capabilities
 
Moodle Activities and Plugins
Moodle Activities and PluginsMoodle Activities and Plugins
Moodle Activities and Plugins
 
Teaching with Moodle for Beginners Introductory Presentation
Teaching with Moodle for Beginners Introductory PresentationTeaching with Moodle for Beginners Introductory Presentation
Teaching with Moodle for Beginners Introductory Presentation
 
Moodle slides3
Moodle slides3Moodle slides3
Moodle slides3
 
Teaching with Moodle: Engaging Learners through Online Discussions
Teaching with Moodle: Engaging Learners through Online DiscussionsTeaching with Moodle: Engaging Learners through Online Discussions
Teaching with Moodle: Engaging Learners through Online Discussions
 
Diseño e Implementación de una Plataforma E-Learning para la Materia de Tecno...
Diseño e Implementación de una Plataforma E-Learning para la Materia de Tecno...Diseño e Implementación de una Plataforma E-Learning para la Materia de Tecno...
Diseño e Implementación de una Plataforma E-Learning para la Materia de Tecno...
 
Moodle Presentation for Teachers
Moodle Presentation for TeachersMoodle Presentation for Teachers
Moodle Presentation for Teachers
 
Moodle Course Creator Certificate 2016
Moodle Course Creator Certificate 2016Moodle Course Creator Certificate 2016
Moodle Course Creator Certificate 2016
 
Moodle
MoodleMoodle
Moodle
 
Moodle Doodle 4
Moodle Doodle 4Moodle Doodle 4
Moodle Doodle 4
 
Best Practices In Moodle Administration
Best Practices In Moodle AdministrationBest Practices In Moodle Administration
Best Practices In Moodle Administration
 
Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)
 
The Essential PostgreSQL.conf
The Essential PostgreSQL.confThe Essential PostgreSQL.conf
The Essential PostgreSQL.conf
 

Similar a Moodle Development Best Pracitces

Becoming A Drupal Master Builder
Becoming A Drupal Master BuilderBecoming A Drupal Master Builder
Becoming A Drupal Master BuilderPhilip Norton
 
Best practices in Moodle administration Monatana Moot 2014
Best practices in Moodle administration Monatana Moot 2014Best practices in Moodle administration Monatana Moot 2014
Best practices in Moodle administration Monatana Moot 2014moorejon
 
DevOps for TYPO3 Teams and Projects
DevOps for TYPO3 Teams and ProjectsDevOps for TYPO3 Teams and Projects
DevOps for TYPO3 Teams and ProjectsFedir RYKHTIK
 
Implementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing CompanyImplementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing CompanyMarcos Labad
 
Liferay portals in real projects
Liferay portals  in real projectsLiferay portals  in real projects
Liferay portals in real projectsIBACZ
 
Your First Scala Web Application using Play 2.1
Your First Scala Web Application using Play 2.1Your First Scala Web Application using Play 2.1
Your First Scala Web Application using Play 2.1Matthew Barlocker
 
Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8Sam Becker
 
Scaling AngularJS: Enterprise SOA on the MEAN Stack (Responsive Web & Mobile)
Scaling AngularJS: Enterprise SOA on the MEAN Stack (Responsive Web & Mobile)Scaling AngularJS: Enterprise SOA on the MEAN Stack (Responsive Web & Mobile)
Scaling AngularJS: Enterprise SOA on the MEAN Stack (Responsive Web & Mobile)Movel
 
Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020
Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020
Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020Andrew Yatsenko
 
Code driven development in drupal
Code driven development in drupalCode driven development in drupal
Code driven development in drupalAndriy Yun
 
Java on Google App engine
Java on Google App engineJava on Google App engine
Java on Google App engineMichael Parker
 
"Building Modern PHP Applications" - Jackson Murtha, South Dakota Code Camp 2012
"Building Modern PHP Applications" - Jackson Murtha, South Dakota Code Camp 2012"Building Modern PHP Applications" - Jackson Murtha, South Dakota Code Camp 2012
"Building Modern PHP Applications" - Jackson Murtha, South Dakota Code Camp 2012Blend Interactive
 
EuroPython 2013 - Python3 TurboGears Training
EuroPython 2013 - Python3 TurboGears TrainingEuroPython 2013 - Python3 TurboGears Training
EuroPython 2013 - Python3 TurboGears TrainingAlessandro Molina
 
PowerShell Plus v4.7 Overview
PowerShell Plus v4.7 OverviewPowerShell Plus v4.7 Overview
PowerShell Plus v4.7 OverviewRichard Giles
 
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Mack Hardy
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Drupalcon Paris
 
OroCRM Partner Technical Training: September 2015
OroCRM Partner Technical Training: September 2015OroCRM Partner Technical Training: September 2015
OroCRM Partner Technical Training: September 2015Oro Inc.
 

Similar a Moodle Development Best Pracitces (20)

Becoming A Drupal Master Builder
Becoming A Drupal Master BuilderBecoming A Drupal Master Builder
Becoming A Drupal Master Builder
 
Best practices in Moodle administration Monatana Moot 2014
Best practices in Moodle administration Monatana Moot 2014Best practices in Moodle administration Monatana Moot 2014
Best practices in Moodle administration Monatana Moot 2014
 
DevOps for TYPO3 Teams and Projects
DevOps for TYPO3 Teams and ProjectsDevOps for TYPO3 Teams and Projects
DevOps for TYPO3 Teams and Projects
 
Implementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing CompanyImplementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing Company
 
Liferay portals in real projects
Liferay portals  in real projectsLiferay portals  in real projects
Liferay portals in real projects
 
Integration testing - A&BP CC
Integration testing - A&BP CCIntegration testing - A&BP CC
Integration testing - A&BP CC
 
Your First Scala Web Application using Play 2.1
Your First Scala Web Application using Play 2.1Your First Scala Web Application using Play 2.1
Your First Scala Web Application using Play 2.1
 
Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8
 
Scaling AngularJS: Enterprise SOA on the MEAN Stack (Responsive Web & Mobile)
Scaling AngularJS: Enterprise SOA on the MEAN Stack (Responsive Web & Mobile)Scaling AngularJS: Enterprise SOA on the MEAN Stack (Responsive Web & Mobile)
Scaling AngularJS: Enterprise SOA on the MEAN Stack (Responsive Web & Mobile)
 
Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020
Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020
Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020
 
Code driven development in drupal
Code driven development in drupalCode driven development in drupal
Code driven development in drupal
 
Java on Google App engine
Java on Google App engineJava on Google App engine
Java on Google App engine
 
Routing
RoutingRouting
Routing
 
Automated testing
Automated testingAutomated testing
Automated testing
 
"Building Modern PHP Applications" - Jackson Murtha, South Dakota Code Camp 2012
"Building Modern PHP Applications" - Jackson Murtha, South Dakota Code Camp 2012"Building Modern PHP Applications" - Jackson Murtha, South Dakota Code Camp 2012
"Building Modern PHP Applications" - Jackson Murtha, South Dakota Code Camp 2012
 
EuroPython 2013 - Python3 TurboGears Training
EuroPython 2013 - Python3 TurboGears TrainingEuroPython 2013 - Python3 TurboGears Training
EuroPython 2013 - Python3 TurboGears Training
 
PowerShell Plus v4.7 Overview
PowerShell Plus v4.7 OverviewPowerShell Plus v4.7 Overview
PowerShell Plus v4.7 Overview
 
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
 
OroCRM Partner Technical Training: September 2015
OroCRM Partner Technical Training: September 2015OroCRM Partner Technical Training: September 2015
OroCRM Partner Technical Training: September 2015
 

Último

MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFMichael Gough
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsYoss Cohen
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 

Último (20)

MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platforms
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 

Moodle Development Best Pracitces

  • 1. Moodle Development Best Practices Presented by: Justin Filip
  • 2. Presentation outline ● Intro / development environment ● Best practices ● Peer reviews ● Working with the Moodle tracker ● Maintaining a plugin with Github ● Submitting a core patch to Moodle HQ
  • 3. Development environment ● Web server: – Apache – Lighttpd – Nginx ● Database server: – MySQL – PostgreSQL ● PHP (5.3.2 or later for Moodle 2.2) ● Code editor: – Console (vim, Emacs) – IDE (Eclipse, Netbeans, Sublime Text)
  • 6. General development settings ● Enable developer debugging from Debugging section of the Development section of the Site administration menu ● If working with real user data, prevent emails from being sent out by adding $CFG->noemailever = true; to your config.php file ● If working on theme / CSS changes, enable Theme designer mode from the Theme settings section of the Site administration menu – Important! Do not leave this setting enabled on production sites as it has a large performance hit
  • 7. Best practices ● Correct usage of plugins and APIs ● Security ● Performance ● Testing ● Coding style
  • 8. Key concepts: Correct usage of plugins and APIs
  • 9. Correct usage of plugins and APIs ● Key concepts: – Plugin types – Core APIs – Database system
  • 10. Key concepts: Moodle plugins ● http://docs.moodle.org/dev/Plugins – Activity modules – Authentication plugins – Blocks – Course formats – Enrolment plugins – Filters – Local plugins – Reports – Repository plugins – Themes
  • 11. Extra: Moodle 2.3 plugin changes ● Assignment module – /mod/assign/submission/ – /mod/assign/feedback/ ● Repository plugins – Support for alias / shortcut to external content – supported_returntypes() should add FILE_REFERENCE to the return values to indicate this
  • 12. Key concepts: database system ● http://docs.moodle.org/dev/Data_definition_API ● Plugin specific documentation – http://tinyurl.com/a3gvpjj ● Always use a primary key column called id ● Add indexes and foreign keys to your database tables ● If writing full SQL queries make sure to put table names within braces without the prefix – {assignment_submissions} instead of mdl_assignment_submissions ● Use the built-in XMLDB editor in Moodle for managing your XML install files
  • 13. Key concepts: Moodle core APIs ● Access ● Data manipulation (DML) ● File ● Form ● Logging ● Navigation ● Page ● Strings ● Upgrade ● Extra: data definition (DDL)
  • 14. Correct usage of plugins and APIs: Summary ● Key concepts: – Plugin types – Core APIs – Database system
  • 16. Security ● Key concepts: – Authentication – Roles and capabilities – User input
  • 17. Key concepts: authentication ● How users get into the system ● Can connect to external systems: – Problems if that system is unavailable – SSO & SSI ● Confirming users and deletion
  • 18. Key concepts: roles and capabilities ● Context levels: – CONTEXT_SYSTEM, CONTEXT_COURSE, CONTEXT_USER, etc. ● Roles: – Definitions – Applicable contexts ● Capabilities – Use the most specific capability possible – Check in the most specific context level
  • 20. Key concepts: user input ● Never ever trust user input!!! – Common web application problem – Always sanitise input data – required_param() & optional_param() – required_param_array() & optional_param_array() ● Input parameter types: – PARAM_ALPHA, PARAM_ALPHANUM, PARAM_NOTAGS, PARAM_CLEANHTML – PARAM_EMAIL, PARAM_URL, PARAM_SAFEDIR ● Moodle form API (formslib) and SESSKEY validation
  • 21. Extra: protecting access to your code ● Command-line only scripts: – define('CLI_SCRIPT', true); ● Preventing directly loading a PHP file: – defined('MDL_INTERNAL') || die();
  • 22. Security: Summary ● Authentication ● Roles and capabilities ● User input
  • 24. Performance ● Key concepts: – Database IO – Profiling
  • 25. Key concepts: database IO ● Limit returned dataset using $fields parameter ● Use result set paging with $limitfrom and $limitnum ● Use record sets to not load all returned data into memory ● Writing custom SQL queries – Database agnostic – Caution when using JOINs and subqueries
  • 26. Key concepts: profiling ● Use good testing data – Try to use a large dataset – If at all available, use a copy of data from a production site ● Set $CFG->noemailever = true; in your Moodle config.php file – Enable performance output on each Moodle page ● Displays execution time, memory usage, DB read / write, etc. ● http://tinyurl.com/axkuqjz
  • 27. Key concepts: profiling with XHProf ● Facebook-developed live profiling of PHP code ● Built into Moodle ● Quantitative analysis of results from a page execution ● Pin-pointing performance problems ● Critical execution path ● http://techportal.inviqa.com/2009/12/01/profiling-with-xhprof/ – Ignore everything before the How to use XHProf section
  • 30. Performance: Summary ● Database IO ● Profiling
  • 32. Testing ● Key concepts: – Unit testing – Functional testing – Performance testing
  • 33. Key concepts: unit testing ● PHPUnit – https://github.com/sebastianbergmann/phpunit/ ● Testing single functions and methods in isolation ● Added to Moodle core in 2.3.0 ● PHPUnit tests menu in the Development section of the Site administration menu contains more information how to setup and use them ● See examples from other core code and plugins
  • 34. Key concepts: functional testing ● Testing interaction with your code via web browser or a simulated web browser ● Can be used to find UI display problems across multiple browsers / OSs ● Selenium – http://seleniumhq.org/ ● Moodle HQ Behat testing – https://moodle.org/mod/forum/discuss.php?d=221638 – To be available for plugin authors as well as used in core Moodle
  • 35. Key concepts: performance testing ● Jmeter – http://jmeter.apache.org/ ● Stress testing ● Simulates load from many concurrent users
  • 36. Extra: Moodle Universal Cache (MUC) ● http://tinyurl.com/by7gs3p ● A generic caching system that any code can use ● Can plug into different back-end caching systems ● Introduced in Moodle 2.4.0 ● Available to add-ons now, core components to use it in Moodle 2.0
  • 37. Testing: Summary ● Unit testing ● Functional testing ● Performance testing
  • 39. Coding style ● More about how you write your code, not necessarily what you write ● Consistency allows for familiarity when looking at new areas ● Can prevent “bad” or sub-optimal code from being released ● CodeChecker plugin: – http://tinyurl.com/a9z9d8o
  • 40. Best practices: Summary ● Correct usage of plugins and APIs ● Security ● Performance ● Testing ● Coding style
  • 41. Peer reviews ● Attempt to find problems before testing ● Ensure consistency in new code ● Make sure required information is present and correct ● Teaching tool for new developers ● Enforces style and correctness of solution ● Verify that new code is not using deprecated functionality
  • 42. Peer review checklist ● Syntax ● Whitespace ● Output ● Language ● Databases ● Testing ● Security ● Documentation ● Git ● Sanity check
  • 43. Working with the Moodle tracker ● Key concepts: – Creating new issues – Working on an existing issue
  • 44. Key concepts: creating new issues ● Always make sure to see if the issue you want to create already exists ● Make sure to report as much information as possible – Affects Version/s – Database – Testing instructions – Workaround ● Important! Always include debugging messages and screenshots if reporting a bug
  • 45. Key concepts: working on an existing issue ● Make sure nobody is working on it already ● Put in a comment to ask for the issue to be assigned to you ● Put your work in a publicly available Git repository and provide this information in the issue ● Make sure that you provide testing instructions for your work ● Request peer review when your work is finished
  • 46. Maintaing a plugin with Github ● Use correct repository name (see Moodle Frankenstyle) – http://docs.moodle.org/dev/Frankenstyle ● Create branches for supported Moodle versions (e.g. MOODLE_23_STABLE, MOODLE_24_STABLE) ● Provide documentation in the MoodleDocs wiki ● Submit the plugin to the Moodle.org plugins database ● Keep track of bugs and new features in the official tracker – Request a component be created for your plugin in the Non-core contributed modules project – http://tinyurl.com/b7xc7nv
  • 47. Submitting core patches to HQ ● Fork the Moodle Github repository – https://github.com/moodle/moodle ● Create branches for affected versions ● If this is for an existing issue, post the information for your repository into the issue ● If this is for something new, create a new issue and start a discussion in the Moodle.org forums
  • 48. Thank you ● This presentation is available on SlideShare – http://tinyurl.com/a3w7m2f ● Find me on Twitter – @jfilip