Future-proofing

From MODx Wiki

Jump to: navigation, search

The current MODx core is being rewritten and there are major changes. This article is aimed at helping programmers reduce the amount of recoding they will need to do in the future, and is based on statements made by the developer of the new core.

General Tips

  • Isolate anything that is dependent on custom SQL you author; put it in a class, a separate include of functions, etc. This will be the greatest point of change moving forward, as we abstract MODx away from MySQL, allowing it to work on any database platform PHP can connect to (taking advantage of PDO but not requiring it).
  • Anything you do repetitively, isolate into classes and/or functions you keep in external files. These can easily be incorporated now as well as the near future, and this will also insure you only have to change code in one place to upgrade when a major core change affects your code.
  • Don't add or change core tables; add a table that aggregates an existing core table with alternate or additional data. This way, when core structures change, you can much more easily manage that change in your isolated data structure and related code.
  • Don't panic. In most cases, the new object-oriented APIs will be available without sacrificing any of the existing API. Most existing API methods are just reimplemented using the new API for backwards compatibility (the new core is extendable and this is a good example). And as is proper with any framework, any public API methods that are going to be removed will be deprecated first, so you have prior warning to make any necessary adjustments.
  • If you are going to do a lot of database-dependent web application work, check out OpenGeek's xPDO work - speak to him about it or check out the many things he says about it on the forum. The future MODx core is powered by xPDO.
  • Jason has client sites running in the new MODx core powered by xPDO and "had to do little, if anything to them to make them work following an upgrade from 0.9.2.1 or 0.9.5 beta release."

Database Structure Changes

  • These will be significant, but the new APIs will be available before the database structure changes, making the upgrade path smooth.

Specific Known Changes

  • "Modules" will no longer exist in their current form. The new Manager will itself be powered by MODx, so any extra Manager facilities will need to be snippets, just like they would be a front-end app. You may therefore wish to develop a front-end application and restrict who can use it.
Personal tools