6.0.0-git
2024-05-04

Diff for RampageFramework between 7 and 8

+ Rampage - next gen horde php5 app-building framework



//get PEAR channel up for Horde so new code can be distributed!//



[[toc]]



++ General ideas



AJAX built-in

webservices

Context object?

see ruby on rails and DB_DataObject pdf

* all config in a sqlite core db - not sure about this

* next-gen !DataTree - RDO. Need a seperate tree/hierarchy solution

* Controller patterns - not necessarily a front controller, files already are that. unified /path/app/item/id would be good.

* integrate w/ existing Horde

* one database, pear installed files, one VFS space - have just one installed set of libs for multiple sites. do with HORDE_BASE or something similar?

* differentiate between rampage app core (replace giapeto?) and libraries. try to go with more libraries than monolithic framework?

* Context::appname::method($params) - this doesn't work, Rampage::app->method would. Already implemented in Registry class.

* Session object for managing data we expect to find in $_SESSION

* base Rampage on: ulaform, giapeto, wicked, should replace those ... ? jonah?

* Iterators! Only loop through data once!



Encapsulated globals in Rampage:: namespace. Goal to avoid global $conf, $prefs, etc. variables and to do lazy-loading of conf and prefs so they're not loaded when they're not needed. Maybe encapsulate prefs in a User object/namespace?



everything else pear installable

- apps - Horde/Rampage/App/Appname, or Apps?

- blocks - Horde/Rampage/Block/, or Horde/Block?

- libs



Each app has:

Views/

Forms/

Objects/

Methods/

Pages/?

Config/?

  xml files



Rampage::log() - just for admin messages

Rampage::message() or Rampage::notify()

For user level notification - html alerts, ajax, send email, jabber, etc. Can be triggered by an Observer but doesn't implement object relationshps. What should? Workflow...



++ RDO



Data dictionary - description of fields, basis for validation? required, etc... pull some from database, some from object hardcoded metadata?



Use Turba as basis for RDO_Storage objects



no set/get

just pass it a $form object

commands come in somewhere

Builder: http://www.javaworld.com/javaworld/jw-01-2004/jw-0102-toolbox-p2.html

http://www.javaworld.com/javaworld/jw-08-2003/jw-0801-toolbox.html - Listing 0.1.Elim... !



take interfaces that implement Iterator wherever possible



need basic classes for each backend (SQL, LDAP, Kolab, IMSP, etc) that provide a unified api

try hard not to use more than that api; write specific adapters when necessary (Whups with encapsulated specialized Mapper objects, etc.).



++ Display and templates, Views and Components



* views/components should be nestable

* need a concept of "slots" - where can a view put sub-views

* copy java's layout managers? or is that too heavy? want to keep it simple

* How much effort should be put into formats other than XHTML? probably different for data vs. components. Data should be available as a pdf, as rss feeds, in export formats. Components will still be xhtml, maybe wml for mobile device support, maybe php-gtk - more limited set.

* Fields

* html/xhtml/xml renderers

* php5 xsl?



!ViewBuilder/!PageBuilder custom views

Web services, command line, GET/web layout should be identical

App/Method/Params?



++ Things to remember



MVC is 30 years old



A rant on installing software: http://www.lastcraft.com/blog/index.php?p=11

Top Ten website mistakes: http://www.useit.com/alertbox/990502.html



double orderTotal;

Money amount = ...;

//...

orderTotal += amount.getValue(); // orderTotal must be in dollars



The problem with this approach is that the foregoing code makes a big assumption about how the Money class is implemented (that the "value" is stored in a double). Code that makes implementation assumptions breaks when the implementation changes. If, for example, you need to internationalize your application to support currencies other than dollars, then getValue() returns nothing meaningful. You could add a getCurrency(), but that would make all the code surrounding the getValue() call much more complicated, especially if you persist in using the getter/setter strategy to get the information you need to do the work. A typical (flawed) implementation might look like this:



Money amount = ...;

//...

value       =  amount.getValue();

currency    =  amount.getCurrency();

conversion  =  CurrencyTable.getConversionFactor( currency, USDOLLARS );

total       += value * conversion;

//...



This change is too complicated to be handled by automated refactoring. Moreover, you would have to make these sorts of changes everywhere in your code.



The business-logic-level solution to this problem is to do the work in the object that has the information required to do the work. Instead of extracting the "value" to perform some external operation on it, you should have the Money class do all the money-related operations, including currency conversion. A properly structured object would handle the total like this:



Money total  = ...;

Money amount = ...;



total.increaseBy( amount );



FlowLayoutPanel, GridLayoutPanel, BorderLayoutPanel, etc., but that mandates too many classes and a lot of duplicated code in those classes. A single heavyweight-class solution (adding methods to Container like layOutAsGrid(), layOutAsFlow(), etc.) is also impractical because you can't modify the source code for the Container simply because you need an unsupported layout. In the Strategy pattern, you create a Strategy interface (LayoutManager) implemented by several Concrete Strategy classes (FlowLayout, GridLayout, etc.). You then tell a Context object (a Container) how to do something by passing it a Strategy object. (You pass a Container a LayoutManager that defines a layout strategy.)



Frameworks



A discussion of fragile base classes would be incomplete without a mention of framework-based programming. Frameworks such as Microsoft Foundation Classes (MFC) have become a popular way of building class libraries. Though MFC itself is blessedly fading away, MFC's structure has been ingrained in countless Microsoft shops where programmers assumed that the Microsoft way was the best way.



A framework-based system typically starts with a library of half-baked classes that don't do everything they need to do, but rather rely on a derived class to provide missing functionality. A good example in Java is the Component's paint() method, which is effectively a place holder; a derived class must provide the real version.



You can get away with this sort of thing in moderation, but an entire class framework that depends on derivation-based customization is brittle in the extreme. The base classes are too fragile. When I programmed in MFC, I had to rewrite all my applications every time Microsoft released a new version. The code would often compile, but then not work because some base-class method changed.



All Java packages work quite well out of the box. You don't need to extend anything to make them function. This works-out-of-the-box structure is better than a derivation-based framework. It's easier to maintain and use, and doesn't put your code at risk if a Sun Microsystems-supplied class changes its implementation.