Forums / Cotonti / Development / 1.x to 2.0 Roadmap proposal

Major goals and

GHengeveld
#30911 2011-10-05 21:30

Along with the integration of an ORM I suggest we strive to write modules in Object-Oriented fashion. Plugins can remain procedural style. In order to write true (nice) OO code, I'd like to refrain from using globals ($db, $L) in class methods. This means we'll need another way of accessing them within a class. In case of $db this is best done by deriving (extending) model classes from the CotDB class. Added bonus: database queries can only be executed from the model, keeping true to MVC pattern.

For $L I think we'll need a static method, for example: $L['name'] becomes L::string('name'). This also allows for more flexibility by using other methods, for example L::format('name', array('a', 'b')).

View classes could extend CoTemplate class, but I'm not sure we should because a View isn't neccesarily parsed by CoTemplate, it could also be JSON, XML or some other weird format (even a binary file).

In my opinion RESTful principles should be the basis of every module and alternate output formats such as JSON or XML should be supported by default. This will make the link to mobile/webservices much easier.