Proof of concept: A plugin written using TypeScript and custom components

Re: Proof of concept: A plugin written using TypeScript and custom components

by Noel De Martin -
Number of replies: 0
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Thanks for your feedback, it's very useful smile.

> Now I have to rewrite the entire thing differently for the app. And of course that means I've got to learn a lot more with very little documentation, and as you mentioned, pore over the source code.

This is one of the reasons why I have my doubts if this approach I've been playing with is worth the effort. Most Moodle developers already know PHP and mustache, and that's what most of the documentation about mobile plugins refers to. This could also be improved and documented further, so it doesn't necessarily mean that it's the wrong approach.

Given that the mustache is actually an Ionic template, it's possible to have interactive views using things such as otherdata without writing any javaScript. And that may be the best way to do it for a Moodle developer who is not familiar with Ionic. For me, because I am familiar with Ionic and TypeScript, it feels awkard to use mustache and PHP to write anything for the app, that's why I investigated this alternative. But I still have some doubts about how many developers are in this position.

> And actually while searching the forum to find an answer to one of my questions, I found several who mentioned that they were trying to develop plugins designed totally for the app.

I haven't seen a lot of this, so if you or anyone else reading this can share links to those posts I would appreciate it smile. I'll also do some searching myself.

> I have noticed that there are only 21 mobile-friendly plugins published on the list (https://moodle.org/plugins/?q=award:mobile-app), so perhaps there is just not enough uptake / future in it.

I also have some doubts whether this is a cause or a consequence. Maybe there are more developers who want to adapt their plugin to mobile, but they have given up after finding the current process too cumbersome. Then again, maybe not, maybe there's just not enough demand.

> I think one of the things that promotes an open source environment is ease of entry. This is helped by good documentation, and good documentation is helped by everyone being on the same team: the moodle HQ and those of us on the fringe. There is simply less motivation for documentation to be developed well if people are all working using different methods.

Yes, I agree. Regardless of supporting this new approach or not, for sure we'll improve the documentation. We have actually been working on this recently, and hopefully we'll be able to release it soon. You can follow this issue in the tracker if you want to be notified when it gets released: MOBILE-3431.

> If the capability is not there, then it follows that developers won't be able to use it, so they will be stuck using the old tech. Then there are fewer examples of innovative work being done, and it is harder for developers to get an imagination for what can be possible except by looking at competitors. This would doom Moodle to always being behind competitors.

I also agree with this, but I'm not sure if the community of Moodle developers would adopt this "innovative" approach. Not because they don't want to innovate, but if they are working with PHP it's understandable that they are not familiar with TypeScript and mobile frameworks like Ionic. That's why I'm unsure about this, because supporting this wouldn't be trivial and the added complexity/maintenance burden may not be a good trade-off.

What we can do, for sure, is improve the current approach. And even support TypeScript without components by providing typings and better documentation. We are just finishing the 3.9.5 release that has been focused on migrating to Ionic 5 and improving a11y. For the version 4.0 we'll focus on UX, and we can improve some DX (developer experience) things as well.