New JS code in Moodle - What should our policy be?

New JS code in Moodle - What should our policy be?

Dan Poltawski -
回帖数:10

In case you missed it, in 2.9 we have new Javascript module support to replace YUI.

Unfortunately we live in an imperfect world and the JS infrastructure in Moodle has been changing faster than many of us would like (and certainly faster than our code keeps up with 微笑). But, if we are to try and keep pace with our technical debt, it does make sense to set restrictions for new code to ensure we are vaguely moving forward.

So what do you think our policy should be? Should we prevent new code landing to Moodle core now which isn't using the module support?

My initial thought is that we should acknowledge the amount of code out there and the problems with our rapidly changing landscape by allowing YUI modules for this release (3.0) only. Give everyone whos got some working YUI code nearly ready to integrate to get it in - then prohibit new code landing to core from 3.1 onwards. Of course it'd still be preferred to avoid new YUI code landing, but perhaps there is a case for some flexibility here?

平均分:Useful (1)
回复Dan Poltawski

Re: New JS code in Moodle - What should our policy be?

Bas Brands -
Core developers的头像 Peer reviewers的头像 Plugin developers的头像 Plugins guardians的头像 Testers的头像

It's all changing quite fast indeed. I have just gotten used to writing everything in YUI modules 微笑 and I am real happy with the shift to AMD.

I would not mind rewriting YUI code to AMD for new versions, it needs to happen at some point anyway. For 3.0 it would be great to have a cleaner Moodle, AMD only, more renderers, new formslib, cleanups of old parts. For me that would make developing plugins so much nicer and I would prefer that over any new Moodle features. In fact I think cutting down the number of features would be very nice.

So what would the policy on Moodle core code be for this? Will some of Moodle core YUI code be rewritten, will we have a AMD Atto? That would be awesome!

回复Dan Poltawski

Re: New JS code in Moodle - What should our policy be?

Gareth J Barnard -
Core developers的头像 Particularly helpful Moodlers的头像 Plugin developers的头像

Hi Dan,

Difficult question.

Ok, how about a compromise.  As its clear that writing new YUI code is not a good thing at that needs to be discouraged as soon as possible, but at the same time you want to facilitate what is almost complete being accepted into M3.0.  So, instead of waiting until M3.1, why not apply the same 'code freeze' methodology?  Such that a date is set early on for M3.0 that no more YUI code will be accepted after that date, that developers must register their intent by that date with justification of the code they have almost completed for it to be accepted.  Then it must be completed by the standard 'code freeze' date or they will have to re-write in the new AMD way.

It may also help if effort (if not already) is undertaken in M3.0 to refactor the existing YUI code to AMD such that examples are already in place to assist developers who may have written a little new YUI but could switch at an early stage.

Theme developers already have examples in core and I've been working with Bas and others on the BS3 AMD version, so lots of good stuff going on there.  Course formats are another matter and I could benefit from some examples there and with the 'popular' set user preference functionality.

Cheers,

Gareth

回复Dan Poltawski

Re: New JS code in Moodle - What should our policy be?

Damyon Wiese -
IMO new YUI code should be discouraged from 3.0 - but not prevented.

The main reason is that we have not yet converted our core Moodle Js to AMD/JQuery - and there are a bunch of support functions that we need to put in place to make it easier (possible) to create awesome new interfaces. We also have some YUI Apis for which there is no equivalent (E.g. Atto plugins).

Some critical things we need to have available as an AMD module:
* Dialogues (not simple - don't look at JQuery - UI etc - it must be ARIA)
* Drag and drop (actually not that hard to do in HTML5 - but making it accessible is - ie keyboard nav and UI for choosing a drop target)
* Menus

Also some new things have not yet had a long life - e.g. Atto, edit pdf.
* We need to give a clear roadmap of these things before we convert them - it would be painful to rewrite Atto now and make people redo their plugins again - IMO this should be started in about 12 months.

As for progress for 3.0 - we are working on learning plans - and to do this we are adding support for some of this core functionality as AMD modules (All of the learning plans JS is AMD). We will get learning plans finished first as a standalone plugin (which means all new modules will be contained within the plugin), and then convert it to a "core ready" branch for integration to 3.0 (which is when we will convert these generic AMD modules to sit in "core"). Because of this plan, the new AMD modules wont land in the master branch until later in the cycle, which will not give devs as much time to use them.

The generic AMD modules included in the learning plans branch so far are:
* dragdrop
* dialogues (this is a thin wrapper to the YUI implementation)
* menus
* an ariatree control

The tracker issue for learning plans is https://tracker.moodle.org/browse/MDL-49458.

回复Damyon Wiese

Re: New JS code in Moodle - What should our policy be?

Derek Chirnside -

What is a "Learning Plan" Damyon?

I have checked the roadmap, there is a single line there and no link.  It is not listed under current work: https://docs.moodle.org/dev/Roadmap#Current_work

I've looked at the link: https://tracker.moodle.org/browse/MDL-49458  Three votes?

Is this work anything to do with the TotaraLMS learning plans?  eg https://help.totaralms.com/Learning_Plan_Templates.htm

Their work seems nice, but very corporate and behaviourist.

Once again I am a little surprised by what your guys are working on as significant new developments for the next version.  My own fault of course.  I have probably missed something somewhere. Is this a specific funded initiative, or a Moodle partner request?

-Derek



回复Derek Chirnside

Re: New JS code in Moodle - What should our policy be?

Richard Oelmann -
Core developers的头像 Plugin developers的头像 Testers的头像

Actually Derek, that's currently 0 votes and 3 watchers

回复Derek Chirnside

Re: New JS code in Moodle - What should our policy be?

Martin Dougiamas -
Core developers的头像 Documentation writers的头像 Moodle HQ的头像 Particularly helpful Moodlers的头像 Plugin developers的头像 Testers的头像
Hi Derek,

There will be a lot more posting and tidying up of pages coming up, but in short what "learning plans" is really finishing off the work to support competency-based education (CBE) that was started in MDL-40230 (Outcomes 2).  And yes, we are using some of Totara's design, although the parts we are taking are quite generic across all sectors, in that they are about every user having a "learning plan" consisting of competencies either gained or yet-to-be-gained.   There are lots of functioning solutions to this problem all over the place, including ELIS, Totara, Exabis and more, but we need a good structure in core for people to build on.


In future a lot of our bigger feature developments will be driven by the new Moodle Association (which should be launched soonish) and it will be a lot easier to see what is coming down the pipe.


Cheers

回复Martin Dougiamas

Re: New JS code in Moodle - What should our policy be?

Colin Fraser -
Documentation writers的头像 Testers的头像

Then if you are incorporating Learning Plans then are User Portfolios to be a future development?  Seriously, LPs just go with portfolios and I can't see the point of not having one. 


回复Damyon Wiese

Re: New JS code in Moodle - What should our policy be?

Dan Poltawski -

I want to be quite clear - I am talking here about new things landing into Moodle core - its different to the general support of YUI for add-ons which will continue for some time, similarly fixing and improving existing yui-based functionality.

Bas: I think we'd all love to have that clean break you talk about - but its not going to happen, there is just too much work to convert it (which also doesn't bring much benefit to our users, so is not a massive priority).

Damyon: But perhaps we could make that into a clearer statement - move towards only creating YUI stuff when necessary and if there is no good reason its not allowed.

回复Dan Poltawski

Re: New JS code in Moodle - What should our policy be?

Damyon Wiese -
"YUI stuff when necessary and if there is no good reason its not allowed" - yup - I would agree with that (for core).